-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
809a1e6
commit 77f97ec
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
# Wrapper to adapt ld64 to gnu style arguments | ||
# Taken from https://github.com/rust-lang/rust/issues/60059#issuecomment-1972748340 | ||
|
||
declare -a args=() | ||
for arg in "$@" | ||
do | ||
# Options for Linker | ||
if [[ $arg == "-Wl,"* ]]; then | ||
IFS=',' read -r -a options <<< "${arg#-Wl,}" | ||
for option in "${options[@]}" | ||
do | ||
if [[ $option == "-plugin="* ]] || [[ $option == "-plugin-opt=mcpu="* ]]; then | ||
# Ignore -lto_library and -plugin-opt=mcpu | ||
: | ||
elif [[ $option == "-plugin-opt=O"* ]]; then | ||
# Convert -plugin-opt=O* to --lto-CGO* | ||
args[${#args[@]}]="-Wl,--lto-CGO${option#-plugin-opt=O}" | ||
else | ||
# Pass through other arguments | ||
args[${#args[@]}]="-Wl,$option" | ||
fi | ||
done | ||
|
||
else | ||
# Pass through other arguments | ||
args[${#args[@]}]="$arg" | ||
fi | ||
done | ||
|
||
# Use clang to call ld64.lld | ||
exec ${CC} -v "${args[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters