[PATCH] D30458: [ELF] - Make Bss and BssRelRo sections to be synthetic by nature.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 1 01:02:34 PST 2017


>> On Tue, Feb 28, 2017 at 5:04 PM, Rafael Avila de Espindola <
>> rafael.espindola at gmail.com> wrote:
>>
>>> Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:
>>>
>>> > ruiu added a comment.
>>> >
>>> > It doesn't seem like an improvement to me. Out::Bss and Out::BssRelRo
>>> are containers of synthetic sections, thus they are output sections. You
>>> could represent them as input sections, and we want to do if that
>>> simplifies code/design, but this patch doesn't seem to simplify it.
>>>
>>> They are synthetic sections in the sense that a linker script can
>>> put them in another output section:
>>>
>>>   aabb : { *(.bss.*) }
>>>
>>> Maybe we should revisit the idea of having one section per copy
>>> relocation? We can do that if we add an offset to SharedSymbol or if we
>>> replace the SharedSymbol with a DefinedRegular when a copy relocation is
>>> created (I think I like the second option better).
>>>
>>
>> Are you saying that, for each symbol that needs copy relocation, create a
>> .bss (or .bss.rel.ro) synthetic section and add it to the input section
>> list, so that a latter pass will aggregate them to a .bss (or .bss.rel.ro)
>> output section?
>
>I was thinking of having a single synthetic section for all ro copy
>relocations and a single synthetic section for all rw copy relocations.
>

That should work too.
(There probably would be no much difference with approach used in patch, but explicit
holder for relocation sections would be a bit cleaner than placeholder-marker).

>Now that I think of it, I think your suggestion is probably
>better. Everything should just work if each synthetic section is added
>to the input section list.

I also though about that when wrote patch, but doesn't it mean we would 
need early scan of relocations before creating output sections (to find copy relocations) ? 
Now we proccess all relocations including copy relocations after createSections().

George.


More information about the llvm-commits mailing list