[LLVMdev] [lld] Linker script findings.
kledzik at apple.com
Wed Jan 2 22:30:49 PST 2013
On Jan 2, 2013, at 5:51 PM, Sean Silva wrote:
>> The one tricky part will be if the linker script defines symbols
>> (e.g. __text_size), because those symbol names might be
>> referenced by some object file atom. Thus they need an atom
>> representation for lld's Resolver to see. So, the ELF Writer will need
>> to make a first pass at the linker script and make "proxy" atoms for
>> any symbols the linker script defines.
> Does it make sense for the ELF Writer to call into the linker script?
> From what I know about linker scripts, it seems like it is more
> natural to treat them like commandline argument processing, which
> "calls into" the ELF Writer rather than being "called from" the ELF
> Writer (indeed, many linker script constructs are isomorphic to
> certain commandline options). Indeed, `--defsym` can be used to create
> symbols and it is probably best to share a common code path.
Yes, the linker scripts and the command line arguments should all be parsed
into one set of "options" to the ELF Writer.
My point was that most of linker script options don't need to be handled
until the last stage of linking when the Writer is handed the atom graph
to turn into the output file. The one exception to that is any symbols
that need to be defined because of linker scripts (or --defsym).
More information about the llvm-dev