Re:LLD is included in the upcoming LLVM 4.0 release
by chisophugis on Friday February 17, 2017 @11:20PM
(#13673589)
> While conventional linkers work at the compilation-unit level (one source file, usually), placing that whole source file's functions adjacently in memory [1], an atom-based linker is able to take the smallest linkable units (individual functions, each static/global variable...), and arrange those optimally.
This isn't quite right. It's just that traditionally (i.e. when not using -ffunction-sections/-fdata-sections) when compilers output an ELF relocatable object, they group all the functions into a single "smallest linkable unit" (a single .text section) and so the linker can't actually do any reordering because the information that the functions are distinct has been lost.
"""
the ELF and COFF
notion of "section" is a strict superset of its [the Atom LLD's] core "atom" abstraction (an
indivisible chunk of data with a 1:1 correspondence with a symbol name).
Therefore the entire design was impossible to use for those formats. In ELF
and COFF, a section is decoupled from symbols, and there can be arbitrarily
many symbols pointing to arbitrary parts of a section (whereas in MachO,
"section" means something different; the analogous concept to an ELF/COFF
section is basically "the thing that you get when you split a MachO section
on symbol boundaries, assuming that the compiler/assembler hasn't relaxed
relocations across those boundaries" which is not as powerful as ELF/COFF's
notion). This resulted in severe contortions that ultimately made it
untenable to keep working in that codebase.
"""
This isn't quite right. It's just that traditionally (i.e. when not using -ffunction-sections/-fdata-sections) when compilers output an ELF relocatable object, they group all the functions into a single "smallest linkable unit" (a single .text section) and so the linker can't actually do any reordering because the information that the functions are distinct has been lost.
I describe this in more detail here: http://lists.llvm.org/pipermail/llvm-dev/2016-December/10814... This was actually one of the key technical issues that prevented the Atom design from being used for ELF and COFF.
""" the ELF and COFF notion of "section" is a strict superset of its [the Atom LLD's] core "atom" abstraction (an indivisible chunk of data with a 1:1 correspondence with a symbol name). Therefore the entire design was impossible to use for those formats. In ELF and COFF, a section is decoupled from symbols, and there can be arbitrarily many symbols pointing to arbitrary parts of a section (whereas in MachO, "section" means something different; the analogous concept to an ELF/COFF section is basically "the thing that you get when you split a MachO section on symbol boundaries, assuming that the compiler/assembler hasn't relaxed relocations across those boundaries" which is not as powerful as ELF/COFF's notion). This resulted in severe contortions that ultimately made it untenable to keep working in that codebase. """