changeset 49257:039e63e471e1

8198859: Use elfedit to silence linker warnings on solaris Reviewed-by: tbell
author ihse
date Thu, 01 Mar 2018 18:12:50 +0100
parents b1c42b3cd19b
children 8d30b4960828
files make/autoconf/basics.m4 make/autoconf/spec.gmk.in make/hotspot/lib/CompileDtracePostJvm.gmk
diffstat 3 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/make/autoconf/basics.m4	Wed Feb 28 17:11:57 2018 -0800
+++ b/make/autoconf/basics.m4	Thu Mar 01 18:12:50 2018 +0100
@@ -1127,6 +1127,8 @@
       fi
     fi
     BASIC_REQUIRE_PROGS(SETFILE, SetFile)
+  elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
+    BASIC_REQUIRE_PROGS(ELFEDIT, elfedit)
   fi
 ])
 
--- a/make/autoconf/spec.gmk.in	Wed Feb 28 17:11:57 2018 -0800
+++ b/make/autoconf/spec.gmk.in	Thu Mar 01 18:12:50 2018 +0100
@@ -710,6 +710,7 @@
 LDD:=@LDD@
 OTOOL:=@OTOOL@
 READELF:=@READELF@
+ELFEDIT:=@ELFEDIT@
 EXPR:=@EXPR@
 FILE:=@FILE@
 DOT:=@DOT@
--- a/make/hotspot/lib/CompileDtracePostJvm.gmk	Wed Feb 28 17:11:57 2018 -0800
+++ b/make/hotspot/lib/CompileDtracePostJvm.gmk	Thu Mar 01 18:12:50 2018 +0100
@@ -157,21 +157,19 @@
 
     # Unfortunately dtrace generates incorrect types for some symbols in
     # dtrace_jhelper.o, resulting in "warning: symbol X has differing types"
-    # This is tracked in JDK-6890703.
-    $(DTRACE_JHELPER_OBJ): $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d \
-        $(JVM_OFFSETS_INDEX_H)
+    # See JDK-6890703 for details.
+    # We work around this by fixing the types for these symbols using elfedit,
+    # after dtrace has generated the .o file.
+    JHELPER_DTRACE_SRC := $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d
+    DTRACE_EXTERNAL_SYMBOLS := $(shell $(GREP) ^extern $(JHELPER_DTRACE_SRC) | $(AWK) '{ gsub(";","") ; print $$3 }')
+    DTRACE_ELFEDIT_COMMANDS := $(foreach symbol, $(DTRACE_EXTERNAL_SYMBOLS), \
+      -e 'sym:st_type $(symbol) 1')
+
+    $(DTRACE_JHELPER_OBJ): $(JHELPER_DTRACE_SRC) $(JVM_OFFSETS_INDEX_H)
 	$(call LogInfo, Running dtrace for $(<F))
 	$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) $(DTRACE_CPP_FLAGS) -C \
 	    -I$(DTRACE_SUPPORT_DIR) -o $@ -s $<)
-
-    # NOTE: We should really do something like this, but unfortunately this
-    # results in a compilation error. :-(
-    # $(call MakeDir, $(DTRACE_SUPPORT_DIR))
-    # $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, $(CC) -E \
-    #     $(DTRACE_CPP_FLAGS) -I$(DTRACE_SUPPORT_DIR) $^ \
-    #     > $(DTRACE_SUPPORT_DIR)/$(@F).d)
-    # $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \
-    #     -s $(DTRACE_SUPPORT_DIR)/$(@F).d)
+	$(call ExecuteWithLog, $@.elfedit, $(ELFEDIT) $(DTRACE_ELFEDIT_COMMANDS) $@)
 
     ############################################################################
     # Build the stand-alone dtrace libraries