diff --git a/makefile b/makefile index 36ffe6d5fc..87a1f1f5ec 100644 --- a/makefile +++ b/makefile @@ -44,6 +44,7 @@ db = gdb --args javac = javac jar = jar strip = : +strip-all = --strip-all show-size = : rdynamic = -rdynamic @@ -81,6 +82,7 @@ ifeq ($(platform),darwin) build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \ -I$(JAVA_HOME)/include/linux -I$(src) lflags = $(common-lflags) -ldl + strip-all = endif ifeq ($(platform),windows) @@ -326,9 +328,7 @@ ifeq ($(platform),windows) else $(cc) $(^) $(lflags) -o $(@) endif -ifneq ($(platform),darwin) - @$(strip) --strip-all $(@) -endif + @$(strip) $(strip-all) $(@) @$(show-size) $(@) $(generator): $(generator-objects) diff --git a/src/builtin.cpp b/src/builtin.cpp index a7d3801059..7bc74743da 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -2,12 +2,6 @@ #include "constants.h" #include "processor.h" -#ifdef __MINGW32__ -# define JNIEXPORT __declspec(dllexport) -#else -# define JNIEXPORT __attribute__ ((visibility("default"))) -#endif - using namespace vm; namespace { diff --git a/src/common.h b/src/common.h index 625cf2c076..b2fc8d6181 100644 --- a/src/common.h +++ b/src/common.h @@ -10,6 +10,17 @@ #include "types.h" #include "math.h" +#undef JNIEXPORT +#ifdef __MINGW32__ +# define JNIEXPORT __declspec(dllexport) +#else +#ifdef __APPLE__ +# define JNIEXPORT __attribute__ ((visibility("used"))) +#else +# define JNIEXPORT __attribute__ ((visibility("default"))) +#endif +#endif + #ifdef __i386__ # define LD "d" #ifdef __APPLE__ diff --git a/src/jnienv.cpp b/src/jnienv.cpp index 7793494ec3..db1cd6b0d8 100644 --- a/src/jnienv.cpp +++ b/src/jnienv.cpp @@ -4,12 +4,6 @@ #include "constants.h" #include "processor.h" -#ifdef __MINGW32__ -# define JNIEXPORT __declspec(dllexport) -#else -# define JNIEXPORT __attribute__ ((visibility("default"))) -#endif - using namespace vm; namespace {