In my opinion, it is arguable to say gcc shouldn't inline functions in different sections. Instead I find gcc is consistent between lto and non-lto that gcc always inlines functions without considering the section attribute. For example:
void __attribute__((section(".section1")))
foo()
{
volatile int x = 10;
}
void main()
{
for (;;) foo ();
}
The foo() will be inlined no matter it is lto or not. So for you case, I think you need to add noinline attribute if you want to keep function in a specified section.
If you want to change this gcc fundamental behavior, I suggest you to check with gcc community first.
In my opinion, it is arguable to say gcc shouldn't inline functions in different sections. Instead I find gcc is consistent between lto and non-lto that gcc always inlines functions without considering the section attribute. For example:
void __attribute_ _((section( ".section1" )))
foo()
{
volatile int x = 10;
}
void main()
{
for (;;) foo ();
}
The foo() will be inlined no matter it is lto or not. So for you case, I think you need to add noinline attribute if you want to keep function in a specified section.
If you want to change this gcc fundamental behavior, I suggest you to check with gcc community first.