From 2704c802aa00bd92a4e9b998f62f42a1b84fcb91 Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Mon, 9 Mar 2026 14:03:50 +0000 Subject: [PATCH] 8314555: Build with mawk fails on Windows 8275405: Linking error for classes with lambda template parameters and virtual functions Reviewed-by: mbaesken Backport-of: 3285a1efc8d3372338b87f70e28fa2158bac629d --- make/hotspot/lib/JvmMapfile.gmk | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/make/hotspot/lib/JvmMapfile.gmk b/make/hotspot/lib/JvmMapfile.gmk index 5cba93178c74..8705e6e16bec 100644 --- a/make/hotspot/lib/JvmMapfile.gmk +++ b/make/hotspot/lib/JvmMapfile.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -99,9 +99,26 @@ else ifeq ($(call isTargetOs, aix), true) else ifeq ($(call isTargetOs, windows), true) DUMP_SYMBOLS_CMD := $(DUMPBIN) -symbols *.obj + + # The following lines create a list of vftable symbols to be filtered out of + # the mapfile. Removing this line causes the linker to complain about too many + # (> 64K) symbols, so the _guess_ is that this line is here to keep down the + # number of exported symbols below that limit. + # + # Some usages of C++ lambdas require the vftable symbol of classes that use + # the lambda type as a template parameter. The usage of those classes won't + # link if their vftable symbols are removed. That's why there's an exception + # for vftable symbols containing the string 'lambda'. + # + # A very simple example of a lambda usage that fails if the lambda vftable + # symbols are missing in the mapfile: + # + # #include + # std::function f = [](){} + FILTER_SYMBOLS_AWK_SCRIPT := \ '{ \ - if ($$7 ~ /??_7.*@@6B@/ && $$7 !~ /type_info/) print $$7; \ + if ($$7 ~ /\?\?_7.*@@6B@/ && $$7 !~ /type_info/ && $$7 !~ /lambda/) print $$7; \ }' else