$ USE="-openmp -hardened -sanitize -vtv" crossdev -S -s4 --target avr $ echo 'int main() {}' > test.c $ avr-gcc --verbose -mmcu=atmega32u4 test.c Using built-in specs. Reading specs from /usr/lib/gcc/avr/5.4.0/device-specs/specs-atmega32u4 COLLECT_GCC=avr-gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/avr/5.4.0/lto-wrapper Target: avr Configured with: /var/tmp/portage/cross-avr/gcc-5.4.0-r3/work/gcc-5.4.0/configure --host=x86_64-pc-linux-gnu --target=avr --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/avr/gcc-bin/5.4.0 --includedir=/usr/lib/gcc/avr/5.4.0/include --datadir=/usr/share/gcc-data/avr/5.4.0 --mandir=/usr/share/gcc-data/avr/5.4.0/man --infodir=/usr/share/gcc-data/avr/5.4.0/info --with-gxx-include-dir=/usr/lib/gcc/avr/5.4.0/include/g++-v5 --with-python-dir=/share/gcc-data/avr/5.4.0/python --enable-languages=c,c++ --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 5.4.0-r3 p1.3, pie-0.6.5' --enable-libstdcxx-time --enable-poison-system-directories --enable-shared --disable-threads --disable-bootstrap --enable-multilib --disable-altivec --disable-fixed-point --disable-libgcj --disable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --disable-libmpx --disable-vtable-verify --disable-libvtv --disable-libquadmath --enable-lto --without-isl --disable-libsanitizer Thread model: single gcc version 5.4.0 (Gentoo 5.4.0-r3 p1.3, pie-0.6.5) COLLECT_GCC_OPTIONS='-v' '-specs=device-specs/specs-atmega32u4' '-mmcu=avr5' /usr/libexec/gcc/avr/5.4.0/cc1 -quiet -v -imultilib avr5 -D__AVR_ATmega32U4__ -D__AVR_DEVICE_NAME__=atmega32u4 test.c -mn-flash=1 -mno-skip-bug -quiet -dumpbase test.c -mmcu=avr5 -auxbase test -version -o /tmp/ccdHG3RN.s GNU C11 (Gentoo 5.4.0-r3 p1.3, pie-0.6.5) version 5.4.0 (avr) compiled by GNU C version 6.3.0, GMP version 6.1.2, MPFR version 3.1.5-p2, MPC version 1.0.3 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/lib/gcc/avr/5.4.0/../../../../avr/sys-include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/avr/5.4.0/include /usr/lib/gcc/avr/5.4.0/include-fixed /usr/lib/gcc/avr/5.4.0/../../../../avr/include End of search list. GNU C11 (Gentoo 5.4.0-r3 p1.3, pie-0.6.5) version 5.4.0 (avr) compiled by GNU C version 6.3.0, GMP version 6.1.2, MPFR version 3.1.5-p2, MPC version 1.0.3 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 5f2a6454383de9919f4d6fcb93cf517a COLLECT_GCC_OPTIONS='-v' '-specs=device-specs/specs-atmega32u4' '-mmcu=avr5' /usr/libexec/gcc/avr/as -mmcu=avr5 -mno-skip-bug -o /tmp/ccREnzmo.o /tmp/ccdHG3RN.s COMPILER_PATH=/usr/libexec/gcc/avr/5.4.0/:/usr/libexec/gcc/avr/5.4.0/:/usr/libexec/gcc/avr/:/usr/lib/gcc/avr/5.4.0/:/usr/lib/gcc/avr/ LIBRARY_PATH=/usr/lib/gcc/avr/5.4.0/avr5/:/usr/lib/gcc/avr/5.4.0/../../../../avr/lib/avr5/:/usr/lib/gcc/avr/5.4.0/:/usr/lib/gcc/avr/5.4.0/../../../../avr/lib/ COLLECT_GCC_OPTIONS='-v' '-specs=device-specs/specs-atmega32u4' '-mmcu=avr5' /usr/libexec/gcc/avr/5.4.0/collect2 -plugin /usr/libexec/gcc/avr/5.4.0/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/avr/5.4.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccjNeLRY.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-latmega32u4 -mavr5 -Tdata 0x800100 crtatmega32u4.o -L/usr/lib/gcc/avr/5.4.0/avr5 -L/usr/lib/gcc/avr/5.4.0/../../../../avr/lib/avr5 -L/usr/lib/gcc/avr/5.4.0 -L/usr/lib/gcc/avr/5.4.0/../../../../avr/lib /tmp/ccREnzmo.o --start-group -lgcc -lm -lc -latmega32u4 --end-group /usr/libexec/gcc/avr/ld: cannot find crtatmega32u4.o: No such file or directory /usr/libexec/gcc/avr/ld: cannot find -latmega32u4 collect2: error: ld returned 1 exit status Indeed, as confirmed by `find`, /usr/avr/lib doesn't actually contain crtatmega32u4.o, although it does contain plenty of similarly-named files. I think the solution is to upgrade to a newer version of avr-libc: $ USE="-openmp -hardened -sanitize -vtv" crossdev --gcc 5.4.0 -s4 --target avr $ avr-gcc --verbose -mmcu=atmega32u4 test.c $ a.out: ELF 32-bit LSB executable, Atmel AVR 8-bit, version 1 (SYSV), statically linked, not stripped It seems like upstream has replaced version 1.8.0 by version 1.8.1. Upon inspection of the tarballs, I noticed that file `crt1/iosym/atmega32u4.S` was present in 1.8.1 but not in 1.8.0. I think the correct solution might be to remove 1.8.0 in favor of 1.8.1, and make that the new “stable” version.
I just came here to report the same problem and solution, although I jumped to avr-libc-2.0.0. I've been discussing this in the forums: https://forums.gentoo.org/viewtopic.php?p=8110862#8110862.
Please also see these existing bugs which refer to the same issue: https://bugs.gentoo.org/show_bug.cgi?id=620316 https://bugs.gentoo.org/show_bug.cgi?id=617432
*** This bug has been marked as a duplicate of bug 617432 ***