From caa3599599edce2e5113dbc9fdb9e94d4111461a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 27 Nov 2017 03:25:56 -0500 Subject: [PATCH 1/2] binutils-wrapper: Remove stray file left over from old revert binutils-wrapper was removed in ec8d41f08c95cff79ccb28132146226f4f75c6fe. I hope to reintroduce it, but under a different name, so this can go. --- .../macos-sierra-reexport-hack.bash | 108 ------------------ 1 file changed, 108 deletions(-) delete mode 100644 pkgs/build-support/binutils-wrapper/macos-sierra-reexport-hack.bash diff --git a/pkgs/build-support/binutils-wrapper/macos-sierra-reexport-hack.bash b/pkgs/build-support/binutils-wrapper/macos-sierra-reexport-hack.bash deleted file mode 100644 index c3077e869e7..00000000000 --- a/pkgs/build-support/binutils-wrapper/macos-sierra-reexport-hack.bash +++ /dev/null @@ -1,108 +0,0 @@ -#! @shell@ - -set -eu -o pipefail - -path_backup="$PATH" -if [ -n "@coreutils_bin@" ]; then - PATH="@coreutils_bin@/bin" -fi - -declare -r recurThreshold=300 - -declare overflowCount=0 -for ((n=0; n < $#; ++n)); do - case "${!n}" in - -l*) let overflowCount+=1 ;; - -reexport-l*) let overflowCount+=1 ;; - *) ;; - esac -done - -declare -a allArgs=() - -if (( "$overflowCount" <= "$recurThreshold" )); then - allArgs=("$@") -else - declare -a childrenLookup=() childrenLink=() - - while (( $# )); do - case "$1" in - -L/*) - childrenLookup+=("$1") - allArgs+=("$1") - ;; - -L) - echo "cctools LD does not support '-L foo' or '-l foo'" >&2 - exit 1 - ;; - -l) - echo "cctools LD does not support '-L foo' or '-l foo'" >&2 - exit 1 - ;; - -lazy_library | -lazy_framework | -lto_library) - # We aren't linking any "azy_library", "to_library", etc. - allArgs+=("$1") - ;; - -lazy-l | -weak-l) allArgs+=("$1") ;; - # We can't so easily prevent header issues from these. - -lSystem) allArgs+=("$1") ;; - # Special case as indirection seems like a bad idea for something - # so fundamental. Can be removed for simplicity. - -l?* | -reexport-l?*) childrenLink+=("$1") ;; - *) allArgs+=("$1") ;; - esac - - shift - done - - declare n=0 - while (( $n < "${#childrenLink[@]}" )); do - if [[ "${childrenLink[n]}" = -l* ]]; then - childrenLink[n]="-reexport${childrenLink[n]}" - fi - let ++n - done - unset n - - declare -r outputNameLibless=$(basename $( \ - if [[ -z "${outputName:+isUndefined}" ]]; then - echo unnamed - elif [[ "${outputName:0:3}" = lib ]]; then - echo "${outputName:3}" - else - echo "${outputName}" - fi)) - declare -ra children=("$outputNameLibless-reexport-delegate-0" \ - "$outputNameLibless-reexport-delegate-1") - - mkdir -p "$out/lib" - - PATH="$PATH:@out@/bin" - - symbolBloatObject=$outputNameLibless-symbol-hack.o - if [[ ! -e $symbolBloatObject ]]; then - # `-Q` means use GNU Assembler rather than Clang, avoiding an awkward - # dependency cycle. - printf '.private_extern _______child_hack_foo\nchild_hack_foo:\n' \ - | @binPrefix@as -Q -- -o $symbolBloatObject - fi - - # first half of libs - @binPrefix@ld -macosx_version_min $MACOSX_DEPLOYMENT_TARGET -arch x86_64 -dylib \ - -o "$out/lib/lib${children[0]}.dylib" \ - -install_name "$out/lib/lib${children[0]}.dylib" \ - "${childrenLookup[@]}" "$symbolBloatObject" \ - "${childrenLink[@]:0:$((${#childrenLink[@]} / 2 ))}" - - # second half of libs - @binPrefix@ld -macosx_version_min $MACOSX_DEPLOYMENT_TARGET -arch x86_64 -dylib \ - -o "$out/lib/lib${children[1]}.dylib" \ - -install_name "$out/lib/lib${children[1]}.dylib" \ - "${childrenLookup[@]}" "$symbolBloatObject" \ - "${childrenLink[@]:$((${#childrenLink[@]} / 2 ))}" - - allArgs+=("-L$out/lib" "-l${children[0]}" "-l${children[1]}") -fi - -PATH="$path_backup" -exec @prog@ "${allArgs[@]}" From 43e00f7d186ff96c8d6fa5498a3878253dcec920 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 27 Nov 2017 03:27:22 -0500 Subject: [PATCH 2/2] cc-wrapper: Fix stray binPrefix -> targetPrefix I thought my sed in e755a8a27d5c33d87a5742817c373028d35443e9 was exhaustive, but it was not. --- .../cc-wrapper/macos-sierra-reexport-hack.bash | 6 +++--- pkgs/build-support/cc-wrapper/setup-hook.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/build-support/cc-wrapper/macos-sierra-reexport-hack.bash b/pkgs/build-support/cc-wrapper/macos-sierra-reexport-hack.bash index b7aa7ea5c09..20503545333 100644 --- a/pkgs/build-support/cc-wrapper/macos-sierra-reexport-hack.bash +++ b/pkgs/build-support/cc-wrapper/macos-sierra-reexport-hack.bash @@ -82,18 +82,18 @@ else symbolBloatObject=$outputNameLibless-symbol-hack.o if [[ ! -e $symbolBloatObject ]]; then printf '.private_extern _______child_hack_foo\nchild_hack_foo:\n' \ - | @binPrefix@as -- -o $symbolBloatObject + | @targetPrefix@as -- -o $symbolBloatObject fi # first half of libs - @binPrefix@ld -macosx_version_min $MACOSX_DEPLOYMENT_TARGET -arch x86_64 -dylib \ + @targetPrefix@ld -macosx_version_min $MACOSX_DEPLOYMENT_TARGET -arch x86_64 -dylib \ -o "$out/lib/lib${children[0]}.dylib" \ -install_name "$out/lib/lib${children[0]}.dylib" \ "${childrenLookup[@]}" "$symbolBloatObject" \ "${childrenLink[@]:0:$((${#childrenLink[@]} / 2 ))}" # second half of libs - @binPrefix@ld -macosx_version_min $MACOSX_DEPLOYMENT_TARGET -arch x86_64 -dylib \ + @targetPrefix@ld -macosx_version_min $MACOSX_DEPLOYMENT_TARGET -arch x86_64 -dylib \ -o "$out/lib/lib${children[1]}.dylib" \ -install_name "$out/lib/lib${children[1]}.dylib" \ "${childrenLookup[@]}" "$symbolBloatObject" \ diff --git a/pkgs/build-support/cc-wrapper/setup-hook.sh b/pkgs/build-support/cc-wrapper/setup-hook.sh index e43c1609edb..a8f29bd5877 100644 --- a/pkgs/build-support/cc-wrapper/setup-hook.sh +++ b/pkgs/build-support/cc-wrapper/setup-hook.sh @@ -142,9 +142,9 @@ for CMD in \ ar as nm objcopy ranlib strip strings size ld windres do if - PATH=$_PATH type -p "@binPrefix@$CMD" > /dev/null + PATH=$_PATH type -p "@targetPrefix@$CMD" > /dev/null then - export "${role}$(echo "$CMD" | tr "[:lower:]" "[:upper:]")=@binPrefix@${CMD}"; + export "${role}$(echo "$CMD" | tr "[:lower:]" "[:upper:]")=@targetPrefix@${CMD}"; fi done