>> Here's the non-lto build: >> arm-none-eabi-gcc -O0 -g -Wl,-y,malloc,-v,-t -c -o main.o main.c >> arm-none-eabi-gcc -O0 -g -Wl,-y,malloc,-v,-t -c -o t1.o t1.c >> arm-none-eabi-gcc -O -g -Wl,-y,malloc,-v,-t main.o t1.o -o main >> collect2 version 11.1.0 >> /usr/libexec/gcc/arm-none-eabi/ld -plugin >> /usr/libexec/gcc/arm-none-eabi/11.1.0/liblto_plugin.so >> -plugin-opt=/usr/libexec/gcc/arm-none-eabi/11.1.0/lto-wrapper >> -plugin-opt=-fresolution=/tmp/ccyt1CxF.res -plugin-opt=-pass-through=-lgcc >> -plugin-opt=-pass-through=-lg -plugin-opt=-pass-through=-lc >> --sysroot=/usr/arm-none-eabi -X -o main >> /usr/lib/gcc/arm-none-eabi/11.1.0/crti.o >> /usr/lib/gcc/arm-none-eabi/11.1.0/crtbegin.o >> /usr/lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/lib/crt0.o >> -L/usr/lib/gcc/arm-none-eabi/11.1.0 >> -L/usr/lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/lib >> -L/usr/arm-none-eabi/lib -L/usr/arm-none-eabi/usr/lib -y malloc -v -t main.o >> t1.o --start-group -lgcc -lg -lc --end-group >> /usr/lib/gcc/arm-none-eabi/11.1.0/crtend.o >> /usr/lib/gcc/arm-none-eabi/11.1.0/crtn.o >> GNU ld (Gentoo 2.36.1 p3) 2.36.1 >> /usr/lib/gcc/arm-none-eabi/11.1.0/crti.o >> /usr/lib/gcc/arm-none-eabi/11.1.0/crtbegin.o >> /usr/lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/lib/crt0.o >> main.o >> t1.o >> /usr/libexec/gcc/arm-none-eabi/ld: t1.o: reference to malloc >> /usr/lib/gcc/arm-none-eabi/11.1.0/libgcc.a >> /usr/lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/lib/libg.a >> /usr/libexec/gcc/arm-none-eabi/ld: lib_a-malloc.o (symbol from plugin): definition of malloc > > So this line ("symbol from plugin") > >> /usr/lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/lib/libc.a >> /usr/lib/gcc/arm-none-eabi/11.1.0/libgcc.a >> /usr/lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/lib/libg.a >> /usr/lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/lib/libc.a >> /usr/lib/gcc/arm-none-eabi/11.1.0/crtend.o >> /usr/lib/gcc/arm-none-eabi/11.1.0/crtn.o >> /tmp/ccHV3ALY.ltrans0.ltrans.o >> /usr/libexec/gcc/arm-none-eabi/ld: /tmp/ccHV3ALY.ltrans0.ltrans.o: definition of malloc > > and this line (synthesized ltrans unit) indicate that your libc.a has LTO > bytecode. > > > How did that happen, did you build Newlib with -flto? > > > Alexander > Most likely, I'm leveraging Gentoo's crossdev functionality to build GCC/binutils/newlib, and I do have a global -flto flag enabled on my system, which I selectively disable for specific packages whenever I find problems. Can newlib not be built with -flto? Does it need something like -ffat-lto-objects? And why does it matter if it was built with lto (or is this behavior just due to the special treatment of libc's in general when linking/building)? Thanks, Gabe