add __attribute__ ((used)) to EXPORT macro definition

This ensures that exported functions are not stripped when using the
-dead_strip option to the Apple linker.
This commit is contained in:
Joel Dice 2011-09-22 16:55:45 -06:00
parent 70c65c7053
commit 21d1a6c883
8 changed files with 19 additions and 8 deletions

View File

@ -561,7 +561,7 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jstring name,
r = e->NewStringUTF("Linux");
#endif
} else if (strcmp(chars, "os.version") == 0) {
#if (defined __APPLE__) && (! defined ARCH_arm)
#if (defined __APPLE__) && (! defined AVIAN_IOS)
unsigned size = 32;
char buffer[size];
#ifdef ARCH_x86_64

View File

@ -24,7 +24,8 @@
#else // not (defined __MINGW32__) || (defined _MSC_VER)
# define PLATFORM_POSIX
# define PATH_SEPARATOR ':'
# define JNIEXPORT __attribute__ ((visibility("default")))
# define JNIEXPORT __attribute__ ((visibility("default"))) \
__attribute__ ((used))
#endif // not (defined __MINGW32__) || (defined _MSC_VER)
#ifdef _MSC_VER

View File

@ -243,7 +243,9 @@ endif
ifeq ($(arch),arm)
asm = arm
pointer-size = 4
ifneq ($(build-platform),darwin)
ifeq ($(build-platform),darwin)
ios = true
else
cflags += -marm -Wno-psabi
endif
@ -265,6 +267,9 @@ ifeq ($(arch),arm)
endif
endif
ifeq ($(ios),true)
cflags += -DAVIAN_IOS
endif
ifeq ($(platform),linux)
bootimage-cflags += -DTARGET_PLATFORM_LINUX

View File

@ -371,7 +371,8 @@ setting the boot classpath to "[bootJar]".
#if (defined __MINGW32__) || (defined _MSC_VER)
# define EXPORT __declspec(dllexport)
#else
# define EXPORT __attribute__ ((visibility("default")))
# define EXPORT __attribute__ ((visibility("default"))) \
__attribute__ ((used))
#endif
#if (! defined __x86_64__) && ((defined __MINGW32__) || (defined _MSC_VER))

View File

@ -22,7 +22,8 @@ typedef unsigned char uint8_t;
# define EXPORT __declspec(dllexport)
# define SYMBOL(x) binary_javahome_jar_##x
#else
# define EXPORT __attribute__ ((visibility("default")))
# define EXPORT __attribute__ ((visibility("default"))) \
__attribute__ ((used))
# define SYMBOL(x) _binary_javahome_jar_##x
#endif

View File

@ -27,7 +27,8 @@ extern "C" void __cxa_pure_virtual(void) { abort(); }
#if (defined __MINGW32__) || (defined _MSC_VER)
# define EXPORT __declspec(dllexport)
#else
# define EXPORT __attribute__ ((visibility("default")))
# define EXPORT __attribute__ ((visibility("default"))) \
__attribute__ ((used))
#endif
#ifdef BOOT_IMAGE

View File

@ -113,7 +113,8 @@ typedef intptr_t __attribute__((__may_alias__)) intptr_alias_t;
# define JNIEXPORT __declspec(dllexport)
# define PATH_SEPARATOR ';'
#else // not PLATFORM_WINDOWS
# define JNIEXPORT __attribute__ ((visibility("default")))
# define JNIEXPORT __attribute__ ((visibility("default"))) \
__attribute__ ((used))
# define PATH_SEPARATOR ':'
#endif // not PLATFORM_WINDOWS

View File

@ -17,7 +17,8 @@
# define JNIEXPORT __declspec(dllexport)
# define JNICALL __stdcall
#else // not (defined __MINGW32__) || (defined _MSC_VER)
# define JNIEXPORT __attribute__ ((visibility("default")))
# define JNIEXPORT __attribute__ ((visibility("default"))) \
__attribute__ ((used))
# define JNICALL
#endif // not (defined __MINGW32__) || (defined _MSC_VER)