0
votes

I have a linker file that I use as input for Gnu Arm Embedded Toolchain.

It contains, among other things, an output section like this:

.text :
{
  . = ALIGN(4);
  *(.text*)
  *(.rodata*)
} > FLASH

, where FLASH is a MEMORY block.

My issue is that, when I compile a C++ file with LTO (link-time optimization), some of my code is put in non-".text" sections in the resulting object files. These sections seems to be consistently named:

.gnu.lto<SOMETHING>

As a result, they are not placed in my .text output section.

How can I map LTO input sections to my .text output section?

1
some of my code is put in non-".text" sections in the resulting object files And? Looks like they belong there. What is the reasoning for why do you want not to put them there? Is this XY question? It sounds like you have a bug in your code, that bug is manifesting only with LTO, and you are trying to fix something unrelated. Most probably, as usuall, your interrupt vectors get optimized out.KamilCuk
It's not a problem as such that the code exists in non-".text" sections but I lack the knowledge of how to include this in my output .text section resulting from the linking. I'm in control of the interrupt vectors.jgreen81

1 Answers

0
votes

It turns out my issue was related to a misunderstanding in how the VMA and LMA statements work in GNU linker files. So, in essense the LTO section are mapped correctly. Thanks to anyone who spent time on this.