@@ -56,9 +56,10 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
56
56
mkpath (bin_path)
57
57
58
58
# Convert platform to a triplet, but strip out the ABI parts
59
- target = triplet (abi_agnostic (platform))
60
- host_target = triplet (abi_agnostic (host_platform))
61
- rust_target = triplet (abi_agnostic (rust_platform))
59
+ aatriplet (p) = triplet (abi_agnostic (p))
60
+ target = aatriplet (platform)
61
+ host_target = aatriplet (host_platform)
62
+ rust_target = aatriplet (rust_platform)
62
63
63
64
# If we should use ccache, prepend this to every compiler invocation
64
65
ccache = use_ccache ? " ccache" : " "
@@ -156,7 +157,7 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
156
157
end
157
158
158
159
gcc_flags (p:: Platform ) = base_gcc_flags (p)
159
- clang_targeting_laser (p:: Platform ) = " -target $(triplet (p)) --sysroot=/opt/$(triplet (p)) /$(triplet (p)) /sys-root"
160
+ clang_targeting_laser (p:: Platform ) = " -target $(aatriplet (p)) --sysroot=/opt/$(aatriplet (p)) /$(aatriplet (p)) /sys-root"
160
161
fortran_flags (p:: Platform ) = " "
161
162
162
163
function gcc_flags (p:: MacOS )
@@ -168,7 +169,7 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
168
169
# On macOS, if we're on an old GCC, the default -syslibroot that gets
169
170
# passed to the linker isn't calculated correctly, so we have to manually set it.
170
171
if select_gcc_version (p). major == 4
171
- FLAGS *= " -Wl,-syslibroot,/opt/$(triplet (p)) /$(triplet (p)) /sys-root"
172
+ FLAGS *= " -Wl,-syslibroot,/opt/$(aatriplet (p)) /$(aatriplet (p)) /sys-root"
172
173
end
173
174
return FLAGS
174
175
end
@@ -182,7 +183,7 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
182
183
# On macOS, if we're on an old GCC, the default -syslibroot that gets
183
184
# passed to the linker isn't calculated correctly, so we have to manually set it.
184
185
if select_gcc_version (p). major == 4
185
- FLAGS *= " -Wl,-syslibroot,/opt/$(triplet (p)) /$(triplet (p)) /sys-root"
186
+ FLAGS *= " -Wl,-syslibroot,/opt/$(aatriplet (p)) /$(aatriplet (p)) /sys-root"
186
187
end
187
188
return FLAGS
188
189
end
@@ -200,7 +201,7 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
200
201
# Next, on MacOS, we need to override the typical C++ include search paths, because it always includes
201
202
# the toolchain C++ headers first. Valentin tracked this down to:
202
203
# https://github.com/llvm/llvm-project/blob/0378f3a90341d990236c44f297b923a32b35fab1/clang/lib/Driver/ToolChains/Darwin.cpp#L1944-L1978
203
- FLAGS *= " -nostdinc++ -isystem /opt/$(triplet (p)) /$(triplet (p)) /sys-root/usr/include/c++/v1"
204
+ FLAGS *= " -nostdinc++ -isystem /opt/$(aatriplet (p)) /$(aatriplet (p)) /sys-root/usr/include/c++/v1"
204
205
return FLAGS
205
206
end
206
207
@@ -209,26 +210,26 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
209
210
210
211
# For everything else, there's MasterCard (TM) (.... also, we need to provide `-rtlib=libgcc` because clang-builtins are broken,
211
212
# and we also need to provide `-stdlib=libstdc++` to match Julia on these platforms.)
212
- clang_flags (p:: Platform ) = " $(clang_targeting_laser (p)) --gcc-toolchain=/opt/$(triplet (p)) -rtlib=libgcc -stdlib=libstdc++"
213
+ clang_flags (p:: Platform ) = " $(clang_targeting_laser (p)) --gcc-toolchain=/opt/$(aatriplet (p)) -rtlib=libgcc -stdlib=libstdc++"
213
214
214
215
215
216
# On macos, we want to use a particular linker with clang. But we want to avoid warnings about unused
216
217
# flags when just compiling, so we put it into "linker-only flags".
217
- clang_link_flags (p:: Platform ) = String[" -fuse-ld=$(triplet (p)) " ]
218
- clang_link_flags (p:: Union{FreeBSD,MacOS} ) = [" -L/opt/$(triplet (p)) /$(triplet (p)) /lib" , " -fuse-ld=$(triplet (p)) " ]
218
+ clang_link_flags (p:: Platform ) = String[" -fuse-ld=$(aatriplet (p)) " ]
219
+ clang_link_flags (p:: Union{FreeBSD,MacOS} ) = [" -L/opt/$(aatriplet (p)) /$(aatriplet (p)) /lib" , " -fuse-ld=$(aatriplet (p)) " ]
219
220
220
221
gcc_link_flags (p:: Platform ) = String[]
221
222
function gcc_link_flags (p:: Linux )
222
223
if arch (p) == :powerpc64le && select_gcc_version (p). major == 4
223
- return [" -L/opt/$(triplet (p)) /$(triplet (p)) /sys-root/lib64" , " -Wl,-rpath-link,/opt/$(triplet (p)) /$(triplet (p)) /sys-root/lib64" ]
224
+ return [" -L/opt/$(aatriplet (p)) /$(aatriplet (p)) /sys-root/lib64" , " -Wl,-rpath-link,/opt/$(aatriplet (p)) /$(aatriplet (p)) /sys-root/lib64" ]
224
225
end
225
226
return String[]
226
227
end
227
228
228
229
# C/C++/Fortran
229
- gcc (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(triplet (p)) /bin/$(triplet (p)) -gcc $(gcc_flags (p)) " ; hash_args= true , link_only_flags= gcc_link_flags (p), unsafe_flags = allow_unsafe_flags ? String[] : [" -Ofast" , " -ffast-math" , " -funsafe-math-optimizations" ])
230
- gxx (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(triplet (p)) /bin/$(triplet (p)) -g++ $(gcc_flags (p)) " ; hash_args= true , link_only_flags= gcc_link_flags (p), unsafe_flags = allow_unsafe_flags ? String[] : [" -Ofast" , " -ffast-math" , " -funsafe-math-optimizations" ])
231
- gfortran (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(triplet (p)) /bin/$(triplet (p)) -gfortran $(fortran_flags (p)) " ; allow_ccache= false , unsafe_flags = allow_unsafe_flags ? String[] : [" -Ofast" , " -ffast-math" , " -funsafe-math-optimizations" ])
230
+ gcc (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(aatriplet (p)) /bin/$(aatriplet (p)) -gcc $(gcc_flags (p)) " ; hash_args= true , link_only_flags= gcc_link_flags (p), unsafe_flags = allow_unsafe_flags ? String[] : [" -Ofast" , " -ffast-math" , " -funsafe-math-optimizations" ])
231
+ gxx (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(aatriplet (p)) /bin/$(aatriplet (p)) -g++ $(gcc_flags (p)) " ; hash_args= true , link_only_flags= gcc_link_flags (p), unsafe_flags = allow_unsafe_flags ? String[] : [" -Ofast" , " -ffast-math" , " -funsafe-math-optimizations" ])
232
+ gfortran (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(aatriplet (p)) /bin/$(aatriplet (p)) -gfortran $(fortran_flags (p)) " ; allow_ccache= false , unsafe_flags = allow_unsafe_flags ? String[] : [" -Ofast" , " -ffast-math" , " -funsafe-math-optimizations" ])
232
233
clang (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(host_target) /bin/clang $(clang_flags (p)) " ; link_only_flags= clang_link_flags (p))
233
234
clangxx (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(host_target) /bin/clang++ $(clang_flags (p)) " ; link_only_flags= clang_link_flags (p))
234
235
objc (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(host_target) /bin/clang -x objective-c $(clang_flags (p)) " ; link_only_flags= clang_link_flags (p))
@@ -264,7 +265,7 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
264
265
end
265
266
266
267
# Rust stuff
267
- rust_flags (p:: Platform ) = " --target=$(map_rust_target (p)) -C linker=$(triplet (p)) -gcc"
268
+ rust_flags (p:: Platform ) = " --target=$(map_rust_target (p)) -C linker=$(aatriplet (p)) -gcc"
268
269
rustc (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(rust_target) /bin/rustc $(rust_flags (p)) " ; allow_ccache= false )
269
270
rustup (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(rust_target) /bin/rustup" ; allow_ccache= false )
270
271
cargo (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(rust_target) /bin/cargo" ; allow_ccache= false )
@@ -288,16 +289,16 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
288
289
# Default these tools to the "target tool" versions, will override later
289
290
for tool in (:ar , :as , :cpp , :ld , :nm , :libtool , :objcopy , :objdump , :otool ,
290
291
:ranlib , :readelf , :strip , :install_name_tool , :dlltool , :windres , :winmc , :lipo )
291
- @eval $ (tool)(io:: IO , p:: Platform ) = $ (wrapper)(io, string (" /opt/" , triplet (p) , " /bin/" , triplet (p ), " -" , $ (string (tool))); allow_ccache= false )
292
+ @eval $ (tool)(io:: IO , p:: Platform ) = $ (wrapper)(io, string (" /opt/" , triplet (abi_agnostic (p)) , " /bin/" , triplet (abi_agnostic (p) ), " -" , $ (string (tool))); allow_ccache= false )
292
293
end
293
294
294
295
# c++filt is hard to write in symbols
295
- cxxfilt (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(triplet (p)) /bin/$(triplet (p)) -c++filt" ; allow_ccache= false )
296
- cxxfilt (io:: IO , p:: MacOS ) = wrapper (io, string (" /opt/" , triplet (p), " /bin/llvm-cxxfilt" ); allow_ccache= false )
296
+ cxxfilt (io:: IO , p:: Platform ) = wrapper (io, " /opt/$(aatriplet (p)) /bin/$(aatriplet (p)) -c++filt" ; allow_ccache= false )
297
+ cxxfilt (io:: IO , p:: MacOS ) = wrapper (io, string (" /opt/" , aatriplet (p), " /bin/llvm-cxxfilt" ); allow_ccache= false )
297
298
298
299
# Overrides for macOS binutils because Apple is always so "special"
299
300
for tool in (:ar , :ranlib , :dsymutil )
300
- @eval $ (tool)(io:: IO , p:: MacOS ) = $ (wrapper)(io, string (" /opt/" , triplet (p ), " /bin/llvm-" , $ tool))
301
+ @eval $ (tool)(io:: IO , p:: MacOS ) = $ (wrapper)(io, string (" /opt/" , triplet (abi_agnostic (p) ), " /bin/llvm-" , $ tool))
301
302
end
302
303
# macOS doesn't have a readelf; default to using the host version
303
304
@eval readelf (io:: IO , p:: MacOS ) = readelf (io, $ (host_platform))
@@ -308,8 +309,8 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
308
309
end
309
310
310
311
# # Generate compiler wrappers for both our target and our host
311
- for p in unique (abi_agnostic .(( platform, host_platform) ))
312
- t = triplet (p)
312
+ for p in unique (( platform, host_platform))
313
+ t = aatriplet (p)
313
314
314
315
# Generate `:c` compilers
315
316
if :c in compilers
@@ -375,8 +376,8 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin
375
376
# `x86_64-linux-gnu`, while other build systems might say `x86_64-linux-musl` with no less accuracy. So for
376
377
# safety, we just ship all three all the time.
377
378
if :rust in compilers
378
- for p in unique (abi_agnostic .(( platform, host_platform, rust_platform) ))
379
- t = triplet (p)
379
+ for p in unique (( platform, host_platform, rust_platform))
380
+ t = aatriplet (p)
380
381
write_wrapper (rustc, p, " $(t) -rustc" )
381
382
write_wrapper (rustup, p, " $(t) -rustup" )
382
383
write_wrapper (cargo, p, " $(t) -cargo" )
0 commit comments