Message ID | 1333692499-1635-1-git-send-email-sw@weilnetz.de |
---|---|
State | Superseded |
Headers | show |
On Fri, Apr 6, 2012 at 06:08, Stefan Weil <sw@weilnetz.de> wrote: > Not all i386 / x86_64 hosts use ELF. > Ask the compiler whether ELF is used. > > On w64, gdb crashes when ELF_HOST_MACHINE is defined. > > Cc: Richard Henderson <rth@twiddle.net> > Cc: Blue Swirl <blauwirbel@gmail.com> > Signed-off-by: Stefan Weil <sw@weilnetz.de> > --- > tcg/i386/tcg-target.c | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c > index 871a7e7..e34ea4b 100644 > --- a/tcg/i386/tcg-target.c > +++ b/tcg/i386/tcg-target.c > @@ -2102,7 +2102,9 @@ typedef struct { > DebugFrameFDE fde; > } DebugFrame; > > -#if TCG_TARGET_REG_BITS == 64 > +#if !defined(__ELF__) > + /* Host machine without ELF. */ > +#elif TCG_TARGET_REG_BITS == 64 > #define ELF_HOST_MACHINE EM_X86_64 > static DebugFrame debug_frame = { Would break mingw32 build: CC arm-softmmu/tcg/tcg.o In file included from /src/qemu/tcg/tcg.c:183:0: /src/qemu/tcg/i386/tcg-target.c: In function 'tcg_register_jit': /src/qemu/tcg/i386/tcg-target.c:2166:5: error: 'debug_frame' undeclared (first use in this function) /src/qemu/tcg/i386/tcg-target.c:2166:5: note: each undeclared identifier is reported only once for each function it appears in /src/qemu/tcg/tcg.c: At top level: /src/qemu/tcg/tcg.c:2513: error: redefinition of 'tcg_register_jit' /src/qemu/tcg/i386/tcg-target.c:2161: note: previous definition of 'tcg_register_jit' was here Please try a full build (no --target-list) before submitting patches. > .cie.len = sizeof(DebugFrameCIE)-4, /* length after .len member */ > -- > 1.7.9 >
diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c index 871a7e7..e34ea4b 100644 --- a/tcg/i386/tcg-target.c +++ b/tcg/i386/tcg-target.c @@ -2102,7 +2102,9 @@ typedef struct { DebugFrameFDE fde; } DebugFrame; -#if TCG_TARGET_REG_BITS == 64 +#if !defined(__ELF__) + /* Host machine without ELF. */ +#elif TCG_TARGET_REG_BITS == 64 #define ELF_HOST_MACHINE EM_X86_64 static DebugFrame debug_frame = { .cie.len = sizeof(DebugFrameCIE)-4, /* length after .len member */
Not all i386 / x86_64 hosts use ELF. Ask the compiler whether ELF is used. On w64, gdb crashes when ELF_HOST_MACHINE is defined. Cc: Richard Henderson <rth@twiddle.net> Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> --- tcg/i386/tcg-target.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)