My program compiles without using -flto, but with -flto I get this error:
% arm-none-eabi-g++ --version arm-none-eabi-g++ (4.8.3-9+11) 4.8.3 20140820 (release) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. % arm-none-eabi-g++ -O2 -W -Wall -fPIE -flto -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -ffreestanding -nostdlib -std=gnu++11 -fno-exceptions -fno-rtti -c -o main.o main.cc % arm-none-eabi-g++ -fPIE -nostdlib -O2 -flto boot.o memcpy.o font.o main.o -lgcc -Tlink-arm-eabi.ld -o kernel.elf `memcpy' referenced in section `.text' of /tmp/ccYO5wE8.ltrans0.ltrans.o: defined in discarded section `.text' of memcpy.o (symbol from plugin) collect2: error: ld returned 1 exit status
I tried moving memcpy.o to different positions to try different link orders, but the error is always the same. I saw that this is a common problem, but none of the answers to previous questions apply. I donβt have a broken forced level installed or different versions of the compiler are used for compilation. I am building a kernel without a kernel, so there is no external library other than libgcc.
Does anyone know what is going on there?
c ++ g ++ linker-errors
Goswin von brederlow
source share