llvm-project/lld/ELF
Rui Ueyama 733153de3c ELF: Do not instantiate InputSectionBase::Discarded.
"Discarded" section is a marker for discarded sections, and we do not
use the instance except for checking its identity. In that sense, it
is just another type of a "null" pointer for InputSectionBase. So,
it doesn't have to be a real instance of InputSectionBase class.

In this patch, we no longer instantiate Discarded section but instead
use -1 as a pointer value. This eliminates a global variable which
needed initialization at startup.

llvm-svn: 261761
2016-02-24 18:33:35 +00:00
..
CMakeLists.txt Set the folder for libraries to 'lld libraries'. NFC. 2016-01-07 00:14:04 +00:00
Config.h ELF: Create LinkerScript class to move code out of Writer. 2016-02-11 21:17:59 +00:00
Driver.cpp Handle bitcode files in archive files with --whole-archive. 2016-02-23 18:17:11 +00:00
Driver.h ELF: Remove readLinkerScript and define LinkerScript::read instead. 2016-02-11 21:38:55 +00:00
DriverUtils.cpp Re-submit ELF: Report multiple errors from the driver. 2016-02-02 21:13:09 +00:00
Error.cpp ELF: Make link() to take an output stream to which error messages are written. 2016-02-02 22:49:32 +00:00
Error.h ELF: Make link() to take an output stream to which error messages are written. 2016-02-02 22:49:32 +00:00
InputFiles.cpp ELF: Do not instantiate InputSectionBase::Discarded. 2016-02-24 18:33:35 +00:00
InputFiles.h Add initial LTO support. 2016-02-12 20:54:57 +00:00
InputSection.cpp ELF: Do not instantiate InputSectionBase::Discarded. 2016-02-24 18:33:35 +00:00
InputSection.h ELF: Do not instantiate InputSectionBase::Discarded. 2016-02-24 18:33:35 +00:00
LinkerScript.cpp [ELF] - replaced std::function with raw pointers in LinkerScript.cpp 2016-02-24 09:21:47 +00:00
LinkerScript.h [ELF] - Linkerscript KEEP command. 2016-02-23 07:47:54 +00:00
MarkLive.cpp ELF: Do not instantiate InputSectionBase::Discarded. 2016-02-24 18:33:35 +00:00
Options.td [ELF] Implemented -Bsymbolic-functions command line option 2016-02-02 09:28:53 +00:00
OutputSections.cpp ELF: Do not instantiate InputSectionBase::Discarded. 2016-02-24 18:33:35 +00:00
OutputSections.h Fix the aarch64 logic for dynamic relocations. 2016-02-23 20:19:44 +00:00
README.md ELF: Write about the current policy to README. 2016-02-02 23:45:54 +00:00
SymbolTable.cpp Handle a weak undefined tls to archive member. 2016-02-22 23:19:29 +00:00
SymbolTable.h Add initial LTO support. 2016-02-12 20:54:57 +00:00
Symbols.cpp Handle bitcode files in archive files with --whole-archive. 2016-02-23 18:17:11 +00:00
Symbols.h Remove a trivial getter. 2016-02-22 23:16:05 +00:00
Target.cpp Move target independent code out of x86_64 only path. 2016-02-24 18:24:23 +00:00
Target.h Move target independent code out of x86_64 only path. 2016-02-24 18:24:23 +00:00
Writer.cpp ELF: Do not instantiate InputSectionBase::Discarded. 2016-02-24 18:33:35 +00:00
Writer.h ELF2: Implement --gc-sections. 2015-10-22 18:49:53 +00:00

README.md

The New ELF Linker

This directory contains a port of the new PE/COFF linker for ELF.

Overall Design

See COFF/README.md for details on the design. Note that unlike COFF, we do not distinguish chunks from input sections; they are merged together.

Capabilities

This linker can link LLVM and Clang on Linux/x86-64 or FreeBSD/x86-64 "Hello world" can be linked on Linux/PPC64 and on Linux/AArch64 or FreeBSD/AArch64.

Performance

Achieving good performance is one of our goals. It's too early to reach a conclusion, but we are optimistic about that as it currently seems to be faster than GNU gold. It will be interesting to compare when we are close to feature parity.

Library Use

You can embed LLD to your program by linking against it and calling the linker's entry point function lld::elf2::link.

The current policy is that it is your reponsibility to give trustworthy object files. The function is guaranteed to return as long as you do not pass corrupted or malicious object files. A corrupted file could cause a fatal error or SEGV. That being said, you don't need to worry too much about it if you create object files in a usual way and give them to the linker (it is naturally expected to work, or otherwise it's a linker's bug.)