Skip to content

Commit dc0a6e5

Browse files
committed
Use -force_load, rather than -all_load, on ld64 (macOS)
We have been using ld64's `-all_load` as the mac equivalent to `--whole-archive`, but `-force_load` does something closer to what we want. From the ld64 man page: ``` -all_load Loads all members of static archive libraries. -force_load path_to_archive Loads all members of the specified static archive library. Note: -all_load forces all members of all archives to be loaded. This option allows you to target a specific archive. ``` When we link `libjulia-internal.dylib` and `libjulia-codegen.dylib` with `-all_load`, we pull in more of the static LLVM support libraries than we need. Before: ``` 5.1M usr/lib/libjulia-internal.1.14.0.dylib 2.1M usr/lib/libjulia-codegen.1.14.0.dylib ``` After: ``` 3.8M usr/lib/libjulia-internal.1.14.0.dylib 2.1M usr/lib/libjulia-codegen.1.14.0.dylib ```
1 parent 4060c45 commit dc0a6e5

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Make.inc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ RPATH_LIB := $(RPATH_ORIGIN)
15081508

15091509
# --whole-archive
15101510
ifeq ($(OS), Darwin)
1511-
WHOLE_ARCHIVE := -Xlinker -all_load
1511+
WHOLE_ARCHIVE := -Xlinker -force_load
15121512
NO_WHOLE_ARCHIVE :=
15131513
else
15141514
WHOLE_ARCHIVE := -Wl,--whole-archive
@@ -1578,8 +1578,6 @@ endif
15781578
ifeq ($(OS), Darwin)
15791579
SHLIB_EXT := dylib
15801580
OSLIBS += -framework CoreFoundation
1581-
WHOLE_ARCHIVE := -Xlinker -all_load
1582-
NO_WHOLE_ARCHIVE :=
15831581
HAVE_SSP := 1
15841582
JLIBLDFLAGS += -Wl,-compatibility_version,$(SOMAJOR) -Wl,-current_version,$(JULIA_MAJOR_VERSION).$(JULIA_MINOR_VERSION).$(JULIA_PATCH_VERSION)
15851583
endif

base/linking.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function ld()
107107
end
108108

109109
const WHOLE_ARCHIVE = if Sys.isapple()
110-
"-all_load"
110+
"-force_load"
111111
else
112112
"--whole-archive"
113113
end

0 commit comments

Comments
 (0)