Use elfedit to silence linker warnings on solaris ihse-cflags-rewrite-branch
authorihse
Thu, 01 Mar 2018 11:02:40 +0100
branchihse-cflags-rewrite-branch
changeset 56215 1c5a3127046f
parent 56214 0544ba555e67
child 56216 d8ea550b907a
Use elfedit to silence linker warnings on solaris
make/autoconf/basics.m4
make/autoconf/spec.gmk.in
make/hotspot/lib/CompileDtracePostJvm.gmk
--- a/make/autoconf/basics.m4	Thu Mar 01 01:35:46 2018 +0100
+++ b/make/autoconf/basics.m4	Thu Mar 01 11:02:40 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	Thu Mar 01 01:35:46 2018 +0100
+++ b/make/autoconf/spec.gmk.in	Thu Mar 01 11:02:40 2018 +0100
@@ -709,6 +709,7 @@
 LDD:=@LDD@
 OTOOL:=@OTOOL@
 READELF:=@READELF@
+ELFEDIT:=@ELFEDIT@
 EXPR:=@EXPR@
 FILE:=@FILE@
 DOT:=@DOT@
--- a/make/hotspot/lib/CompileDtracePostJvm.gmk	Thu Mar 01 01:35:46 2018 +0100
+++ b/make/hotspot/lib/CompileDtracePostJvm.gmk	Thu Mar 01 11:02:40 2018 +0100
@@ -140,12 +140,17 @@
 
     # 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.
+    # 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')
     #
     # Make sure we run our selected compiler for preprocessing instead of letting
     # the dtrace tool pick it on it's own.
-    $(DTRACE_JHELPER_OBJ): $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d \
-        $(JVM_OFFSETS_INDEX_H)
+    $(DTRACE_JHELPER_OBJ): $(JHELPER_DTRACE_SRC) $(JVM_OFFSETS_INDEX_H)
 	$(call LogInfo, Running dtrace for $(<F))
 	$(call MakeDir, $(DTRACE_SUPPORT_DIR))
 	$(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, $(CPP) \
@@ -153,6 +158,7 @@
 	    > $(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