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:
John Ericson
2017-07-31 17:02:56 -04:00
committed by John Ericson
parent 9242c8b331
commit 1cd74ac70a
2 changed files with 17 additions and 8 deletions
+5 -4
View File
@@ -299,10 +299,11 @@ stdenv.mkDerivation {
'' + (if !useMacosReexportHack then ''
wrap ${prefix}ld ${./ld-wrapper.sh} ''${ld:-$ldPath/${prefix}ld}
'' else ''
export ldWrapper="$out/bin/${prefix}ld" innerLd="${prefix}ld-reexport-delegate"
wrap "$innerLd" ${./macos-sierra-reexport-hack.bash} ''${ld:-$ldPath/${prefix}ld}
wrap "${prefix}ld" ${./ld-wrapper.sh} "$out/bin/$innerLd"
unset ldWrapper
export binPrefix=${prefix}
ldInner="${prefix}ld-reexport-delegate"
wrap "$ldInner" ${./macos-sierra-reexport-hack.bash} ''${ld:-$ldPath/${prefix}ld}
wrap "${prefix}ld" ${./ld-wrapper.sh} "$out/bin/$ldInner"
unset ldInner
'') + ''
if [ -e ${binutils_bin}/bin/${prefix}ld.gold ]; then