8171408: [aix] TOC overflow when linking the gtest libjvm.so
authorstuefe
Tue, 20 Dec 2016 09:25:03 +0100
changeset 42901 3da41dfcadf8
parent 42900 ff634f19e82c
child 42902 380b1219139f
8171408: [aix] TOC overflow when linking the gtest libjvm.so Reviewed-by: dholmes, simonis, erikj
hotspot/make/lib/CompileGtest.gmk
--- a/hotspot/make/lib/CompileGtest.gmk	Sun Dec 18 10:57:49 2016 +0100
+++ b/hotspot/make/lib/CompileGtest.gmk	Tue Dec 20 09:25:03 2016 +0100
@@ -54,6 +54,13 @@
 
 # Disabling switch warning for clang because of test source.
 
+# Note: On AIX, the gtest test classes linked into the libjvm.so push the TOC
+# size beyond 64k, so we need to link with bigtoc. However, this means that
+# -qpic=large would be advisable to lessen the performance effect of bigtoc.
+# But we want to avoid imposing -qpic=large onto the regular libjvm.so, which
+# has no problem with its TOC, so do this only for object files which are
+# exclusive to the gtest libjvm.so.
+
 $(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \
     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
     LIBRARY := jvm, \
@@ -72,6 +79,7 @@
     CFLAGS_windows := -EHsc, \
     CFLAGS_solaris := -DGTEST_HAS_EXCEPTIONS=0 -library=stlport4, \
     CFLAGS_macosx := -DGTEST_OS_MAC=1, \
+    CFLAGS_aix := -qpic=large, \
     CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
     CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
     DISABLED_WARNINGS_gcc := undef, \
@@ -80,6 +88,7 @@
     DISABLED_WARNINGS_solstudio := identexpected, \
     LDFLAGS := $(JVM_LDFLAGS), \
     LDFLAGS_solaris := -library=stlport4 $(call SET_SHARED_LIBRARY_ORIGIN), \
+    LDFLAGS_aix := -bbigtoc, \
     LIBS := $(JVM_LIBS), \
     OPTIMIZATION := $(JVM_OPTIMIZATION), \
     MAPFILE := $(GTEST_JVM_MAPFILE), \