corkscrew-x86: Fix build with some glibc versions

Make sure __USE_GNU is actually set before ucontext.h is included
(even implicitly).
This should fix the build inside android-build (wasn't broken locally
in the first place).

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
diff --git a/libcorkscrew/arch-x86/backtrace-x86.c b/libcorkscrew/arch-x86/backtrace-x86.c
index 29159ed..5f42cd7 100755
--- 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 "../ptrace-arch.h"
@@ -78,7 +85,6 @@
 #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__ */