Skip to content

Commit

Permalink
java/openjdk17: fix build with lld 17
Browse files Browse the repository at this point in the history
Building java/openjdk17 with lld 17 results in the following link errors:

  ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ21WB_HandshakeWalkStackE16TraceSelfClosure' failed: symbol not defined
  ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ26WB_AsyncHandshakeWalkStackE16TraceSelfClosure' failed: symbol not defined
  ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN12JvmtiEnvBase27check_for_periodic_clean_upEvE28ThreadInsideIterationClosure' failed: symbol not defined
  ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN15G1RemSetSummary6updateEvE11CollectData' failed: symbol not defined
  ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16SATBMarkQueueSet22set_active_all_threadsEbbE22SetThreadActiveClosure' failed: symbol not defined
  ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16SATBMarkQueueSet23abandon_partial_markingEvE25AbandonThreadQueueClosure' failed: symbol not defined
  ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN18G1ConcurrentRefine30get_and_reset_refinement_statsEvE12CollectStats' failed: symbol not defined
  ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN19G1DirtyCardQueueSet12abandon_logsEvE23AbandonThreadLogClosure' failed: symbol not defined
  ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN19G1DirtyCardQueueSet16concatenate_logsEvE27ConcatenateThreadLogClosure' failed: symbol not defined
  ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN19G1DirtyCardQueueSet30get_and_reset_refinement_statsEvE12CollectStats' failed: symbol not defined
  ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN7Threads25change_thread_claim_tokenEvE11ResetClaims' failed: symbol not defined
  c++: error: linker command failed with exit code 1 (use -v to see invocation)

This is because lld 17 defaults to errors when undefined symbols are
referenced in linker version scripts. The problem is due to the Makefile
JvmMapfile.gmk, which generates a linker version script. It uses "nm
--defined-only" to dump symbols in object files, but this also includes
local (hidden) symbols. Add "--extern-only" to make it only dump global
symbols.

PR:		274109
Approved by:	maintainer timeout (10 days)
MFH:		2023Q4
  • Loading branch information
DimitryAndric committed Oct 6, 2023
1 parent 623262a commit 2bd641c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions java/openjdk17/files/patch-make_hotspot_lib_JvmMapfile.gmk
@@ -0,0 +1,20 @@
--- make/hotspot/lib/JvmMapfile.gmk.orig 2023-07-19 03:18:33 UTC
+++ make/hotspot/lib/JvmMapfile.gmk
@@ -53,7 +53,7 @@ ifeq ($(call isTargetOs, linux), true)
# platform dependent.

ifeq ($(call isTargetOs, linux), true)
- DUMP_SYMBOLS_CMD := $(NM) --defined-only *.o
+ DUMP_SYMBOLS_CMD := $(NM) --extern-only --defined-only *.o
ifneq ($(FILTER_SYMBOLS_PATTERN), )
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|
endif
@@ -117,7 +117,7 @@ else ifeq ($(call isTargetOs, bsd), true)
if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \
}'
else
- DUMP_SYMBOLS_CMD := $(NM) --defined-only *.o
+ DUMP_SYMBOLS_CMD := $(NM) --extern-only --defined-only *.o
FILTER_SYMBOLS_AWK_SCRIPT := \
'{ \
if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \

0 comments on commit 2bd641c

Please sign in to comment.