This is my take two of the patch. It doesn't change the resulting GDB_CONF_FLAGS, but the logic is no longer split between configure.c and Makefile. Signed-off-by: Petr Tesarik <ptesarik@xxxxxxx>
--- Makefile | 18 ++---------------- configure.c | 32 ++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 24 deletions(-) --- a/configure.c +++ b/configure.c @@ -18,14 +18,14 @@ /* * define, clear and undef dynamically update the top-level Makefile: * - * -b define: TARGET, GDB, GDB_FILES, GDB_OFILES, GDB_PATCH_FILES, TARGET_CFLAGS and GPL_FILES + * -b define: TARGET, GDB, GDB_FILES, GDB_OFILES, GDB_PATCH_FILES, TARGET_CFLAGS, GDB_CONF_FLAGS and GPL_FILES * create: build_data.c * - * -d define: TARGET, GDB, GDB_FILES, GDB_OFILES, GDB_PATCH_FILES, TARGET_CFLAGS, and + * -d define: TARGET, GDB, GDB_FILES, GDB_OFILES, GDB_PATCH_FILES, TARGET_CFLAGS, GDB_CONF_FLAGS and * PROGRAM (for daemon) * create: build_data.c * - * -u clear: TARGET, GDB, GDB_FILES, GDB_OFILES, VERSION, GDB_PATCH_FILES, TARGET_CFLAGS and GPL_FILES + * -u clear: TARGET, GDB, GDB_FILES, GDB_OFILES, VERSION, GDB_PATCH_FILES, TARGET_CFLAGS, GDB_CONF_FLAGS and GPL_FILES * undef: WARNING_ERROR, WARNING_OPTIONS * * -r define: GDB_FILES, VERSION, GDB_PATCH_FILES GPL_FILES @@ -131,6 +131,11 @@ int name_to_target(char *); #define TARGET_CFLAGS_ARM_ON_X86_64 "TARGET_CFLAGS=-m32 -D_FILE_OFFSET_BITS=64" #define TARGET_CFLAGS_X86_ON_X86_64 "TARGET_CFLAGS=-m32 -D_FILE_OFFSET_BITS=64" +#define GDB_TARGET_DEFAULT "GDB_CONF_FLAGS=" +#define GDB_TARGET_ARM_ON_X86 "GDB_CONF_FLAGS=--target=arm-elf-linux" +#define GDB_TARGET_ARM_ON_X86_64 "GDB_CONF_FLAGS=--target=arm-elf-linux CFLAGS=-m32" +#define GDB_TARGET_X86_ON_X86_64 "GDB_CONF_FLAGS=--target=i686-pc-linux-gnu CFLAGS=-m32" + /* * The original plan was to allow the use of a particular version * of gdb for a given architecture. But for practical purposes, @@ -512,18 +517,21 @@ build_configure(struct supported_gdb_ver char buf[512]; char *target; char *target_CFLAGS; + char *gdb_conf_flags; get_current_configuration(sp); target = target_CFLAGS = NULL; + gdb_conf_flags = GDB_TARGET_DEFAULT; switch (target_data.target) { case X86: target = TARGET_X86; - if (target_data.host == X86_64) + if (target_data.host == X86_64) { target_CFLAGS = TARGET_CFLAGS_X86_ON_X86_64; - else + gdb_conf_flags = GDB_TARGET_X86_ON_X86_64; + } else target_CFLAGS = TARGET_CFLAGS_X86; break; case ALPHA: @@ -556,11 +564,13 @@ build_configure(struct supported_gdb_ver break; case ARM: target = TARGET_ARM; - if (target_data.host == X86) + if (target_data.host == X86) { target_CFLAGS = TARGET_CFLAGS_ARM_ON_X86; - else if (target_data.host == X86_64) + gdb_conf_flags = GDB_TARGET_ARM_ON_X86; + } else if (target_data.host == X86_64) { target_CFLAGS = TARGET_CFLAGS_ARM_ON_X86_64; - else + gdb_conf_flags = GDB_TARGET_ARM_ON_X86_64; + } else target_CFLAGS = TARGET_CFLAGS_ARM; break; } @@ -573,6 +583,9 @@ build_configure(struct supported_gdb_ver else if (strncmp(buf, "TARGET_CFLAGS=", strlen("TARGET_CFLAGS=")) == 0) fprintf(fp2, "%s\n", target_CFLAGS); + else if (strncmp(buf, "GDB_CONF_FLAGS=", + strlen("GDB_CONF_FLAGS=")) == 0) + fprintf(fp2, "%s\n", gdb_conf_flags); else if (strncmp(buf, "GDB_FILES=",strlen("GDB_FILES=")) == 0) fprintf(fp2, "%s\n", sp->GDB_FILES); else if (strncmp(buf, "GDB_OFILES=",strlen("GDB_OFILES=")) == 0) @@ -745,6 +758,9 @@ unconfigure(void) else if (strncmp(buf, "TARGET_CFLAGS=", strlen("TARGET_CFLAGS=")) == 0) fprintf(fp2, "TARGET_CFLAGS=\n"); + else if (strncmp(buf, "GDB_CONF_FLAGS=", + strlen("GDB_CONF_FLAGS=")) == 0) + fprintf(fp2, "GDB_CONF_FLAGS=\n"); else if (strncmp(buf, "GDB_FILES=",strlen("GDB_FILES=")) == 0) fprintf(fp2, "GDB_FILES=\n"); else if (strncmp(buf, "GDB_OFILES=",strlen("GDB_OFILES=")) == 0) --- a/Makefile +++ b/Makefile @@ -23,30 +23,16 @@ PROGRAM=crash # # Supported targets: X86 ALPHA PPC IA64 PPC64 -# TARGET will be configured automatically by configure +# TARGET and GDB_CONF_FLAGS will be configured automatically by configure # TARGET= +GDB_CONF_FLAGS= ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) ifeq ($(ARCH), ppc64) CONF_FLAGS = -m64 endif -ifeq ($(TARGET), ARM) -ifeq ($(ARCH), i386) -GDB_CONF_FLAGS = --target=arm-elf-linux -endif -ifeq ($(ARCH), x86_64) -GDB_CONF_FLAGS = --target=arm-elf-linux CFLAGS=-m32 -endif -endif - -ifeq ($(TARGET), X86) -ifeq ($(ARCH), x86_64) -GDB_CONF_FLAGS = --target=i686-pc-linux-gnu CFLAGS=-m32 -endif -endif - # # GDB, GDB_FILES, GDB_OFILES and GDB_PATCH_FILES will be configured automatically by configure #
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility