Skip to content

Commit 45414fc

Browse files
jianglizhouerikj79
andcommitted
8307858: [REDO] JDK-8307194 Add make target for optionally building a complete set of all JDK and hotspot libjvm static libraries
Co-authored-by: Erik Joelsson <erikj@openjdk.org> Reviewed-by: erikj
1 parent a6ad42e commit 45414fc

File tree

10 files changed

+190
-51
lines changed

10 files changed

+190
-51
lines changed

make/GraalBuilderImage.gmk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ $(eval $(call SetupCopyFiles, COPY_JDK_IMG, \
4343
TARGETS += $(COPY_JDK_IMG)
4444

4545
$(eval $(call SetupCopyFiles, COPY_STATIC_LIBS, \
46-
SRC := $(STATIC_LIBS_IMAGE_DIR)/lib, \
46+
SRC := $(STATIC_LIBS_GRAAL_IMAGE_DIR)/lib, \
4747
DEST := $(GRAAL_BUILDER_IMAGE_DIR)/lib, \
4848
FILES := $(filter %$(STATIC_LIBRARY_SUFFIX), \
49-
$(call FindFiles, $(STATIC_LIBS_IMAGE_DIR)/lib)), \
49+
$(call FindFiles, $(STATIC_LIBS_GRAAL_IMAGE_DIR)/lib)), \
5050
))
5151
TARGETS += $(COPY_STATIC_LIBS)
5252

make/Main.gmk

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ ALL_TARGETS += $(LAUNCHER_TARGETS)
233233
HOTSPOT_VARIANT_TARGETS := $(addprefix hotspot-, $(JVM_VARIANTS))
234234
HOTSPOT_VARIANT_GENSRC_TARGETS := $(addsuffix -gensrc, $(HOTSPOT_VARIANT_TARGETS))
235235
HOTSPOT_VARIANT_LIBS_TARGETS := $(addsuffix -libs, $(HOTSPOT_VARIANT_TARGETS))
236+
HOTSPOT_VARIANT_STATIC_LIBS_TARGETS := $(addsuffix -static-libs, $(HOTSPOT_VARIANT_TARGETS))
236237

237238
define DeclareHotspotGensrcRecipe
238239
hotspot-$1-gensrc:
@@ -251,6 +252,14 @@ endef
251252

252253
$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotLibsRecipe,$v)))
253254

255+
define DeclareHotspotStaticLibsRecipe
256+
hotspot-$1-static-libs:
257+
+($(CD) $(TOPDIR)/make/hotspot && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibraries.gmk \
258+
JVM_VARIANT=$1 STATIC_LIBS=true)
259+
endef
260+
261+
$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotStaticLibsRecipe,$v)))
262+
254263
$(eval $(call SetupTarget, hotspot-ide-project, \
255264
MAKEFILE := ide/visualstudio/hotspot/CreateVSProject, \
256265
DEPS := hotspot exploded-image, \
@@ -298,7 +307,7 @@ $(eval $(call SetupTarget, eclipse-shared-mixed-env, \
298307
))
299308

300309
ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \
301-
$(HOTSPOT_VARIANT_LIBS_TARGETS)
310+
$(HOTSPOT_VARIANT_LIBS_TARGETS) $(HOTSPOT_VARIANT_STATIC_LIBS_TARGETS)
302311

303312
################################################################################
304313
# Help and user support
@@ -462,6 +471,12 @@ $(eval $(call SetupTarget, symbols-image, \
462471

463472
$(eval $(call SetupTarget, static-libs-image, \
464473
MAKEFILE := StaticLibsImage, \
474+
TARGET := static-libs-image, \
475+
))
476+
477+
$(eval $(call SetupTarget, static-libs-graal-image, \
478+
MAKEFILE := StaticLibsImage, \
479+
TARGET := static-libs-graal-image, \
465480
))
466481

467482
$(eval $(call SetupTarget, mac-jdk-bundle, \
@@ -489,7 +504,7 @@ $(eval $(call SetupTarget, exploded-image-optimize, \
489504

490505
$(eval $(call SetupTarget, graal-builder-image, \
491506
MAKEFILE := GraalBuilderImage, \
492-
DEPS := jdk-image static-libs-image, \
507+
DEPS := jdk-image static-libs-graal-image, \
493508
))
494509

495510
ifeq ($(JCOV_ENABLED), true)
@@ -889,6 +904,7 @@ else
889904
$(foreach v, $(JVM_VARIANTS), \
890905
$(eval hotspot-$v-gensrc: java.base-copy buildtools-hotspot) \
891906
$(eval hotspot-$v-libs: hotspot-$v-gensrc java.base-copy) \
907+
$(eval hotspot-$v-static-libs: hotspot-$v-gensrc java.base-copy) \
892908
)
893909

894910
# If not already set, set the JVM variant target so that the JVM will be built.
@@ -1047,7 +1063,9 @@ else
10471063

10481064
symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS)
10491065

1050-
static-libs-image: $(STATIC_LIBS_TARGETS)
1066+
static-libs-image: hotspot-static-libs $(STATIC_LIBS_TARGETS)
1067+
1068+
static-libs-graal-image: $(STATIC_LIBS_TARGETS)
10511069

10521070
bootcycle-images: jdk-image
10531071

@@ -1097,6 +1115,7 @@ hotspot: $(HOTSPOT_VARIANT_TARGETS)
10971115
$(foreach v, $(JVM_VARIANTS), \
10981116
$(eval hotspot-libs: hotspot-$v-libs) \
10991117
$(eval hotspot-gensrc: hotspot-$v-gensrc) \
1118+
$(eval hotspot-static-libs: hotspot-$v-static-libs) \
11001119
)
11011120

11021121
gensrc: $(GENSRC_TARGETS)
@@ -1259,7 +1278,8 @@ all-images: product-images test-image all-docs-images
12591278
# all-bundles packages all our deliverables as tar.gz bundles.
12601279
all-bundles: product-bundles test-bundles docs-bundles static-libs-bundles
12611280

1262-
ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-gensrc gensrc gendata \
1281+
ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-static-libs \
1282+
hotspot-gensrc gensrc gendata \
12631283
copy java libs static-libs launchers jmods \
12641284
jdk.jdwp.agent-gensrc $(ALL_MODULES) demos \
12651285
exploded-image-base exploded-image runnable-buildjdk \

make/StaticLibsImage.gmk

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2019, 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
@@ -38,19 +38,43 @@ ALL_MODULES = $(call FindAllModules)
3838

3939
TARGETS :=
4040

41+
ifneq ($(filter static-libs-image, $(MAKECMDGOALS)), )
42+
IMAGE_DEST_DIR=$(STATIC_LIBS_IMAGE_DIR)/lib
43+
else ifneq ($(filter static-libs-graal-image, $(MAKECMDGOALS)), )
44+
IMAGE_DEST_DIR=$(STATIC_LIBS_GRAAL_IMAGE_DIR)/lib
45+
endif
46+
47+
# Copy JDK static libs to the image.
4148
$(foreach m, $(ALL_MODULES), \
4249
$(eval $(call SetupCopyFiles, COPY_STATIC_LIBS_$m, \
4350
FLATTEN := true, \
4451
SRC := $(SUPPORT_OUTPUTDIR)/native/$m, \
45-
DEST := $(STATIC_LIBS_IMAGE_DIR)/lib, \
52+
DEST := $(IMAGE_DEST_DIR), \
4653
FILES := $(filter %$(STATIC_LIBRARY_SUFFIX), \
4754
$(call FindFiles, $(SUPPORT_OUTPUTDIR)/native/$m/*/static)), \
4855
)) \
4956
$(eval TARGETS += $$(COPY_STATIC_LIBS_$m)) \
57+
$(eval STATIC_LIBS_TARGETS += $$(COPY_STATIC_LIBS_$m)) \
5058
)
5159

60+
ifneq ($(filter static-libs-image, $(MAKECMDGOALS)), )
61+
# Copy libjvm static library to the image.
62+
$(foreach v, $(JVM_VARIANTS), \
63+
$(eval $(call SetupCopyFiles, COPY_STATIC_LIBS_$v, \
64+
SRC := $(HOTSPOT_OUTPUTDIR)/variant-$v/libjvm/objs/static, \
65+
DEST := $(IMAGE_DEST_DIR)/$v, \
66+
FILES := $(wildcard $(HOTSPOT_OUTPUTDIR)/variant-$v/libjvm/objs/static/*$(STATIC_LIBRARY_SUFFIX)), \
67+
)) \
68+
$(eval TARGETS += $$(COPY_STATIC_LIBS_$v)) \
69+
$(eval HOTSPOT_VARIANT_STATIC_LIBS_TARGETS += $$(COPY_STATIC_LIBS_$v)) \
70+
)
71+
endif
72+
5273
################################################################################
5374

75+
static-libs-image: $(HOTSPOT_VARIANT_STATIC_LIBS_TARGETS) $(STATIC_LIBS_TARGETS)
76+
static-libs-graal-image: $(STATIC_LIBS_TARGETS)
77+
5478
all: $(TARGETS)
5579

5680
.PHONY: all

make/autoconf/flags-ldflags.m4

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,14 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
7272
7373
BASIC_LDFLAGS_JVM_ONLY=""
7474
75+
LDFLAGS_CXX_PARTIAL_LINKING="$MACHINE_FLAG -r"
76+
7577
elif test "x$TOOLCHAIN_TYPE" = xclang; then
7678
BASIC_LDFLAGS_JVM_ONLY="-mno-omit-leaf-frame-pointer -mstack-alignment=16 \
7779
-fPIC"
80+
81+
LDFLAGS_CXX_PARTIAL_LINKING="$MACHINE_FLAG -r"
82+
7883
if test "x$OPENJDK_TARGET_OS" = xaix; then
7984
BASIC_LDFLAGS="-Wl,-b64 -Wl,-brtl -Wl,-bnorwexec -Wl,-bnolibpath -Wl,-bnoexpall \
8085
-Wl,-bernotok -Wl,-bdatapsize:64k -Wl,-btextpsize:64k -Wl,-bstackpsize:64k"
@@ -161,6 +166,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
161166
# Export some intermediate variables for compatibility
162167
LDFLAGS_CXX_JDK="$BASIC_LDFLAGS_ONLYCXX $BASIC_LDFLAGS_ONLYCXX_JDK_ONLY $DEBUGLEVEL_LDFLAGS_JDK_ONLY"
163168
AC_SUBST(LDFLAGS_CXX_JDK)
169+
AC_SUBST(LDFLAGS_CXX_PARTIAL_LINKING)
164170
])
165171

166172
################################################################################

make/autoconf/flags.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
301301
EXTRA_LDFLAGS="$MACHINE_FLAG $USER_LDFLAGS"
302302
EXTRA_ASFLAGS="$USER_ASFLAGS"
303303
304+
AC_SUBST(MACHINE_FLAG)
304305
AC_SUBST(EXTRA_CFLAGS)
305306
AC_SUBST(EXTRA_CXXFLAGS)
306307
AC_SUBST(EXTRA_LDFLAGS)

make/autoconf/spec.gmk.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,8 @@ JVM_LIBS := @JVM_LIBS@
546546

547547
BASIC_ASFLAGS := @BASIC_ASFLAGS@
548548

549+
MACHINE_FLAG := @MACHINE_FLAG@
550+
549551
# These flags might contain variables set by a custom extension that is included later.
550552
EXTRA_CFLAGS = @EXTRA_CFLAGS@
551553
EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@
@@ -572,6 +574,9 @@ JDKEXE_LIBS:=@JDKEXE_LIBS@
572574
# LDFLAGS specific to C++ linking.
573575
LDFLAGS_CXX_JDK:=@LDFLAGS_CXX_JDK@
574576

577+
# LDFLAGS specific to partial linking.
578+
LDFLAGS_CXX_PARTIAL_LINKING:=@LDFLAGS_CXX_PARTIAL_LINKING@
579+
575580
# Sometimes a different linker is needed for c++ libs
576581
LDCXX := @LDCXX@
577582
# The flags for linking libstdc++ linker.
@@ -928,6 +933,10 @@ DOCS_OUTPUTDIR := $(DOCS_JDK_IMAGE_DIR)
928933
STATIC_LIBS_IMAGE_SUBDIR := static-libs
929934
STATIC_LIBS_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(STATIC_LIBS_IMAGE_SUBDIR)
930935

936+
# Graal static libs image
937+
STATIC_LIBS_GRAAL_IMAGE_SUBDIR := static-libs-graal
938+
STATIC_LIBS_GRAAL_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(STATIC_LIBS_GRAAL_IMAGE_SUBDIR)
939+
931940
# Graal builder image
932941
GRAAL_BUILDER_IMAGE_SUBDIR := graal-builder-jdk
933942
GRAAL_BUILDER_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(GRAAL_BUILDER_IMAGE_SUBDIR)

make/common/NativeCompilation.gmk

Lines changed: 84 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 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
@@ -548,6 +548,7 @@ endef
548548
# PRECOMPILED_HEADER Header file to use as precompiled header
549549
# PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
550550
# BUILD_INFO_LOG_MACRO Overrides log level of the build info log message, default LogWarn
551+
# STATIC_LIB_EXCLUDE_OBJS exclude objects that matches from static library
551552
#
552553
# After being called, some variables are exported from this macro, all prefixed
553554
# with parameter 1 followed by a '_':
@@ -726,6 +727,12 @@ define SetupNativeCompilationBody
726727
endif
727728
# Sort to remove duplicates and provide a reproducible order on the input files to the linker.
728729
$1_ALL_OBJS := $$(sort $$($1_EXPECTED_OBJS) $$($1_EXTRA_OBJECT_FILES))
730+
ifeq ($(STATIC_LIBS), true)
731+
# Exclude the object files that match with $1_STATIC_LIB_EXCLUDE_OBJS.
732+
ifneq ($$($1_STATIC_LIB_EXCLUDE_OBJS), )
733+
$1_ALL_OBJS := $$(call not-containing, $$($1_STATIC_LIB_EXCLUDE_OBJS), $$($1_ALL_OBJS))
734+
endif
735+
endif
729736

730737
# Pickup extra OPENJDK_TARGET_OS_TYPE, OPENJDK_TARGET_OS, TOOLCHAIN_TYPE and
731738
# OPENJDK_TARGET_OS plus OPENJDK_TARGET_CPU pair dependent variables for CFLAGS.
@@ -1130,9 +1137,60 @@ define SetupNativeCompilationBody
11301137
endif
11311138
endif
11321139

1140+
$1_LD_OBJ_ARG := $$($1_ALL_OBJS)
1141+
1142+
# If there are many object files, use an @-file...
1143+
ifneq ($$(word 17, $$($1_ALL_OBJS)), )
1144+
$1_OBJ_FILE_LIST := $$($1_OBJECT_DIR)/_$1_objectfilenames.txt
1145+
ifneq ($(COMPILER_COMMAND_FILE_FLAG), )
1146+
$1_LD_OBJ_ARG := $(COMPILER_COMMAND_FILE_FLAG)$$($1_OBJ_FILE_LIST)
1147+
else
1148+
# ...except for toolchains which don't support them.
1149+
$1_LD_OBJ_ARG := `cat $$($1_OBJ_FILE_LIST)`
1150+
endif
1151+
1152+
# If we are building static library, 'AR' on macosx may not support @-file.
1153+
ifeq ($$($1_TYPE), STATIC_LIBRARY)
1154+
ifeq ($(call isTargetOs, macosx), true)
1155+
$1_LD_OBJ_ARG := `cat $$($1_OBJ_FILE_LIST)`
1156+
endif
1157+
endif
1158+
endif
1159+
1160+
# Unfortunately the @-file trick does not work reliably when using clang.
1161+
# Clang does not propagate the @-file parameter to the ld sub process, but
1162+
# instead puts the full content on the command line. At least the llvm ld
1163+
# does not even support an @-file.
1164+
#
1165+
# When linking a large amount of object files, we risk hitting the limit
1166+
# of the command line length even on posix systems if the path length of
1167+
# the output dir is very long due to our use of absolute paths. To
1168+
# mitigate this, use paths relative to the output dir when linking over
1169+
# 500 files with clang and the output dir path is deep.
1170+
ifneq ($$(word 500, $$($1_ALL_OBJS)), )
1171+
ifeq ($$(TOOLCHAIN_TYPE), clang)
1172+
# There is no strlen function in make, but checking path depth is a
1173+
# reasonable approximation.
1174+
ifneq ($$(word 10, $$(subst /, ,$$(OUTPUTDIR))), )
1175+
$1_LINK_OBJS_RELATIVE := true
1176+
$1_ALL_OBJS_RELATIVE := $$(patsubst $$(OUTPUTDIR)/%, %, $$($1_ALL_OBJS))
1177+
endif
1178+
endif
1179+
endif
1180+
11331181
ifeq ($$($1_TYPE), STATIC_LIBRARY)
1182+
# Include partial linking when building the static library with clang on linux.
1183+
ifeq ($(call isTargetOs, linux), true)
1184+
ifneq ($(findstring $(TOOLCHAIN_TYPE), clang), )
1185+
$1_ENABLE_PARTIAL_LINKING := true
1186+
endif
1187+
endif
1188+
11341189
$1_VARDEPS := $$($1_AR) $$(ARFLAGS) $$($1_ARFLAGS) $$($1_LIBS) \
11351190
$$($1_EXTRA_LIBS)
1191+
ifeq ($$($1_ENABLE_PARTIAL_LINKING), true)
1192+
$1_VARDEPS += $$($1_LD) $$($1_SYSROOT_LDFLAGS)
1193+
endif
11361194
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
11371195
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
11381196

@@ -1145,11 +1203,35 @@ define SetupNativeCompilationBody
11451203

11461204
$1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) $$(STATIC_MAPFILE_DEP)
11471205

1206+
$1_AR_OBJ_ARG := $$($1_LD_OBJ_ARG)
1207+
# With clang on linux, partial linking is enabled and 'AR' takes the output
1208+
# object from the partial linking step.
1209+
ifeq ($$($1_ENABLE_PARTIAL_LINKING), true)
1210+
$1_TARGET_RELOCATABLE := $$($1_OBJECT_DIR)/$$($1_PREFIX)$$($1_NAME)_relocatable$(OBJ_SUFFIX)
1211+
$1_AR_OBJ_ARG := $$($1_TARGET_RELOCATABLE)
1212+
endif
1213+
11481214
$$($1_TARGET): $$($1_TARGET_DEPS)
1215+
ifneq ($$($1_OBJ_FILE_LIST), )
1216+
ifeq ($$($1_LINK_OBJS_RELATIVE), true)
1217+
$$(eval $$(call ListPathsSafely, $1_ALL_OBJS_RELATIVE, $$($1_OBJ_FILE_LIST)))
1218+
else
1219+
$$(eval $$(call ListPathsSafely, $1_ALL_OBJS, $$($1_OBJ_FILE_LIST)))
1220+
endif
1221+
endif
11491222
$$(call LogInfo, Building static library $$($1_BASENAME))
11501223
$$(call MakeDir, $$($1_OUTPUT_DIR) $$($1_SYMBOLS_DIR))
1224+
# Do partial linking.
1225+
ifeq ($$($1_ENABLE_PARTIAL_LINKING), true)
1226+
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_partial_link, \
1227+
$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \
1228+
$$($1_LD) $(LDFLAGS_CXX_PARTIAL_LINKING) $$($1_SYSROOT_LDFLAGS) \
1229+
$(LD_OUT_OPTION)$$($1_TARGET_RELOCATABLE) \
1230+
$$($1_LD_OBJ_ARG))
1231+
endif
11511232
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
1152-
$$($1_AR) $$(ARFLAGS) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_ALL_OBJS) \
1233+
$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \
1234+
$$($1_AR) $$(ARFLAGS) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_AR_OBJ_ARG) \
11531235
$$($1_RES))
11541236
ifeq ($(STATIC_BUILD), true)
11551237
ifeq ($$($1_USE_MAPFILE_FOR_SYMBOLS), true)
@@ -1201,40 +1283,6 @@ define SetupNativeCompilationBody
12011283
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
12021284
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
12031285

1204-
$1_LD_OBJ_ARG := $$($1_ALL_OBJS)
1205-
1206-
# If there are many object files, use an @-file...
1207-
ifneq ($$(word 17, $$($1_ALL_OBJS)), )
1208-
$1_OBJ_FILE_LIST := $$($1_OBJECT_DIR)/_$1_objectfilenames.txt
1209-
ifneq ($(COMPILER_COMMAND_FILE_FLAG), )
1210-
$1_LD_OBJ_ARG := $(COMPILER_COMMAND_FILE_FLAG)$$($1_OBJ_FILE_LIST)
1211-
else
1212-
# ...except for toolchains which don't support them.
1213-
$1_LD_OBJ_ARG := `cat $$($1_OBJ_FILE_LIST)`
1214-
endif
1215-
endif
1216-
1217-
# Unfortunately the @-file trick does not work reliably when using clang.
1218-
# Clang does not propagate the @-file parameter to the ld sub process, but
1219-
# instead puts the full content on the command line. At least the llvm ld
1220-
# does not even support an @-file.
1221-
#
1222-
# When linking a large amount of object files, we risk hitting the limit
1223-
# of the command line length even on posix systems if the path length of
1224-
# the output dir is very long due to our use of absolute paths. To
1225-
# mitigate this, use paths relative to the output dir when linking over
1226-
# 500 files with clang and the output dir path is deep.
1227-
ifneq ($$(word 500, $$($1_ALL_OBJS)), )
1228-
ifeq ($$(TOOLCHAIN_TYPE), clang)
1229-
# There is no strlen function in make, but checking path depth is a
1230-
# reasonable approximation.
1231-
ifneq ($$(word 10, $$(subst /, ,$$(OUTPUTDIR))), )
1232-
$1_LINK_OBJS_RELATIVE := true
1233-
$1_ALL_OBJS_RELATIVE := $$(patsubst $$(OUTPUTDIR)/%, %, $$($1_ALL_OBJS))
1234-
endif
1235-
endif
1236-
endif
1237-
12381286
$1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \
12391287
$$($1_REAL_MAPFILE) $$($1_VARDEPS_FILE)
12401288

0 commit comments

Comments
 (0)