gcc: fix extraLDFlags logic after undoing staging-next workaroud

The original logic was prepending to the array, but this one prepends
the array to itself, which breaks the x86_64-linux stdenv bootstrap. The
correct thing to do is build up the arguments in a temporary array and
prepend it like the original code was doing.
This commit is contained in:
Randy Eckenrode
2024-10-10 17:04:36 -04:00
parent ac31fb7505
commit a77d0eb819
@@ -58,12 +58,13 @@ originalAttrs: (stdenv.mkDerivation (finalAttrs: originalAttrs // {
extraLDFlags=("-L/usr/lib64" "-L/usr/lib")
libc_libdir="/usr/lib"
fi
extraLDFlags=("-L$libc_libdir")
declare -a prefixExtraLDFlags=()
prefixExtraLDFlags=("-L$libc_libdir")
nixDontSetRpathVar=NIX_DONT_SET_RPATH''${post}
if test "''${!nixDontSetRpathVar-}" != "1"; then
extraLDFlags+=("-rpath" "$libc_libdir")
prefixExtraLDFlags+=("-rpath" "$libc_libdir")
fi
extraLDFlags+=("''${extraLDFlags[@]}")
extraLDFlags=("''${prefixExtraLDFlags[@]}" "''${extraLDFlags[@]}")
for i in "''${extraLDFlags[@]}"; do
declare -g EXTRA_LDFLAGS''${post}+=" -Wl,$i"
done