Skip to content

Commit

Permalink
avrlibc: hook up libdir for cc-wrapper
Browse files Browse the repository at this point in the history
-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.
  • Loading branch information
pennae authored and emilytrau committed Dec 3, 2023
1 parent 574d1e4 commit b2844f8
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
6 changes: 0 additions & 6 deletions pkgs/build-support/bintools-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,6 @@ stdenv.mkDerivation {
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 ''
echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags
''
Expand Down
6 changes: 0 additions & 6 deletions pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,6 @@ stdenv.mkDerivation {
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 ''
echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/cc-cflags
''
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/misc/avr/libc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ stdenv.mkDerivation rec {

passthru = {
incdir = "/avr/include";
libdir = "/avr/lib";
};

meta = with lib; {
Expand Down

0 comments on commit b2844f8

Please sign in to comment.