gcc: support avr

- respect libc’s incdir and libdir
- make non-unix systems single threaded
- set LIMITS_H_TEST to false for avr
- misc updates to support new libc’s
- use multilib with avr

For threads we want to use:
- posix on unix systems
- win32 on windows
- single on everything else

For avr:
- add library directories for avrlibc
- to disable relro and bind
- avr5 should have precedence over avr3 - otherwise gcc uses the wrong one
This commit is contained in:
Matthew Bauer
2018-10-29 14:34:09 -05:00
parent 72e3b2a662
commit 412093994b
11 changed files with 171 additions and 95 deletions
@@ -210,7 +210,7 @@ stdenv.mkDerivation {
## General libc support
##
echo "-L${libc_lib}/lib" > $out/nix-support/libc-ldflags
echo "-L${libc_lib}${libc.libdir or "/lib"}" > $out/nix-support/libc-ldflags
echo "${libc_lib}" > $out/nix-support/orig-libc
echo "${libc_dev}" > $out/nix-support/orig-libc-dev
@@ -293,6 +293,16 @@ stdenv.mkDerivation {
hardening_unsupported_flags+=" pic"
''
+ optionalString targetPlatform.isAvr ''
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
''
+ ''
set +u
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh