This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -ffunction-sections and -fdata-sections documentation


On Fri, Oct 13, 2017 at 2:34 PM, Sebastian Huber
<sebastian.huber@embedded-brains.de> wrote:

>>> Do these options affect the code generation?
>> They can affect code generation.   By placing each object into its own
>> section it's no longer viable to use one object to refer to another
>> because the relative addresses are unknown until link time.  Without
>> those options the assembler can compute the offset between two objects
>> within a given section when they come from the same translation unit.
>
> Is this similar to moving all distinct objects into one compiler generated structure?

It places each function and each datum into a separate section, which
can be placed or removed independently.  It is not combining data or
altering the order of structures.  It allows the linker to position
functions and data items as individual components instead of a single
object file "text" or "data" blobs.

Thanks, David


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]