Skip to content

Commit c7e0b90

Browse files
authored
Fix LLVM testsuite (#584)
1 parent 0b650e5 commit c7e0b90

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

Artifacts.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,24 +1518,24 @@ os = "linux"
15181518

15191519
[["LLVMBootstrap.v9.0.1.x86_64-linux-musl.squashfs"]]
15201520
arch = "x86_64"
1521-
git-tree-sha1 = "ebfe91185b5c0c78355f3c72dfa81b5f4a071366"
1521+
git-tree-sha1 = "ce8391bf41cd14279a38f5dc187f2a8d228bae1c"
15221522
lazy = true
15231523
libc = "musl"
15241524
os = "linux"
15251525

15261526
[["LLVMBootstrap.v9.0.1.x86_64-linux-musl.squashfs".download]]
1527-
sha256 = "93a77e38698c4745c13c7069ed68bf2f2efd082436991dae7031b0e09e85e5cb"
1527+
sha256 = "ed30ae9a9717316890dbab0ffdaf9808f1e2cc641e07361c11b3e03054977d7c"
15281528
url = "https://github.com/JuliaPackaging/Yggdrasil/releases/download/LLVMBootstrap-v9.0.1+0/LLVMBootstrap.v9.0.1.x86_64-linux-musl.squashfs.tar.gz"
15291529

15301530
[["LLVMBootstrap.v9.0.1.x86_64-linux-musl.unpacked"]]
15311531
arch = "x86_64"
1532-
git-tree-sha1 = "d6143763e96215a9e4b4e3da94e2273dd61efdc3"
1532+
git-tree-sha1 = "1141df3ecf6d0e3291fc788173a1aaa6ebad8167"
15331533
lazy = true
15341534
libc = "musl"
15351535
os = "linux"
15361536

15371537
[["LLVMBootstrap.v9.0.1.x86_64-linux-musl.unpacked".download]]
1538-
sha256 = "1fe08128e8aede8ff3f04aa07c516f49076a0dd3f08b624dabbe90fea7493f7d"
1538+
sha256 = "a082493b987f56abd6cba5050487414fa5b374f7a5a5e9e36b09094ecd304b96"
15391539
url = "https://github.com/JuliaPackaging/Yggdrasil/releases/download/LLVMBootstrap-v9.0.1+0/LLVMBootstrap.v9.0.1.x86_64-linux-musl.unpacked.tar.gz"
15401540

15411541
[["PlatformSupport-aarch64-linux-gnu.v2019.12.20.x86_64-linux-musl.squashfs"]]

src/Runner.jl

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
155155
# On macOS, if we're on an old GCC, the default -syslibroot that gets
156156
# passed to the linker isn't calculated correctly, so we have to manually set it.
157157
if select_gcc_version(p).major == 4
158-
FLAGS *= " -Wl,-syslibroot,/opt/$(target)/$(target)/sys-root"
158+
FLAGS *= " -Wl,-syslibroot,/opt/$(triplet(p))/$(triplet(p))/sys-root"
159159
end
160160
return FLAGS
161161
end
@@ -169,7 +169,7 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
169169
# On macOS, if we're on an old GCC, the default -syslibroot that gets
170170
# passed to the linker isn't calculated correctly, so we have to manually set it.
171171
if select_gcc_version(p).major == 4
172-
FLAGS *= " -Wl,-syslibroot,/opt/$(target)/$(target)/sys-root"
172+
FLAGS *= " -Wl,-syslibroot,/opt/$(triplet(p))/$(triplet(p))/sys-root"
173173
end
174174
return FLAGS
175175
end
@@ -187,25 +187,27 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
187187
# Next, on MacOS, we need to override the typical C++ include search paths, because it always includes
188188
# the toolchain C++ headers first. Valentin tracked this down to:
189189
# https://github.com/llvm/llvm-project/blob/0378f3a90341d990236c44f297b923a32b35fab1/clang/lib/Driver/ToolChains/Darwin.cpp#L1944-L1978
190-
FLAGS *= " -nostdinc++ -isystem /opt/$(target)/$(target)/sys-root/usr/include/c++/v1"
190+
FLAGS *= " -nostdinc++ -isystem /opt/$(triplet(p))/$(triplet(p))/sys-root/usr/include/c++/v1"
191191
return FLAGS
192192
end
193193

194+
# On FreeBSD, our clang flags are simple
194195
clang_flags(p::FreeBSD) = clang_targeting_laser(p)
195-
# For everything else, there's MasterCard (TM) (.... also, we need to provide `-rtlib=libgcc` because clang-builtins are broken)
196-
clang_flags(p::Platform) = "$(clang_targeting_laser(p)) --gcc-toolchain=/opt/$(triplet(p)) -rtlib=libgcc"
196+
197+
# For everything else, there's MasterCard (TM) (.... also, we need to provide `-rtlib=libgcc` because clang-builtins are broken,
198+
# and we also need to provide `-stdlib=libstdc++` to match Julia on these platforms.)
199+
clang_flags(p::Platform) = "$(clang_targeting_laser(p)) --gcc-toolchain=/opt/$(triplet(p)) -rtlib=libgcc -stdlib=libstdc++"
197200

198201

199202
# On macos, we want to use a particular linker with clang. But we want to avoid warnings about unused
200203
# flags when just compiling, so we put it into "linker-only flags".
201-
clang_link_flags(p::Platform) = String[]
202-
clang_link_flags(p::FreeBSD) = ["-L/opt/$(target)/$(target)/lib"]
203-
clang_link_flags(p::MacOS) = ["-L/opt/$(target)/$(target)/lib", "-fuse-ld=macos"]
204+
clang_link_flags(p::Platform) = String["-fuse-ld=$(triplet(p))"]
205+
clang_link_flags(p::Union{FreeBSD,MacOS}) = ["-L/opt/$(triplet(p))/$(triplet(p))/lib", "-fuse-ld=$(triplet(p))"]
204206

205207
gcc_link_flags(p::Platform) = String[]
206208
function gcc_link_flags(p::Linux)
207209
if arch(p) == :powerpc64le && select_gcc_version(p).major == 4
208-
return ["-L/opt/$(target)/$(target)/sys-root/lib64", "-Wl,-rpath-link,/opt/$(target)/$(target)/sys-root/lib64"]
210+
return ["-L/opt/$(triplet(p))/$(triplet(p))/sys-root/lib64", "-Wl,-rpath-link,/opt/$(triplet(p))/$(triplet(p))/sys-root/lib64"]
209211
end
210212
return String[]
211213
end
@@ -320,6 +322,12 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
320322
write_wrapper(cpp, p, "$(t)-cpp")
321323
write_wrapper(cxxfilt, p, "$(t)-c++filt")
322324
write_wrapper(ld, p, "$(t)-ld")
325+
# ld wrappers for clang's `-fuse-ld=$(target)`
326+
if isa(p, MacOS)
327+
write_wrapper(ld, p, "ld64.$(t)")
328+
else
329+
write_wrapper(ld, p, "ld.$(t)")
330+
end
323331
write_wrapper(nm, p, "$(t)-nm")
324332
write_wrapper(libtool, p, "$(t)-libtool")
325333
write_wrapper(objcopy, p, "$(t)-objcopy")

0 commit comments

Comments
 (0)