This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Don't include <elf.h> in gdbserver/linux-arm-low.c


Hi.

On android, Bionic's headers use an enum to define AT_* in elf.h and use #defines to define AT_NULL(et.al.) in linux/elf.h (well, actually linux/auxvec.h - autogenerated from the kernel).  Plus there are other collisions:

In file included from ../../src/gdb/gdbserver/linux-arm-low.c:24:
/usr/local/g2/android/mydroid/development/ndk/build/platforms/android-5/arch-arm/usr/include/elf.h:33: error: expected identifier before numeric constant
In file included from /usr/local/g2/android/mydroid/development/ndk/build/platforms/android-5/arch-arm/usr/include/elf.h:56,
                 from ../../src/gdb/gdbserver/linux-arm-low.c:24:
/usr/local/g2/android/mydroid/development/ndk/build/platforms/android-5/arch-arm/usr/include/sys/exec_elf.h:62: error: conflicting types for 'Elf64_Half'
/usr/local/g2/android/mydroid/development/ndk/build/platforms/android-5/arch-arm/usr/include/linux/elf.h:32: note: previous declaration of 'Elf64_Half' was here
In file included from /usr/local/g2/android/mydroid/development/ndk/build/platforms/android-5/arch-arm/usr/include/elf.h:56,
                 from ../../src/gdb/gdbserver/linux-arm-low.c:24:
/usr/local/g2/android/mydroid/development/ndk/build/platforms/android-5/arch-arm/usr/include/sys/exec_elf.h:125: error: redefinition of 'struct elf32_hdr'
/usr/local/g2/android/mydroid/development/ndk/build/platforms/android-5/arch-arm/usr/include/sys/exec_elf.h:141: error: conflicting types for 'Elf32_Ehdr'
/usr/local/g2/android/mydroid/development/ndk/build/platforms/android-5/arch-arm/usr/include/linux/elf.h:189: note: previous declaration of 'Elf32_Ehdr' was here
[...]

Since gdb_proc_service.h already includes linux/elf.h there's no need to include elf.h.
I haven't tested this with glibc though.

Ok to check in?
Or should this wait pending testing with glibc (I'm not likely to be able to get to it though, does anyone have an arm-linux system they can test this on?)?

2010-01-19  Doug Evans  <dje@google.com>

	* linux-arm-low.c: Don't include <elf.h>.

Index: linux-arm-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-arm-low.c,v
retrieving revision 1.21
diff -u -p -r1.21 linux-arm-low.c
--- linux-arm-low.c	1 Jan 2010 07:31:49 -0000	1.21
+++ linux-arm-low.c	20 Jan 2010 00:12:35 -0000
@@ -20,7 +20,8 @@
 #include "server.h"
 #include "linux-low.h"
 
-#include <elf.h>
+/* We use to #include <elf.h> here, but elf.h and linux/elf.h
+   don't play nice together in Bionic libc.  */
 #include <sys/ptrace.h>
 
 #include "gdb_proc_service.h"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]