[PATCH] sectiongroup support

Shankar Easwaran shankare at codeaurora.org
Mon Mar 17 16:47:03 PDT 2014


On 3/17/2014 6:43 PM, Nick Kledzik wrote:
>
> On Mar 17, 2014, at 4:34 PM, Shankar Easwaran <shankare at codeaurora.org 
> <mailto:shankare at codeaurora.org>> wrote:
>
>> On 3/17/2014 6:24 PM, Nick Kledzik wrote:
>>>
>>> On Mar 17, 2014, at 3:48 PM, Shankar Easwaran 
>>> <shankare at codeaurora.org <mailto:shankare at codeaurora.org>> wrote:
>>>
>>>>> I think the solution:
>>>>> 1) keep the existing canonical form for an atom graph that Passes 
>>>>> process
>>>>> 2) make the ELF Writer smart that when it writes relocatable 
>>>>> object files, to synthesize undefined symbols for references into 
>>>>> group children
>>>>> 3) Have the YAML Reader be dumb and not synthesize any undefines. 
>>>>>  Test cases for groups that want undefines will need to explicitly 
>>>>> have them in the yaml.  This also enables you to write test cases 
>>>>> that test the error case where an indirection though an undefine 
>>>>> is not used.
>>>>>
>>>>>
>>>> The below steps as in the command line would not work though.
>>>>
>>>> lld -flavor gnu -target x86_64 group.o --output-filetype=yaml 
>>>> --noinhibit-exec
>>>>
>>>> (Input file is processed by the ELF reader, convert the read files 
>>>> to YAML files, re-read the files from YAML back into atoms)
>>>>
>>>> As the YAML reader wouldnt synthesize undefined atoms ? Its like a 
>>>> chicken-egg problem.
>>> Think of the YAML Reader and Writer as dumb.  They just convert 
>>> in-memory-objects <-> yaml.  Undefined are never synthesized (point 
>>> 3 above).  If you want to write test cases for groups in yaml, 
>>> you’ll need to explicitly add the UndefineAtom in the yaml file.
>>
>> You are right that if the YAML reader and writer is used for testing, 
>> as well as the Native reader/writer. The problem will appear when the 
>> linker emittted YAML/Native file (after the resolver is complete) is 
>> used in a separate link, isnt it ?
>>
>> Is this a usecase that we would not be supporting ?
> Basically, you told the linker to do its job and link together object 
> files as if making a final executable, then use an option to the 
> linker to save the atom graph as yaml or native.  Then try to use that 
> atom graph later as if it is a input relocatable object.
>
> The only use case I find interesting is once the native format 
> settings down and someone wants to convert a file to it.  It would be 
> good to have a way to do that.  If need be, we could write a Pass that 
> re-inserts UndefinedAtoms for references to group owned atoms and get 
> that pass to run just when doing that conversion.
>
Thanks for the info, Nick. This is a nice plan.

Shankar Easwaran

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140317/d5804037/attachment.html>


More information about the llvm-commits mailing list