----- Original Message -----
> Set up GDB_CONF_FLAGS from the configure utility. This avoids duplication
> of logic between configure.c and Makefile. Additionally, the new method
> ensures that the gdb target always matches the configured crash target.
> This may become useful when we allow cross-compiling crash for a
> different target (think of arm on x86, for example).
Other than potentially having an x86_64-host/64-bit-ARM-target binary
in the future, I don't see any future cross-compiling happening. The
current ARM support on x86/x86_64 hosts only exists by luck due to its
similarity in endian-ness and word size with x86. So cross-compiling
the embedded gdb module won't have any affect on the crash source code.
Well, I was talking about compiling an arm crash binary on x86_64 (with a
cross-compiler). Anyway, this was not my primary motivation.
I'm still pursuing a cross-platform crash project (not necessarily merged with
your sources), and getting as much as possible into upstream would make my
life easier. So, I'm sending the bits that are beneficial to both.
The other thing is -- and I haven't tested this -- is that when
we
build the crash utility, it doesn't necessarily have the same configuration
strings that you hardwire. I'm not sure what that means with respect
to the gdb module? For example, our x86_64 and ia64 builds configure
them as:
ia64-unknown-linux-gnu
This is in fact the expanded form of ia64-linux-gnu. You can see that if you
run "gdb-7.0/config.sub ia64-linux-gnu".
Interesting. I thought it was consistent on the "pc" part. And this code
snippet from gdb 7.0's config.sub suggests the "unknown" tag is not used:
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64)
basic_machine=$basic_machine-pc
;;
(I haven't checked any of the other arches...)
So I'm wondering whether forcing them to a different string would
have any effect on systems with build tools that come up with a
different string? Do you have any insight there?
In theory, yes. In practice, there is no difference for all *-*-linux-gnu
targets. BTW you had already hardwired the target specification for ARM and
X86 if they are cross-compiled...
Petr
Dave
> Signed-off-by: Petr Tesarik <ptesarik(a)suse.cz>
>
> ---
> Makefile | 18 ++----------------
> configure.c | 32 +++++++++++++++++++++++++++++---
> 2 files changed, 31 insertions(+), 19 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,16 @@ 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_X86 "GDB_CONF_FLAGS=--target=i686-pc-linux-gnu"
> +#define GDB_TARGET_ALPHA "GDB_CONF_FLAGS=--target=alpha-linux-gnu"
> +#define GDB_TARGET_PPC "GDB_CONF_FLAGS=--target=powerpc-linux-gnu"
> +#define GDB_TARGET_IA64 "GDB_CONF_FLAGS=--target=ia64-linux-gnu"
> +#define GDB_TARGET_S390 "GDB_CONF_FLAGS=--target=s390-ibm-linux-gnu"
> +#define GDB_TARGET_S390X
> "GDB_CONF_FLAGS=--target=s390x-ibm-linux-gnu"
> +#define GDB_TARGET_PPC64
> "GDB_CONF_FLAGS=--target=powerpc64-linux-gnu"
> +#define GDB_TARGET_X86_64
> "GDB_CONF_FLAGS=--target=x86_64-pc-linux-gnu"
> +#define GDB_TARGET_ARM "GDB_CONF_FLAGS=--target=arm-elf-linux-gnu"
> +
> /*
> * The original plan was to allow the use of a particular version
> * of gdb for a given architecture. But for practical purposes,
> @@ -512,6 +522,7 @@ build_configure(struct supported_gdb_ver
> char buf[512];
> char *target;
> char *target_CFLAGS;
> + char *gdb_conf_flags;
>
> get_current_configuration(sp);
>
> @@ -525,34 +536,42 @@ build_configure(struct supported_gdb_ver
> target_CFLAGS = TARGET_CFLAGS_X86_ON_X86_64;
> else
> target_CFLAGS = TARGET_CFLAGS_X86;
> + gdb_conf_flags = GDB_TARGET_X86;
> break;
> case ALPHA:
> target = TARGET_ALPHA;
> target_CFLAGS = TARGET_CFLAGS_ALPHA;
> + gdb_conf_flags = GDB_TARGET_ALPHA;
> break;
> case PPC:
> target = TARGET_PPC;
> target_CFLAGS = TARGET_CFLAGS_PPC;
> + gdb_conf_flags = GDB_TARGET_PPC;
> break;
> case IA64:
> target = TARGET_IA64;
> target_CFLAGS = TARGET_CFLAGS_IA64;
> + gdb_conf_flags = GDB_TARGET_IA64;
> break;
> case S390:
> target = TARGET_S390;
> target_CFLAGS = TARGET_CFLAGS_S390;
> + gdb_conf_flags = GDB_TARGET_S390;
> break;
> case S390X:
> target = TARGET_S390X;
> target_CFLAGS = TARGET_CFLAGS_S390X;
> + gdb_conf_flags = GDB_TARGET_S390X;
> break;
> case PPC64:
> target = TARGET_PPC64;
> target_CFLAGS = TARGET_CFLAGS_PPC64;
> + gdb_conf_flags = GDB_TARGET_PPC64;
> break;
> case X86_64:
> target = TARGET_X86_64;
> target_CFLAGS = TARGET_CFLAGS_X86_64;
> + gdb_conf_flags = GDB_TARGET_X86_64;
> break;
> case ARM:
> target = TARGET_ARM;
> @@ -562,6 +581,7 @@ build_configure(struct supported_gdb_ver
> target_CFLAGS = TARGET_CFLAGS_ARM_ON_X86_64;
> else
> target_CFLAGS = TARGET_CFLAGS_ARM;
> + gdb_conf_flags = GDB_TARGET_ARM;
> break;
> }
>
> @@ -573,6 +593,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 +768,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(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/crash-utility
--
Crash-utility mailing list
Crash-utility(a)redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility