diff options
author | Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org> | 2012-11-20 16:20:41 +0100 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2013-02-13 16:27:16 +0530 |
commit | 3cde86f9d28f4f6993bcef13d557367bf9ad55a3 (patch) | |
tree | 40460a3daff02042a39694a3349aa63a49ee1e28 | |
parent | 4f247d753a8865cd16292ff0b720b72c28049786 (diff) | |
download | core-3cde86f9d28f4f6993bcef13d557367bf9ad55a3.tar.gz |
Fix build in some linux-x86 host environments
Corkscrew-x86 needs __USE_GNU set before ucontext.h is included
(even if ucontext.h is included implicitly from another system header)
Also, some glibc headers #undef __USE_GNU unless _GNU_SOURCE is set.
adb links statically to libcrypto_static, which uses libdl - but doesn't
link to libdl manually, causing the build to fail with some versions of
ld.
Change-Id: Ic8fba210df502c3017e53a8ca4961c4a5815df67
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
-rw-r--r-- | adb/Android.mk | 1 | ||||
-rw-r--r-- | libcorkscrew/arch-x86/backtrace-x86.c | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/adb/Android.mk b/adb/Android.mk index bc8315ed2..097525531 100644 --- a/adb/Android.mk +++ b/adb/Android.mk @@ -79,6 +79,7 @@ LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE LOCAL_MODULE := adb LOCAL_STATIC_LIBRARIES := libzipfile libunz libcrypto_static $(EXTRA_STATIC_LIBS) +LOCAL_LDLIBS += -ldl ifeq ($(USE_SYSDEPS_WIN32),) LOCAL_STATIC_LIBRARIES += libcutils endif diff --git a/libcorkscrew/arch-x86/backtrace-x86.c b/libcorkscrew/arch-x86/backtrace-x86.c index fb79a0c87..3d310e6bd 100644 --- a/libcorkscrew/arch-x86/backtrace-x86.c +++ b/libcorkscrew/arch-x86/backtrace-x86.c @@ -21,6 +21,13 @@ #define LOG_TAG "Corkscrew" //#define LOG_NDEBUG 0 +#if !defined(__BIONIC__) +// This has to be done early on because one of the system +// includes might implicitly include <ucontext.h> +#define __USE_GNU // For REG_EBP, REG_ESP, and REG_EIP. +#define _GNU_SOURCE 1 // Sets __USE_GNU if features.h is included +#endif + #include "../backtrace-arch.h" #include "../backtrace-helper.h" #include <corkscrew/ptrace.h> @@ -75,7 +82,6 @@ typedef struct ucontext { #else /* __BIONIC__ */ // glibc has its own renaming of the Linux kernel's structures. -#define __USE_GNU // For REG_EBP, REG_ESP, and REG_EIP. #include <ucontext.h> #endif /* __ BIONIC__ */ |