]> granicus.if.org Git - gc/commitdiff
Workaround 'ELF_DATA/EM_ALPHA redefined' warning in Android linker.h
authorIvan Maidanski <ivmai@mail.ru>
Fri, 22 Feb 2013 04:25:27 +0000 (08:25 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 25 Feb 2013 09:35:42 +0000 (13:35 +0400)
* dyn_load.c: Include asm/elf.h and linux/elf-em.h explicitly, and
undefine ELF_DATA and EM_ALPHA (if PLATFORM_ANDROID and
BIONIC_ELFDATA_REDEF_BUG are defined) to workaround a bug (avoiding
"macro redefined" warnings) in Android 4.1 (and 4.2) Bionic which has
the mismatching macro definitions in headers included from linker.h.

dyn_load.c

index 9d9700fee53f9580988f4cb0de6613d9776f6c87..a6f4a86500b4d82998c3e8fb2c5f733847cae13d 100644 (file)
@@ -93,6 +93,15 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0;
     /* The header file is in "bionic/linker" folder of Android sources. */
     /* If you don't need the "dynamic loading" feature, you may build   */
     /* the collector with -D IGNORE_DYNAMIC_LOADING.                    */
+#   ifdef BIONIC_ELFDATA_REDEF_BUG
+      /* Workaround a problem in Android 4.1 (and 4.2) Bionic which has */
+      /* mismatching ELF_DATA definitions in sys/exec_elf.h and         */
+      /* asm/elf.h included from linker.h file (similar to EM_ALPHA).   */
+#     include <asm/elf.h>
+#     include <linux/elf-em.h>
+#     undef ELF_DATA
+#     undef EM_ALPHA
+#   endif
 #   include <linker.h>
 # else
 #   include <link.h>