Skip to content

Commit aa1d668

Browse files
gbaraldiKristofferC
authored andcommitted
Bump LLD to get dsymutil and use it for pkgimgs (#48628)
* Run dsymutil on pkgimgs for apple platforms + LLD bump to get dsymutil from the jll (cherry picked from commit d8c2250)
1 parent 6fd2693 commit aa1d668

File tree

6 files changed

+150
-119
lines changed

6 files changed

+150
-119
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ endif
317317
# Install `lld` into libexec/
318318
$(INSTALL_M) $(build_depsbindir)/lld$(EXE) $(DESTDIR)$(libexecdir)/
319319

320+
# Install `dsymutil` into libexec/
321+
$(INSTALL_M) $(build_depsbindir)/dsymutil$(EXE) $(DESTDIR)$(libexecdir)/
322+
320323
# Copy public headers
321324
cp -R -L $(build_includedir)/julia/* $(DESTDIR)$(includedir)/julia
322325
# Copy system image

base/linking.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ const PATH_list = String[]
1111
const LIBPATH_list = String[]
1212
const lld_path = Ref{String}()
1313
const lld_exe = Sys.iswindows() ? "lld.exe" : "lld"
14+
const dsymutil_path = Ref{String}()
15+
const dsymutil_exe = Sys.iswindows() ? "dsymutil.exe" : "dsymutil"
1416

1517
if Sys.iswindows()
1618
const LIBPATH_env = "PATH"
@@ -60,12 +62,27 @@ function __init_lld_path()
6062
return
6163
end
6264

65+
function __init_dsymutil_path()
66+
#Same as with lld but for dsymutil
67+
for bundled_dsymutil_path in (joinpath(Sys.BINDIR, Base.LIBEXECDIR, dsymutil_exe),
68+
joinpath(Sys.BINDIR, "..", "tools", dsymutil_exe),
69+
joinpath(Sys.BINDIR, dsymutil_exe))
70+
if isfile(bundled_dsymutil_path)
71+
dsymutil_path[] = abspath(bundled_dsymutil_path)
72+
return
73+
end
74+
end
75+
dsymutil_path[] = something(Sys.which(dsymutil_exe), dsymutil_exe)
76+
return
77+
end
78+
6379
const VERBOSE = Ref{Bool}(false)
6480

6581
function __init__()
6682
VERBOSE[] = parse(Bool, get(ENV, "JULIA_VERBOSE_LINKING", "false"))
6783

6884
__init_lld_path()
85+
__init_dsymutil_path()
6986
PATH[] = dirname(lld_path[])
7087
if Sys.iswindows()
7188
# On windows, the dynamic libraries (.dll) are in Sys.BINDIR ("usr\\bin")
@@ -82,6 +99,11 @@ function lld(; adjust_PATH::Bool = true, adjust_LIBPATH::Bool = true)
8299
return Cmd(Cmd([lld_path[]]); env)
83100
end
84101

102+
function dsymutil(; adjust_PATH::Bool = true, adjust_LIBPATH::Bool = true)
103+
env = adjust_ENV!(copy(ENV), PATH[], LIBPATH[], adjust_PATH, adjust_LIBPATH)
104+
return Cmd(Cmd([dsymutil_path[]]); env)
105+
end
106+
85107
function ld()
86108
default_args = ``
87109
@static if Sys.iswindows()

base/loading.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,6 +2203,9 @@ function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, in
22032203
rm(evicted_cachefile; force=true)
22042204
try
22052205
rm(ocachefile_from_cachefile(evicted_cachefile); force=true)
2206+
@static if Sys.isapple()
2207+
rm(ocachefile_from_cachefile(evicted_cachefile) * ".dSYM"; force=true, recursive=true)
2208+
end
22062209
catch
22072210
end
22082211
end
@@ -2230,6 +2233,9 @@ function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, in
22302233
cachefile = cachefile_from_ocachefile(ocachefile)
22312234
rename(tmppath_so, ocachefile::String; force=true)
22322235
end
2236+
@static if Sys.isapple()
2237+
run(`$(Linking.dsymutil()) $ocachefile`, Base.DevNull(), Base.DevNull(), Base.DevNull())
2238+
end
22332239
end
22342240
# this is atomic according to POSIX (not Win32):
22352241
rename(tmppath, cachefile; force=true)

0 commit comments

Comments
 (0)