I tried following code snippet put in single file:
volatile int x;
void __attribute__((section (".section1")))
foo()
{
x++;
}
void main()
{
foo ();
/* some other code */
}
I have found that without LTO foo() goes into .section1, but with LTO it is inlined and goes into .text. I am using "gcc version 4.9.3 20141119 (release) [ARM/embedded-4_9-branch revision 218278]"
This is not what you had suggested would happen. foo() should have been inlined no matter LTO is enabled or not.
I tried following code snippet put in single file:
volatile int x; _((section (".section1")))
void __attribute_
foo()
{
x++;
}
void main()
{
foo ();
/* some other code */
}
I have found that without LTO foo() goes into .section1, but with LTO it is inlined and goes into .text. I am using "gcc version 4.9.3 20141119 (release) [ARM/embedded- 4_9-branch revision 218278]"
This is not what you had suggested would happen. foo() should have been inlined no matter LTO is enabled or not.