avrlibc: hook up libdir for cc-wrapper

-B must be set to the root directory of avrlibc, otherwise gcc cannot
locate crt objects for some attiny devices. -L trains as set by
bintools-wrapper are not necessary with -B set correctly because gcc
takes care of that, and likewise we can drop the -B train from
cc-wrapper because the one spec is enough.
This commit is contained in:
pennae 2023-03-10 07:26:28 +01:00 committed by Emily Trau
parent 574d1e47ea
commit b2844f89d1
3 changed files with 1 additions and 12 deletions

View File

@ -301,12 +301,6 @@ stdenv.mkDerivation {
hardening_unsupported_flags+=" relro bindnow" hardening_unsupported_flags+=" relro bindnow"
'' ''
+ optionalString (libc != null && targetPlatform.isAvr) ''
for isa in avr5 avr3 avr4 avr6 avr25 avr31 avr35 avr51 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tiny-stack; do
echo "-L${getLib libc}/avr/lib/$isa" >> $out/nix-support/libc-cflags
done
''
+ optionalString stdenv.targetPlatform.isDarwin '' + optionalString stdenv.targetPlatform.isDarwin ''
echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags
'' ''

View File

@ -649,12 +649,6 @@ stdenv.mkDerivation {
hardening_unsupported_flags+=" stackprotector" hardening_unsupported_flags+=" stackprotector"
'' ''
+ optionalString (libc != null && targetPlatform.isAvr) ''
for isa in avr5 avr3 avr4 avr6 avr25 avr31 avr35 avr51 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tiny-stack; do
echo "-B${getLib libc}/avr/lib/$isa" >> $out/nix-support/libc-crt1-cflags
done
''
+ optionalString stdenv.targetPlatform.isDarwin '' + optionalString stdenv.targetPlatform.isDarwin ''
echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/cc-cflags echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/cc-cflags
'' ''

View File

@ -19,6 +19,7 @@ stdenv.mkDerivation rec {
passthru = { passthru = {
incdir = "/avr/include"; incdir = "/avr/include";
libdir = "/avr/lib";
}; };
meta = with lib; { meta = with lib; {