Skip to content

Commit 1232677

Browse files
ansteinerMBaesken
authored andcommittedAug 11, 2023
8313244: NM flags handling in configure process
Reviewed-by: clanger, jwaters, mbaesken, erikj
1 parent 6ffc032 commit 1232677

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed
 

‎make/autoconf/flags-other.m4

+10
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ AC_DEFUN([FLAGS_SETUP_RCFLAGS],
8888
AC_SUBST(RCFLAGS)
8989
])
9090

91+
AC_DEFUN([FLAGS_SETUP_NMFLAGS],
92+
[
93+
# On AIX, we need to set NM flag -X64 for processing 64bit object files
94+
if test "x$OPENJDK_TARGET_OS" = xaix; then
95+
NMFLAGS="-X64"
96+
fi
97+
98+
AC_SUBST(NMFLAGS)
99+
])
100+
91101
################################################################################
92102
# platform independent
93103
AC_DEFUN([FLAGS_SETUP_ASFLAGS],

‎make/autoconf/flags.m4

+1
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ AC_DEFUN([FLAGS_SETUP_FLAGS],
429429
FLAGS_SETUP_ARFLAGS
430430
FLAGS_SETUP_STRIPFLAGS
431431
FLAGS_SETUP_RCFLAGS
432+
FLAGS_SETUP_NMFLAGS
432433
433434
FLAGS_SETUP_ASFLAGS
434435
FLAGS_SETUP_ASFLAGS_CPU_DEP([TARGET])

‎make/autoconf/spec.gmk.in

+1
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ AR := @AR@
606606
ARFLAGS:=@ARFLAGS@
607607

608608
NM:=@NM@
609+
NMFLAGS:=@NMFLAGS@
609610
STRIP:=@STRIP@
610611
OBJDUMP:=@OBJDUMP@
611612
CXXFILT:=@CXXFILT@

‎make/common/NativeCompilation.gmk

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ define GetSymbols
4848
$(SED) -e 's/#.*//;s/global://;s/local://;s/\;//;s/^[ ]*/_/;/^_$$$$/d' | \
4949
$(EGREP) -v "JNI_OnLoad|JNI_OnUnload|Agent_OnLoad|Agent_OnUnload|Agent_OnAttach" > \
5050
$$(@D)/$$(basename $$(@F)).symbols || true; \
51-
$(NM) $$($1_TARGET) | $(GREP) " T " | \
51+
$(NM) $(NMFLAGS) $$($1_TARGET) | $(GREP) " T " | \
5252
$(EGREP) "JNI_OnLoad|JNI_OnUnload|Agent_OnLoad|Agent_OnUnload|Agent_OnAttach" | \
5353
$(CUT) -d ' ' -f 3 >> $$(@D)/$$(basename $$(@F)).symbols || true;\
5454
else \
5555
$(ECHO) "Getting symbols from nm"; \
56-
$(NM) -m $$($1_TARGET) | $(GREP) "__TEXT" | \
56+
$(NM) $(NMFLAGS) -m $$($1_TARGET) | $(GREP) "__TEXT" | \
5757
$(EGREP) -v "non-external|private extern|__TEXT,__eh_frame" | \
5858
$(SED) -e 's/.* //' > $$(@D)/$$(basename $$(@F)).symbols; \
5959
fi

‎make/hotspot/lib/CompileJvm.gmk

+2-8
Original file line numberDiff line numberDiff line change
@@ -281,19 +281,13 @@ ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
281281
#
282282
UNDEF_PATTERN := ' U '
283283

284-
# 'nm' on AIX needs -X64 option
285-
286-
ifeq ($(call isTargetOs, aix), true)
287-
NM := $(NM) -X64
288-
endif
289-
290284
define SetupOperatorNewDeleteCheck
291285
$1.op_check: $1
292286
$$(call ExecuteWithLog, $1.op_check, \
293-
$$(NM) $$< 2>&1 | $$(GREP) $$(addprefix -e , $$(MANGLED_SYMS)) | $$(GREP) $$(UNDEF_PATTERN) > $1.op_check || true)
287+
$$(NM) $$(NMFLAGS) $$< 2>&1 | $$(GREP) $$(addprefix -e , $$(MANGLED_SYMS)) | $$(GREP) $$(UNDEF_PATTERN) > $1.op_check || true)
294288
if [ -s $1.op_check ]; then \
295289
$$(ECHO) "$$(notdir $$<): Error: Use of global operators new and delete is not allowed in Hotspot:"; \
296-
$$(NM) $$< | $$(CXXFILT) | $$(EGREP) '$$(DEMANGLED_REGEXP)' | $$(GREP) $$(UNDEF_PATTERN); \
290+
$$(NM) $$(NMFLAGS) $$< | $$(CXXFILT) | $$(EGREP) '$$(DEMANGLED_REGEXP)' | $$(GREP) $$(UNDEF_PATTERN); \
297291
$$(ECHO) "See: $$(TOPDIR)/make/hotspot/lib/CompileJvm.gmk"; \
298292
exit 1; \
299293
fi

‎make/hotspot/lib/JvmMapfile.gmk

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ endif
5353
# platform dependent.
5454

5555
ifeq ($(call isTargetOs, linux), true)
56-
DUMP_SYMBOLS_CMD := $(NM) --defined-only *$(OBJ_SUFFIX)
56+
DUMP_SYMBOLS_CMD := $(NM) $(NMFLAGS) --defined-only *$(OBJ_SUFFIX)
5757
ifneq ($(FILTER_SYMBOLS_PATTERN), )
5858
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|
5959
endif
@@ -67,7 +67,7 @@ ifeq ($(call isTargetOs, linux), true)
6767
else ifeq ($(call isTargetOs, macosx), true)
6868
# nm on macosx prints out "warning: nm: no name list" to stderr for
6969
# files without symbols. Hide this, even at the expense of hiding real errors.
70-
DUMP_SYMBOLS_CMD := $(NM) -Uj *$(OBJ_SUFFIX) 2> /dev/null
70+
DUMP_SYMBOLS_CMD := $(NM) $(NMFLAGS) -Uj *$(OBJ_SUFFIX) 2> /dev/null
7171
ifneq ($(FILTER_SYMBOLS_PATTERN), )
7272
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|
7373
endif
@@ -89,7 +89,7 @@ else ifeq ($(call isTargetOs, aix), true)
8989
# which may be installed under /opt/freeware/bin. So better use an absolute path here!
9090
# NM=/usr/bin/nm
9191

92-
DUMP_SYMBOLS_CMD := $(NM) -X64 -B -C *$(OBJ_SUFFIX)
92+
DUMP_SYMBOLS_CMD := $(NM) $(NMFLAGS) -B -C *$(OBJ_SUFFIX)
9393
FILTER_SYMBOLS_AWK_SCRIPT := \
9494
'{ \
9595
if (($$2="d" || $$2="D") && ($$3 ~ /^__vft/ || $$3 ~ /^gHotSpotVM/)) print $$3; \

3 commit comments

Comments
 (3)

openjdk-notifier[bot] commented on Aug 11, 2023

@openjdk-notifier[bot]

ansteiner commented on Sep 13, 2023

@ansteiner
ContributorAuthor

/backport jdk21u

openjdk[bot] commented on Sep 13, 2023

@openjdk[bot]

@ansteiner the backport was successfully created on the branch ansteiner-backport-12326770 in my personal fork of openjdk/jdk21u. To create a pull request with this backport targeting openjdk/jdk21u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 12326770 from the openjdk/jdk repository.

The commit being backported was authored by Andreas Steiner on 11 Aug 2023 and was reviewed by Christoph Langer, Julian Waters, Matthias Baesken and Erik Joelsson.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u:

$ git fetch https://github.com/openjdk-bots/jdk21u.git ansteiner-backport-12326770:ansteiner-backport-12326770
$ git checkout ansteiner-backport-12326770
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u.git ansteiner-backport-12326770
Please sign in to comment.