add modified gcc-wrapper
svn path=/nixpkgs/branches/nixos-pkgs/; revision=1793
This commit is contained in:
parent
a30b6755ad
commit
aad382248f
@ -9,8 +9,12 @@ if test -z "$nativeGlibc"; then
|
|||||||
# against the crt1.o from our own glibc, rather than the one in
|
# against the crt1.o from our own glibc, rather than the one in
|
||||||
# /usr/lib. The real solution is of course to prevent those paths
|
# /usr/lib. The real solution is of course to prevent those paths
|
||||||
# from being used by gcc in the first place.
|
# from being used by gcc in the first place.
|
||||||
|
# The dynamic linker is passed in `ldflagsBefore' to allow
|
||||||
|
# explicit overrides of the dynamic linker by callers to gcc/ld
|
||||||
|
# (the *last* value counts, so ours should come first).
|
||||||
cflagsCompile="$cflagsCompile -B$glibc/lib -isystem $glibc/include"
|
cflagsCompile="$cflagsCompile -B$glibc/lib -isystem $glibc/include"
|
||||||
ldflags="$ldflags -L$glibc/lib -dynamic-linker $glibc/lib/ld-linux.so.2"
|
ldflags="$ldflags -L$glibc/lib"
|
||||||
|
ldflagsBefore="-dynamic-linker $glibc/lib/ld-linux.so.2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$nativeTools"; then
|
if test -n "$nativeTools"; then
|
||||||
@ -57,6 +61,7 @@ ln -s g77 $out/bin/f77
|
|||||||
sed \
|
sed \
|
||||||
-e "s^@out@^$out^g" \
|
-e "s^@out@^$out^g" \
|
||||||
-e "s^@ldflags@^$ldflags^g" \
|
-e "s^@ldflags@^$ldflags^g" \
|
||||||
|
-e "s^@ldflagsBefore@^$ldflagsBefore^g" \
|
||||||
-e "s^@ld@^$ldPath/ld^g" \
|
-e "s^@ld@^$ldPath/ld^g" \
|
||||||
-e "s^@shell@^$shell^g" \
|
-e "s^@shell@^$shell^g" \
|
||||||
< $ldWrapper > $out/bin/ld
|
< $ldWrapper > $out/bin/ld
|
||||||
@ -71,6 +76,7 @@ cat > $out/nix-support/add-flags <<EOF
|
|||||||
export NIX_CFLAGS_COMPILE="$cflagsCompile \$NIX_CFLAGS_COMPILE"
|
export NIX_CFLAGS_COMPILE="$cflagsCompile \$NIX_CFLAGS_COMPILE"
|
||||||
export NIX_CFLAGS_LINK="$cflagsLink \$NIX_CFLAGS_LINK"
|
export NIX_CFLAGS_LINK="$cflagsLink \$NIX_CFLAGS_LINK"
|
||||||
export NIX_LDFLAGS="$ldflags \$NIX_LDFLAGS"
|
export NIX_LDFLAGS="$ldflags \$NIX_LDFLAGS"
|
||||||
|
export NIX_LDFLAGS_BEFORE="$ldflagsBefore \$NIX_LDFLAGS_BEFORE"
|
||||||
export NIX_GLIBC_FLAGS_SET=1
|
export NIX_GLIBC_FLAGS_SET=1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
assert nativeTools -> nativePrefix != "";
|
assert nativeTools -> nativePrefix != "";
|
||||||
assert !nativeTools -> gcc != null && binutils != null;
|
assert !nativeTools -> gcc != null && binutils != null;
|
||||||
assert !nativeGlibc -> glibc != null;
|
#assert !nativeGlibc -> glibc != null;
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
builder = ./builder.sh;
|
builder = ./builder.sh;
|
||||||
|
@ -63,24 +63,28 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# Add the flags for the C compiler proper.
|
# Add the flags for the C compiler proper.
|
||||||
extra=($NIX_CFLAGS_COMPILE)
|
extraAfter=($NIX_CFLAGS_COMPILE)
|
||||||
|
extraBefore=()
|
||||||
|
|
||||||
if test "$dontLink" != "1"; then
|
if test "$dontLink" != "1"; then
|
||||||
|
|
||||||
# Add the flags that should only be passed to the compiler when
|
# Add the flags that should only be passed to the compiler when
|
||||||
# linking.
|
# linking.
|
||||||
extra=(${extra[@]} $NIX_CFLAGS_LINK)
|
extraAfter=(${extraAfter[@]} $NIX_CFLAGS_LINK)
|
||||||
|
|
||||||
# Add the flags that should be passed to the linker (and prevent
|
# Add the flags that should be passed to the linker (and prevent
|
||||||
# `ld-wrapper' from adding NIX_LDFLAGS again).
|
# `ld-wrapper' from adding NIX_LDFLAGS again).
|
||||||
|
for i in $NIX_LDFLAGS_BEFORE; do
|
||||||
|
extraBefore=(${extraBefore[@]} "-Wl,$i")
|
||||||
|
done
|
||||||
for i in $NIX_LDFLAGS; do
|
for i in $NIX_LDFLAGS; do
|
||||||
extra=(${extra[@]} "-Wl,$i")
|
extraAfter=(${extraAfter[@]} "-Wl,$i")
|
||||||
done
|
done
|
||||||
export NIX_LDFLAGS_SET=1
|
export NIX_LDFLAGS_SET=1
|
||||||
|
|
||||||
if test "$NIX_STRIP_DEBUG" = "1"; then
|
if test "$NIX_STRIP_DEBUG" = "1"; then
|
||||||
# Add executable-stripping flags.
|
# Add executable-stripping flags.
|
||||||
extra=(${extra[@]} $NIX_CFLAGS_STRIP)
|
extraAfter=(${extraAfter[@]} $NIX_CFLAGS_STRIP)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -90,8 +94,12 @@ if test "$NIX_DEBUG" = "1"; then
|
|||||||
for i in "${params[@]}"; do
|
for i in "${params[@]}"; do
|
||||||
echo " $i" >&2
|
echo " $i" >&2
|
||||||
done
|
done
|
||||||
echo "extra flags to @gcc@:" >&2
|
echo "extraBefore flags to @gcc@:" >&2
|
||||||
for i in ${extra[@]}; do
|
for i in ${extraBefore[@]}; do
|
||||||
|
echo " $i" >&2
|
||||||
|
done
|
||||||
|
echo "extraAfter flags to @gcc@:" >&2
|
||||||
|
for i in ${extraAfter[@]}; do
|
||||||
echo " $i" >&2
|
echo " $i" >&2
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -100,4 +108,4 @@ if test -n "$NIX_GCC_WRAPPER_EXEC_HOOK"; then
|
|||||||
. "$NIX_GCC_WRAPPER_EXEC_HOOK"
|
. "$NIX_GCC_WRAPPER_EXEC_HOOK"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec @gcc@ "${params[@]}" ${extra[@]}
|
exec @gcc@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
|
||||||
|
@ -42,9 +42,11 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
extra=()
|
extra=()
|
||||||
|
extraBefore=()
|
||||||
|
|
||||||
if test -z "$NIX_LDFLAGS_SET"; then
|
if test -z "$NIX_LDFLAGS_SET"; then
|
||||||
extra=(${extra[@]} $NIX_LDFLAGS)
|
extra=(${extra[@]} $NIX_LDFLAGS)
|
||||||
|
extraBefore=(${extraBefore[@]} $NIX_LDFLAGS_BEFORE)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -141,4 +143,4 @@ if test -n "$NIX_LD_WRAPPER_EXEC_HOOK"; then
|
|||||||
. "$NIX_LD_WRAPPER_EXEC_HOOK"
|
. "$NIX_LD_WRAPPER_EXEC_HOOK"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec @ld@ "${params[@]}" ${extra[@]}
|
exec @ld@ ${extraBefore[@]} "${params[@]}" ${extra[@]}
|
||||||
|
Loading…
Reference in New Issue
Block a user