cc-wrapper: Make sure symbol tables of child delegators is not empty
As described in https://github.com/NixOS/nixpkgs/issues/18461, MacOS no longer accepts dylibs which only reexport other dylibs, because their symbol tables are empty. To get around this, we define an object file with a single "private extern" symbol, which hopefully won't clobber anything.
This commit is contained in:
parent
9242c8b331
commit
1cd74ac70a
@ -299,10 +299,11 @@ stdenv.mkDerivation {
|
|||||||
'' + (if !useMacosReexportHack then ''
|
'' + (if !useMacosReexportHack then ''
|
||||||
wrap ${prefix}ld ${./ld-wrapper.sh} ''${ld:-$ldPath/${prefix}ld}
|
wrap ${prefix}ld ${./ld-wrapper.sh} ''${ld:-$ldPath/${prefix}ld}
|
||||||
'' else ''
|
'' else ''
|
||||||
export ldWrapper="$out/bin/${prefix}ld" innerLd="${prefix}ld-reexport-delegate"
|
export binPrefix=${prefix}
|
||||||
wrap "$innerLd" ${./macos-sierra-reexport-hack.bash} ''${ld:-$ldPath/${prefix}ld}
|
ldInner="${prefix}ld-reexport-delegate"
|
||||||
wrap "${prefix}ld" ${./ld-wrapper.sh} "$out/bin/$innerLd"
|
wrap "$ldInner" ${./macos-sierra-reexport-hack.bash} ''${ld:-$ldPath/${prefix}ld}
|
||||||
unset ldWrapper
|
wrap "${prefix}ld" ${./ld-wrapper.sh} "$out/bin/$ldInner"
|
||||||
|
unset ldInner
|
||||||
'') + ''
|
'') + ''
|
||||||
|
|
||||||
if [ -e ${binutils_bin}/bin/${prefix}ld.gold ]; then
|
if [ -e ${binutils_bin}/bin/${prefix}ld.gold ]; then
|
||||||
|
@ -74,18 +74,26 @@ else
|
|||||||
|
|
||||||
mkdir -p "$out/lib"
|
mkdir -p "$out/lib"
|
||||||
|
|
||||||
|
PATH="$PATH:@out@/bin"
|
||||||
|
|
||||||
|
symbolBloatObject=$outputNameLibless-symbol-hack.o
|
||||||
|
if [[ ! -e $symbolBloatObject ]]; then
|
||||||
|
printf '.private_extern _______child_hack_foo\nchild_hack_foo:\n' \
|
||||||
|
| @binPrefix@as -- -o $symbolBloatObject
|
||||||
|
fi
|
||||||
|
|
||||||
# first half of libs
|
# first half of libs
|
||||||
@ldWrapper@ -macosx_version_min 10.10 -arch x86_64 -dylib \
|
@binPrefix@ld -macosx_version_min 10.10 -arch x86_64 -dylib \
|
||||||
-o "$out/lib/lib${children[0]}.dylib" \
|
-o "$out/lib/lib${children[0]}.dylib" \
|
||||||
-install_name "$out/lib/lib${children[0]}.dylib" \
|
-install_name "$out/lib/lib${children[0]}.dylib" \
|
||||||
"${childrenLookup[@]}" \
|
"${childrenLookup[@]}" "$symbolBloatObject" \
|
||||||
"${childrenLink[@]:0:$((${#childrenLink[@]} / 2 ))}"
|
"${childrenLink[@]:0:$((${#childrenLink[@]} / 2 ))}"
|
||||||
|
|
||||||
# second half of libs
|
# second half of libs
|
||||||
@ldWrapper@ -macosx_version_min 10.10 -arch x86_64 -dylib \
|
@binPrefix@ld -macosx_version_min 10.10 -arch x86_64 -dylib \
|
||||||
-o "$out/lib/lib${children[1]}.dylib" \
|
-o "$out/lib/lib${children[1]}.dylib" \
|
||||||
-install_name "$out/lib/lib${children[1]}.dylib" \
|
-install_name "$out/lib/lib${children[1]}.dylib" \
|
||||||
"${childrenLookup[@]}" \
|
"${childrenLookup[@]}" "$symbolBloatObject" \
|
||||||
"${childrenLink[@]:$((${#childrenLink[@]} / 2 ))}"
|
"${childrenLink[@]:$((${#childrenLink[@]} / 2 ))}"
|
||||||
|
|
||||||
allArgs+=("-L$out/lib" "-l${children[0]}" "-l${children[1]}")
|
allArgs+=("-L$out/lib" "-l${children[0]}" "-l${children[1]}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user