SlideServe
Menu
Préférences
© SlideServe · v2026

lld: The LLVM Linker for Fast and Reliable Cross-Linking

ptiggs avatar
22 diapositives · 254 Views · Nov 07, 2019

Explore the features and benefits of lld, a system linker known for its speed, modular design, and cross-platform compatibility. Discover how lld simplifies the linking process and enhances performance, making it an essential tool for developers working on various platforms.

lld: The LLVM Linker for Fast and Reliable Cross-Linking - slide 1
1 / 22

Télécharger la présentation

lld: The LLVM Linker for Fast and Reliable Cross-Linking
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. 2012 LLVM Euro - Michael Spencer lld The LLVM Linker

  2. What is lld? • A system linker • Produce final libraries and executables, no other tools or runtime required • Understands platform ABI 2012 LLVM Euro - Michael Spencer

  3. What is lld? • A system linker • Modular and embeddable • Designed as a set of libraries • As with all LLVM/Clang tools, the main executable code is quite short. • Can be embedded into other tools such as custom language compilers. 2012 LLVM Euro - Michael Spencer

  4. What is lld? • A system linker • Modular and embeddable • Portable (both host and target) • Currently tested on Mac, Linux, and Windows • Target specific code is isolated for both OS and CPU architecture 2012 LLVM Euro - Michael Spencer

  5. What is lld? • A system linker • Modular and embeddable • Portable (both host and target) • Compatible • Driver to support multiple styles (gnu-ld, ld64, link.exe) • Supports ELF, COFF (including MinGW), Mach-O, and LLVM IR • Support for a restricted subset of linker scripts is planned 2012 LLVM Euro - Michael Spencer

  6. What is lld? • A system linker • Modular and embeddable • Portable (both host and target) • Compatible • Extensible • Both LLVM IR and atom graph passes can be added 2012 LLVM Euro - Michael Spencer

  7. Why a new linker? • Performance • Linking is a speed bump in the way of fast iteration • gold may be fast, but gnu-ld and link.exe are not, and gold is ELF only 2012 LLVM Euro - Michael Spencer

  8. Why a new linker? • Performance • Portability • gold and gnu-ld are UNIX-oriented, link.exe is Windows only, and ld64 is Darwin only. 2012 LLVM Euro - Michael Spencer

  9. Why a new linker? • Performance • Portability • Reliable cross linking • No single linker can currently be used to reliably cross link 2012 LLVM Euro - Michael Spencer

  10. What makes lld different? • Atom Model • An atom is an indivisible chunk of code or data • It has a set of attributes such as type, name, and scope • It has a list of references to other atoms • References represent relocations and other relationships such as grouping. 2012 LLVM Euro - Michael Spencer

  11. Atom Model • An atom is an indivisible chunk of code or data An atom 2012 LLVM Euro - Michael Spencer

  12. Atom Model • It has a set of attributes such as type, name, and scope name: main type: code scope: global But not all atoms have names • type: data • scope: static • content: "Hello, World!" 2012 LLVM Euro - Michael Spencer

  13. Atom Model • It has a list of references to other atoms name: main type: code scope: global • name: printf • def: undefined • type: data • scope: static • content: "Hello, World!" 2012 LLVM Euro - Michael Spencer

  14. Atom Model • References represent relocations and other relationships such as grouping. name: main type: code scope: global offset: 24 type: R_X86_64_PC32 addend: -4 offset: 12 type: R_X86_64_32S • name: printf • def: undefined • type: data • scope: static • content: "Hello, World!" 2012 LLVM Euro - Michael Spencer

  15. What makes lld different? • Atom Model • LLVM IR and atom graph passes • In addition to the standard LLVM passes, other passes can run at pre and post LLVM IR link phases • lld passes can be run over the atom graph at different stages of the link • Branch island generation • Order file • C++ Open Multi-Methods… 2012 LLVM Euro - Michael Spencer

  16. What makes lld different? • Atom Model • LLVM IR and atom graph passes • Uniform text, binary, and in memory representation • lld supports a human-readable YAML input and output format to aid in testing and debugging 2012 LLVM Euro - Michael Spencer

  17. Uniform Representation # RUN: lld-core %s 2>&1 | FileCheck %s # CHECK: duplicate symbol --- atoms: - name: _foo scope: global type: data --- atoms: - name: _foo scope: global type: code ... 2012 LLVM Euro - Michael Spencer

  18. What makes lld different? • Atom Model • LLVM IR and atom graph passes • Uniform text, binary, and in memory representation • lld supports a human readable YAML input and output format to aid in testing and debugging • lld also adds a binary representation of the in memory atom model • The purpose of this is purely for speed • The goal is for LLVM to eventually produce these natively 2012 LLVM Euro - Michael Spencer

  19. What makes lld different? • Atom Model • LLVM IR and atom graph passes • Uniform text, binary, and in memory representation • C++11 • lld has been developed using C++11 from the beginning • Dogfooding Clang and libc++ • Makes it easier to write faster code • C++11 atomics and memory model for multithreading 2012 LLVM Euro - Michael Spencer

  20. Project Status • Atom graph and resolving work with YAML as input and output • lld native binary reading and writing • COFF and Mach-O are already in progress • The Mach-O writer can produce a Hello World executable from multiple YAML files 2012 LLVM Euro - Michael Spencer

  21. Patches Welcome • Open Projects • http://lld.llvm.org/open_projects.html 2012 LLVM Euro - Michael Spencer

  22. 2012 LLVM Euro - Michael Spencer Questions? bigcheesegs@gmail.com