On 10/13/2017 12:45 PM, Sebastian Huber wrote:
> 
> 
> ----- Am 13. Okt 2017 um 20:39 schrieb David Edelsohn dje....@gmail.com:
> 
>> On Fri, Oct 13, 2017 at 2:34 PM, Sebastian Huber
>> <sebastian.hu...@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.
> 
> Is the optimization opportunity described by Jeff (which is prevented by the 
> use of function and data sections) similar to moving all distinct objects 
> into one compiler generated structure?
Yes.  And it's something that is inhibited by -fdata-sections because
with -fdata-sections the relative locations of any two objects is
unknown until link time.

-ffunction-sections will do things like inhibit call->short-call
relaxations that are sometimes done by the assembler.

jeff

Reply via email to