llvm-project/lld/ELF
Rui Ueyama 3a8bb7cd2c Discard debuginfo for object files empty after GC
Patch by Robert O'Callahan.

Rust projects tend to link in all object files from all dependent
libraries and rely on --gc-sections to strip unused code and data.
Unfortunately --gc-sections doesn't currently strip any debuginfo
associated with GC'ed sections, so lld links in the full debuginfo from
all dependencies even if almost all that code has been discarded. See
https://github.com/rust-lang/rust/issues/56068 for some details.

Properly stripping debuginfo for discarded sections would be difficult,
but a simple approach that helps significantly is to mark debuginfo
sections as live only if their associated object file has at least one
live code/data section. This patch does that. In a (contrived but not
totally artificial) Rust testcase linked above, it reduces the final
binary size from 46MB to 5.1MB.

Differential Revision: https://reviews.llvm.org/D54747

llvm-svn: 358069
2019-04-10 10:37:10 +00:00
..
Arch [RISCV] Fix range check for HI20/LO12/RVC_LUI relocations 2019-04-09 11:39:23 +00:00
AArch64ErrataFix.cpp [ELF][MachO][wasm] Simplify range-style std::find{,_if} with STLExtras.h utilities. NFC 2019-03-29 16:21:16 +00:00
AArch64ErrataFix.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CMakeLists.txt Fail early if an output file is not writable 2019-03-11 16:30:55 +00:00
CallGraphSort.cpp Replace `typedef A B` with `using B = A`. NFC. 2019-04-01 00:11:24 +00:00
CallGraphSort.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Config.h [ELF] Dump symbols ordered by profiled guided section layout to file. 2019-03-27 23:52:22 +00:00
DWARF.cpp ELF: De-template ELFFileBase. NFCI. 2019-04-05 20:16:26 +00:00
DWARF.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Driver.cpp Discard debuginfo for object files empty after GC 2019-04-10 10:37:10 +00:00
Driver.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DriverUtils.cpp Remove a function from header and move the implementation to a .cpp file. NFC. 2019-02-22 23:59:43 +00:00
EhFrame.cpp [ELF][MachO][wasm] Simplify range-style std::find{,_if} with STLExtras.h utilities. NFC 2019-03-29 16:21:16 +00:00
EhFrame.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ICF.cpp COFF, ELF: ICF: Perform 2 rounds of relocation hash propagation. 2019-01-22 23:54:49 +00:00
ICF.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
InputFiles.cpp Rename a variable and add a comment. 2019-04-10 06:32:05 +00:00
InputFiles.h Discard debuginfo for object files empty after GC 2019-04-10 10:37:10 +00:00
InputSection.cpp Discard debuginfo for object files empty after GC 2019-04-10 10:37:10 +00:00
InputSection.h Discard debuginfo for object files empty after GC 2019-04-10 10:37:10 +00:00
LTO.cpp Reland "[Remarks] Add -foptimization-record-passes to filter remark emission" 2019-03-12 21:22:27 +00:00
LTO.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LinkerScript.cpp ELF: Simplify. NFCI. 2019-03-12 19:19:23 +00:00
LinkerScript.h Replace `typedef A B` with `using B = A`. NFC. 2019-04-01 00:11:24 +00:00
MapFile.cpp Replace `typedef A B` with `using B = A`. NFC. 2019-04-01 00:11:24 +00:00
MapFile.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MarkLive.cpp Discard debuginfo for object files empty after GC 2019-04-10 10:37:10 +00:00
MarkLive.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Options.td [ELF] Dump symbols ordered by profiled guided section layout to file. 2019-03-27 23:52:22 +00:00
OutputSections.cpp Replace `typedef A B` with `using B = A`. NFC. 2019-04-01 00:11:24 +00:00
OutputSections.h [ELF] Delete unused forward declarations and unused DynamicReloc::getInputSec(). NFC 2019-03-15 07:16:39 +00:00
README.md Update the documents of the new LLD. 2016-03-12 06:06:40 +00:00
Relocations.cpp ELF: De-template SharedFile. NFCI. 2019-04-08 17:35:55 +00:00
Relocations.h Replace `typedef A B` with `using B = A`. NFC. 2019-04-01 00:11:24 +00:00
ScriptLexer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ScriptLexer.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ScriptParser.cpp Recover elf32-bigmips and elf32-powerpc support in LLD 2019-02-13 18:51:15 +00:00
ScriptParser.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SymbolTable.cpp De-template SymbolTable::addShared. 2019-04-09 08:52:00 +00:00
SymbolTable.h De-template SymbolTable::addShared. 2019-04-09 08:52:00 +00:00
Symbols.cpp [ELF] Emit weak-undef symbols in .dynsym of a PIE binary only if linked against shared libs. 2019-03-18 15:32:57 +00:00
Symbols.h ELF: De-template SharedFile. NFCI. 2019-04-08 17:35:55 +00:00
SyntheticSections.cpp ELF: Move verneed tracking data structures out of VersionNeedSection. 2019-04-08 17:48:05 +00:00
SyntheticSections.h ELF: Move verneed tracking data structures out of VersionNeedSection. 2019-04-08 17:48:05 +00:00
Target.cpp De-template X86_64TargetInfo. NFC. 2019-03-28 17:31:12 +00:00
Target.h Create an instance of Target after reading all input files. NFC. 2019-03-28 17:38:53 +00:00
Thunks.cpp [mips] Remove redundant setup of less-significant bit. NFC 2019-03-13 16:00:35 +00:00
Thunks.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Writer.cpp ELF: Move verneed tracking data structures out of VersionNeedSection. 2019-04-08 17:48:05 +00:00
Writer.h [ELF] Delete unused forward declarations and unused DynamicReloc::getInputSec(). NFC 2019-03-15 07:16:39 +00:00

README.md

See docs/NewLLD.rst