Skip to content

Commit f6f1e92

Browse files
mrserbsunyuqi-syq
authored andcommitted
8314555: Build with mawk fails on Windows
8275405: Linking error for classes with lambda template parameters and virtual functions Reviewed-by: andrew Backport-of: 2704c802aa00bd92a4e9b998f62f42a1b84fcb91
1 parent b7979af commit f6f1e92

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

make/hotspot/lib/JvmMapfile.gmk

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -125,9 +125,26 @@ else ifeq ($(call isTargetOs, aix), true)
125125

126126
else ifeq ($(call isTargetOs, windows), true)
127127
DUMP_SYMBOLS_CMD := $(DUMPBIN) -symbols *.obj
128+
129+
# The following lines create a list of vftable symbols to be filtered out of
130+
# the mapfile. Removing this line causes the linker to complain about too many
131+
# (> 64K) symbols, so the _guess_ is that this line is here to keep down the
132+
# number of exported symbols below that limit.
133+
#
134+
# Some usages of C++ lambdas require the vftable symbol of classes that use
135+
# the lambda type as a template parameter. The usage of those classes won't
136+
# link if their vftable symbols are removed. That's why there's an exception
137+
# for vftable symbols containing the string 'lambda'.
138+
#
139+
# A very simple example of a lambda usage that fails if the lambda vftable
140+
# symbols are missing in the mapfile:
141+
#
142+
# #include <functional>
143+
# std::function<void()> f = [](){}
144+
128145
FILTER_SYMBOLS_AWK_SCRIPT := \
129146
'{ \
130-
if ($$7 ~ /??_7.*@@6B@/ && $$7 !~ /type_info/) print $$7; \
147+
if ($$7 ~ /\?\?_7.*@@6B@/ && $$7 !~ /type_info/ && $$7 !~ /lambda/) print $$7; \
131148
}'
132149

133150
else

0 commit comments

Comments
 (0)