Browse Source
The Android NDK headers define the RTLD_* values within an enum, which causes problems with #ifdef checks. Patch these to instead use #define which is more traditional and what much code expects.android-5
Fredrik Fornwall
9 years ago
5 changed files with 35 additions and 98 deletions
@ -0,0 +1,35 @@ |
|||
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/dlfcn.h ./usr/include/dlfcn.h
|
|||
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/dlfcn.h 2016-03-03 16:54:24.000000000 -0500
|
|||
+++ ./usr/include/dlfcn.h 2016-04-17 23:55:55.901040258 -0400
|
|||
@@ -49,22 +49,22 @@
|
|||
extern void* dlsym(void* handle, const char* symbol); |
|||
extern int dladdr(const void* addr, Dl_info *info); |
|||
|
|||
-enum {
|
|||
+/* Termux modification: Use #define for these instead of an enum
|
|||
+ to improve compatibility with ifdef checks. */
|
|||
#if defined(__LP64__) |
|||
- RTLD_NOW = 2,
|
|||
+# define RTLD_NOW 2
|
|||
#else |
|||
- RTLD_NOW = 0,
|
|||
+# define RTLD_NOW 0
|
|||
#endif |
|||
- RTLD_LAZY = 1,
|
|||
+#define RTLD_LAZY 1
|
|||
|
|||
- RTLD_LOCAL = 0,
|
|||
+# define RTLD_LOCAL 0
|
|||
#if defined(__LP64__) |
|||
- RTLD_GLOBAL = 0x00100,
|
|||
+# define RTLD_GLOBAL 0x00100
|
|||
#else |
|||
- RTLD_GLOBAL = 2,
|
|||
+# define RTLD_GLOBAL 2
|
|||
#endif |
|||
- RTLD_NOLOAD = 4,
|
|||
-};
|
|||
+#define RTLD_NOLOAD 4
|
|||
|
|||
#if defined (__LP64__) |
|||
#define RTLD_DEFAULT ((void*) 0) |
@ -1,21 +0,0 @@ |
|||
diff -u -r ../glib-2.46.2/gmodule/gmodule-dl.c ./gmodule/gmodule-dl.c
|
|||
--- ../glib-2.46.2/gmodule/gmodule-dl.c 2014-10-04 20:08:22.000000000 -0400
|
|||
+++ ./gmodule/gmodule-dl.c 2015-12-17 18:28:32.091292946 -0500
|
|||
@@ -57,6 +57,9 @@
|
|||
* RTLD_GLOBAL - the external symbols defined in the library will be made |
|||
* available to subsequently loaded libraries. |
|||
*/ |
|||
+#ifndef __ANDROID__
|
|||
+/* On Android the RTLD_* constants are enum values, so they
|
|||
+ cannot be checked with ifdef, and values are different. */
|
|||
#ifndef RTLD_LAZY |
|||
#define RTLD_LAZY 1 |
|||
#endif /* RTLD_LAZY */ |
|||
@@ -70,6 +73,7 @@
|
|||
#ifndef RTLD_GLOBAL |
|||
#define RTLD_GLOBAL 0 |
|||
#endif /* RTLD_GLOBAL */ |
|||
+#endif
|
|||
|
|||
|
|||
/* --- functions --- */ |
@ -1,29 +0,0 @@ |
|||
diff -u -r ../ruby-2.1.2/dln.c ./dln.c
|
|||
--- ../ruby-2.1.2/dln.c 2012-12-01 16:25:28.000000000 +0100
|
|||
+++ ./dln.c 2014-06-27 10:10:16.539935164 +0200
|
|||
@@ -1308,14 +1308,17 @@
|
|||
void *handle; |
|||
void (*init_fct)(); |
|||
|
|||
-#ifndef RTLD_LAZY
|
|||
-# define RTLD_LAZY 1
|
|||
-#endif
|
|||
-#ifdef __INTERIX
|
|||
-# undef RTLD_GLOBAL
|
|||
-#endif
|
|||
-#ifndef RTLD_GLOBAL
|
|||
-# define RTLD_GLOBAL 0
|
|||
+#ifndef __ANDROID__
|
|||
+ /* Android has RTLD_* as enum values and not defines */
|
|||
+# ifndef RTLD_LAZY
|
|||
+# define RTLD_LAZY 1
|
|||
+# endif
|
|||
+# ifdef __INTERIX
|
|||
+# undef RTLD_GLOBAL
|
|||
+# endif
|
|||
+# ifndef RTLD_GLOBAL
|
|||
+# define RTLD_GLOBAL 0
|
|||
+# endif
|
|||
#endif |
|||
|
|||
#ifdef __native_client__ |
@ -1,28 +0,0 @@ |
|||
diff -u -r ../ruby-2.1.2/ext/fiddle/fiddle.h ./ext/fiddle/fiddle.h
|
|||
--- ../ruby-2.1.2/ext/fiddle/fiddle.h 2012-11-28 01:02:49.000000000 +0100
|
|||
+++ ./ext/fiddle/fiddle.h 2014-06-27 11:22:29.967816700 +0200
|
|||
@@ -15,14 +15,16 @@
|
|||
#if defined(HAVE_DLFCN_H) |
|||
# include <dlfcn.h> |
|||
# /* some stranger systems may not define all of these */ |
|||
-#ifndef RTLD_LAZY
|
|||
-#define RTLD_LAZY 0
|
|||
-#endif
|
|||
-#ifndef RTLD_GLOBAL
|
|||
-#define RTLD_GLOBAL 0
|
|||
-#endif
|
|||
-#ifndef RTLD_NOW
|
|||
-#define RTLD_NOW 0
|
|||
+#ifndef __ANDROID__
|
|||
+# ifndef RTLD_LAZY
|
|||
+# define RTLD_LAZY 0
|
|||
+# endif
|
|||
+# ifndef RTLD_GLOBAL
|
|||
+# define RTLD_GLOBAL 0
|
|||
+# endif
|
|||
+# ifndef RTLD_NOW
|
|||
+# define RTLD_NOW 0
|
|||
+# endif
|
|||
#endif |
|||
#else |
|||
# if defined(_WIN32) |
Loading…
Reference in new issue