diff make/linux/makefiles/gcc.make @ 2191:d70fe6ab4436

6588413: Use -fvisibility=hidden for gcc compiles Summary: Add option for gcc 4 and above, define JNIEXPORT and JNIIMPORT to visibility=default, add for jio_snprintf and others since -fvisibility=hidden overrides --version-script definitions. Reviewed-by: kamg, never
author coleenp
date Tue, 01 Feb 2011 11:23:19 -0500
parents a5610f0862fe
children 7e88bdae86ec
line wrap: on
line diff
--- a/make/linux/makefiles/gcc.make	Thu Jan 27 16:11:27 2011 -0800
+++ b/make/linux/makefiles/gcc.make	Tue Feb 01 11:23:19 2011 -0500
@@ -75,6 +75,11 @@
 CFLAGS += -fno-exceptions
 CFLAGS += -D_REENTRANT
 CFLAGS += -fcheck-new
+# version 4 and above support fvisibility=hidden (matches jni_x86.h file)
+# except 4.1.2 gives pointless warnings that can't be disabled (afaik)
+ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
+CFLAGS += -fvisibility=hidden
+endif
 
 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
 ARCHFLAG/i486    = -m32 -march=i586