[LLVMdev] [lld] Linker script findings.

Sean Silva silvas at purdue.edu
Thu Jan 10 20:21:38 PST 2013

On Thu, Jan 10, 2013 at 9:59 PM, Nick Kledzik <kledzik at apple.com> wrote:
> I'd like to hear some examples of OS vs architectures difference needed in ELF.
> I (naïvely) think of architectures as just being a "machine" field in the
> WriterOptionsELF.  And OS options as just being "add this magic section", or
> "put this section here".

I did a little investigation, and it looks like there is a nontrivial
amount of code is needed for platform support:

- From perusing the gold source code, there doesn't appear to be very
much OS-wise (although I think it piggybacks on GNU ld's gigantic
os/format specific configuration; see below).

- Gold appears to have all the architecture-specific stuff isolated
into separate files. Each one is multi-thousand lines. Just arm.cc is
>12000 lines of code (by way of comparison, currently all the source
code of lib/ReaderWriter/ is a combined total of <10000 lines).

- GNU ld has >20000 lines of templates of C source code which it
instantiates in order to support different OS's. It has >14000 lines
of linker script templates. It has >5000 lines of parameter-setting
files which are used to instantiate those templates.

-- Sean Silva

More information about the llvm-dev mailing list