diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2013-11-11 22:32:18 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2013-11-11 22:32:18 +0400 |
commit | a126fd4cf264d740c2824071022e12c307e498de (patch) | |
tree | 32ed41c68ae9a5fe639005920e9d4745e4e695ac /dyn_load.c | |
parent | d1d634d0db9b019469a708669ae0e7827f58cfa9 (diff) | |
download | bdwgc-a126fd4cf264d740c2824071022e12c307e498de.tar.gz |
Workaround 'ELF_DATA/EM_ALPHA redefined' warning in Android link.h
(revert part of commit a6e4ee9)
* 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 avoid "macro redefined"
warnings reported for link.h of Android Bionic.
Diffstat (limited to 'dyn_load.c')
-rw-r--r-- | dyn_load.c | 51 |
1 files changed, 32 insertions, 19 deletions
@@ -96,27 +96,40 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0; /* Exclude Android because linker.h below includes its own version. */ # include <elf.h> # endif -# include <link.h> -# if defined(PLATFORM_ANDROID) && !defined(GC_DONT_DEFINE_LINK_MAP) +# ifdef PLATFORM_ANDROID /* If you don't need the "dynamic loading" feature, you may build */ /* the collector with -D IGNORE_DYNAMIC_LOADING. */ - /* Otherwise, link_map and r_debug should be defined explicitly, */ - /* as only bionic/linker/linker.h defines them but the header */ - /* itself is a C++ one starting from Android 4.3. */ - struct link_map { - uintptr_t l_addr; - char* l_name; - uintptr_t l_ld; - struct link_map* l_next; - struct link_map* l_prev; - }; - struct r_debug { - int32_t r_version; - struct link_map* r_map; - void (*r_brk)(void); - int32_t r_state; - uintptr_t r_ldbase; - }; +# ifdef BIONIC_ELFDATA_REDEF_BUG + /* Workaround a problem in Bionic (as of Android 4.2) 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 <link.h> +# if !defined(GC_DONT_DEFINE_LINK_MAP) + /* link_map and r_debug should be defined explicitly, */ + /* as only bionic/linker/linker.h defines them but the header */ + /* itself is a C++ one starting from Android 4.3. */ + struct link_map { + uintptr_t l_addr; + char* l_name; + uintptr_t l_ld; + struct link_map* l_next; + struct link_map* l_prev; + }; + struct r_debug { + int32_t r_version; + struct link_map* r_map; + void (*r_brk)(void); + int32_t r_state; + uintptr_t r_ldbase; + }; +# endif +# else +# include <link.h> # endif #endif |