8326406: Remove mapfile support from makefiles

Reviewed-by: jwaters, erikj
This commit is contained in:
Magnus Ihse Bursie 2024-02-27 10:54:49 +00:00
parent 16d917a85f
commit bceaed6d4d
5 changed files with 8 additions and 70 deletions

View File

@ -40,7 +40,6 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
elif test "x$TOOLCHAIN_TYPE" = xclang; then
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
@ -49,7 +48,6 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path$(or [$]1,/.)'
SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
elif test "x$OPENJDK_TARGET_OS" = xaix; then
# Linking is different on aix
@ -57,14 +55,12 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
SET_EXECUTABLE_ORIGIN=""
SET_SHARED_LIBRARY_ORIGIN=''
SET_SHARED_LIBRARY_NAME=''
SET_SHARED_LIBRARY_MAPFILE=''
else
# Default works for linux, might work on other platforms as well.
SHARED_LIBRARY_FLAGS='-shared'
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
# arm specific settings
if test "x$OPENJDK_TARGET_CPU" = "xarm"; then
@ -80,20 +76,17 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
SET_EXECUTABLE_ORIGIN=""
SET_SHARED_LIBRARY_ORIGIN=''
SET_SHARED_LIBRARY_NAME=''
SET_SHARED_LIBRARY_MAPFILE=''
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
SHARED_LIBRARY_FLAGS="-dll"
SET_EXECUTABLE_ORIGIN=''
SET_SHARED_LIBRARY_ORIGIN=''
SET_SHARED_LIBRARY_NAME=''
SET_SHARED_LIBRARY_MAPFILE='-def:[$]1'
fi
AC_SUBST(SET_EXECUTABLE_ORIGIN)
AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
AC_SUBST(SET_SHARED_LIBRARY_NAME)
AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
AC_SUBST(SHARED_LIBRARY_FLAGS)
])

View File

@ -617,10 +617,6 @@ INSTALL_NAME_TOOL := @INSTALL_NAME_TOOL@
METAL := @METAL@
METALLIB := @METALLIB@
# Options to linker to specify a mapfile.
# (Note absence of := assignment, because we do not want to evaluate the macro body here)
SET_SHARED_LIBRARY_MAPFILE = @SET_SHARED_LIBRARY_MAPFILE@
#
# Options for generating debug symbols
COMPILE_WITH_DEBUG_SYMBOLS := @COMPILE_WITH_DEBUG_SYMBOLS@

View File

@ -89,9 +89,6 @@ include native/ToolchainDefinitions.gmk
# VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
# RCFLAGS flags for RC.
# EMBED_MANIFEST if true, embed manifest on Windows.
# MAPFILE mapfile
# USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
# mapfile for the output symbols file
# CC the compiler to use, default is $(CC)
# LD the linker to use, default is $(LD)
# OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE
@ -202,8 +199,6 @@ define SetupNativeCompilationBody
$$(eval $$(call SetupLinkerFlags,$1))
ifneq ($(TOOLCHAIN_TYPE), microsoft)
$$(eval $$(call SetupLinking,$1))
else
$$(eval $$(call SetupLinkingMicrosoft,$1))
endif
$$(eval $$(call SetupObjectFileList,$1))

View File

