https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91299
--- Comment #10 from Eason Lai <sen2403 at hotmail dot com> ---
Add my test program.
$cat boo.c
#include "boo.h"
int get_t(void)
{
return 1;
}
$cat main.c
#include "boo.h"
__attribute__((weak)) int get_t(void)
{
return 0;
}
int a;
int main(void)
{
a = get_t();
return a;
}
$arm-none-eabi-gcc -mlittle-endian -mthumb -mcpu=cortex-m33 -Os -flto -c main.c
-o main.o
#arm-none-eabi-gcc -mlittle-endian -mthumb -mcpu=cortex-m33 -Os -fno-lto -c
boo.c -o boo.o
#arm-none-eabi-gcc --specs=nano.specs -lnosys -nostartfiles -Wl,--gc-sections
-Wl,-Ttest.ld boo.o main.o -o main -save-temps
$arm-none-eabi-objdump -d main
main: file format elf32-littlearm
Disassembly of section .test:
00001000 <main>:
1000: 2000 movs r0, #0
1002: 4770 bx lr
$cat "./-lm.res"
1
main.o 3
190 a62a5458565feecb PREEMPTED_REG get_t
192 a62a5458565feecb PREVAILING_DEF main
196 a62a5458565feecb PREVAILING_DEF_IRONLY a