-flto removes const vector
LTO algorithm removes HardwareVectors from the following test case even though KEEP is used in the linker script
Test case:
void _PowerON_Reset (void)
{
__asm("");
}
#define FVECT_SECT __attribute__ ((section (".fvectors")))
const void *HardwareVectors[] FVECT_SECT = {
_PowerON_Reset,
};
int main()
{
return 0;
}
Invocation:
Option1
arm-none-eabi-gcc -Os test.c -c -flto
arm-none-eabi-gcc -Os -flto test.o -specs=nosys.specs -Wl,-Tscript.ld
Option2:
arm-none-eabi-gcc -Os -flto -specs=nosys.specs test.c -Wl,-Tscript.ld
Linker script:
SECTIONS
{
.fvectors 0x20020000 : AT (0x20020000)
{
KEEP(
}
.text 0x20020100 : AT (0x20020100)
{
*(.text)
}
.rvectors :
{
_rvectors_start = .;
KEEP(
_rvectors_end = .;
}
.init :
{
*(.init)
PROVIDE_HIDDEN (__exidx_start = .);
PROVIDE_HIDDEN (__exidx_end = .);
}
.fini :
{
*(.fini)
}
.got :
{
*(.got)
*(.got.plt)
}
.rodata :
{
*(.rodata)
*(.rodata.*)
_erodata = .;
}
.eh_frame_hdr :
{
*(.eh_frame_hdr)
}
.eh_frame :
{
*(.eh_frame)
}
.jcr :
{
*(.jcr)
}
.tors :
{
__CTOR_LIST__ = .;
. = ALIGN(2);
__ctors = .;
*(.ctors)
__ctors_end = .;
__CTOR_END__ = .;
__DTOR_LIST__ = .;
___dtors = .;
*(.dtors)
___dtors_end = .;
__DTOR_END__ = .;
. = ALIGN(2);
_mdata = .;
}
.data 0x20060100 : AT (_mdata)
{
_data = .;
*(.data)
_edata = .;
}
.bss :
{
PROVIDE(
_bss = .;
*(.bss)
*(.bss.**)
*(COMMON)
PROVIDE(
_ebss = .;
_end = .;
PROVIDE(end = .);
}
.stack 0x20061100 (NOLOAD) : AT (0x20061100)
{
_stack = .;
}
}
OBS. using __attribute_
Checked with several releases including the latest 5-2016-q2-update, it's reproducible with all of them.
Is this a bug in the compiler, or is there a problem with my invocation? Thank you!
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Sebastian Perta for more information if necessary.