@ -27,7 +27,6 @@
# This file contains functionality related to linking a native binary;
# creating either a dynamic library, a static library or an executable.
################################################################################
# GetEntitlementsFile
# Find entitlements file for executable when signing on macosx. If no
@ -49,14 +48,6 @@ GetEntitlementsFile = \
################################################################################
define SetupLinking
ifneq ($(DISABLE_MAPFILES), true)
$1_REAL_MAPFILE := $$($1_MAPFILE)
endif
ifneq ($$($1_REAL_MAPFILE), )
$1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE))
endif
# Unless specifically set, stripping should only happen if symbols are also
# being copied.
$$(call SetIfEmpty, $1_STRIP_SYMBOLS, $$($1_COPY_DEBUG_SYMBOLS))
@ -95,15 +86,7 @@ define CreateStaticLibrary
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
# Generating a static library, ie object file archive.
ifeq ($(STATIC_BUILD), true)
ifeq ($$($1_USE_MAPFILE_FOR_SYMBOLS), true)
STATIC_MAPFILE_DEP := $$($1_MAPFILE)
endif
endif
$1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) \
$$(STATIC_MAPFILE_DEP)
$1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_VARDEPS_FILE)
$1_AR_OBJ_ARG := $$($1_LD_OBJ_ARG)
# With clang on linux, partial linking is enabled and 'AR' takes the output
@ -136,28 +119,11 @@ define CreateStaticLibrary
$$($1_AR) $$(ARFLAGS) $$($1_ARFLAGS) -r -cs $$($1_TARGET) \
$$($1_AR_OBJ_ARG) $$($1_RES))
ifeq ($(STATIC_BUILD), true)
ifeq ($$($1_USE_MAPFILE_FOR_SYMBOLS), true)
$(CP) $$($1_MAPFILE) $$(@D)/$$(basename $$(@F)).symbols
else
# get the exported symbols from mapfiles and if there
# is no mapfile, get them from the archive
$(RM) $$(@D)/$$(basename $$(@F)).symbols; \
if [ ! -z $$($1_MAPFILE) -a -e $$($1_MAPFILE) ]; then \
$(ECHO) "Getting symbols from mapfile $$($1_MAPFILE)"; \
$(AWK) '/global:/','/local:/' $$($1_MAPFILE) | \
$(SED) -e 's/#.*//;s/global://;s/local://;s/\;//;s/^[ ]*/_/;/^_$$$$/d' | \
$(EGREP) -v "JNI_OnLoad|JNI_OnUnload|Agent_OnLoad|Agent_OnUnload|Agent_OnAttach" > \
$$(@D)/$$(basename $$(@F)).symbols || true; \
$(NM) $(NMFLAGS) $$($1_TARGET) | $(GREP) " T " | \
$(EGREP) "JNI_OnLoad|JNI_OnUnload|Agent_OnLoad|Agent_OnUnload|Agent_OnAttach" | \
$(CUT) -d ' ' -f 3 >> $$(@D)/$$(basename $$(@F)).symbols || true;\
else \
$(ECHO) "Getting symbols from nm"; \
$(NM) $(NMFLAGS) -m $$($1_TARGET) | $(GREP) "__TEXT" | \
$(EGREP) -v "non-external|private extern|__TEXT,__eh_frame" | \
$(SED) -e 's/.* //' > $$(@D)/$$(basename $$(@F)).symbols; \
fi
endif
$(RM) $$(@D)/$$(basename $$(@F)).symbols; \
$(ECHO) "Getting symbols from nm"; \
$(NM) $(NMFLAGS) -m $$($1_TARGET) | $(GREP) "__TEXT" | \
$(EGREP) -v "non-external|private extern|__TEXT,__eh_frame" | \
$(SED) -e 's/.* //' > $$(@D)/$$(basename $$(@F)).symbols
endif
endef
@ -180,7 +146,7 @@ define CreateDynamicLibraryOrExecutable
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
$1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_REAL_MAPFILE) $$($1_VARDEPS_FILE)
$1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_VARDEPS_FILE)
$$($1_TARGET): $$($1_TARGET_DEPS)
ifneq ($$($1_OBJ_FILE_LIST), )

View File

@ -27,18 +27,6 @@
# This file contains functionality related to linking a native binary;
# creating either a dynamic library, a static library or an executable.
################################################################################
define SetupLinkingMicrosoft
ifneq ($(DISABLE_MAPFILES), true)
$1_REAL_MAPFILE := $$($1_MAPFILE)
endif
ifneq ($$($1_REAL_MAPFILE), )
$1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE))
endif
endef
################################################################################
define CreateLinkedResultMicrosoft
ifeq ($$($1_TYPE), STATIC_LIBRARY)
@ -99,7 +87,7 @@ define CreateDynamicLibraryOrExecutableMicrosoft
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
$1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \
$$($1_REAL_MAPFILE) $$($1_VARDEPS_FILE)
$$($1_VARDEPS_FILE)
$$($1_TARGET): $$($1_TARGET_DEPS)
ifneq ($$($1_OBJ_FILE_LIST), )