llvm-project/lld/COFF
Martin Storsjo 98ff9f845d [COFF] Sort .reloc before all other discardable sections
If a binary is stripped, which can remove discardable sections (except
for the .reloc section, which also is marked as discardable as it isn't
loaded at runtime, only read by the loader), the .reloc section should
be first of them, in order not to create gaps in the image.

Previously, binaries with relocations were broken if they were stripped
by GNU binutils strip. Trying to execute such binaries produces an error
about "xx is not a valid win32 application".

This fixes GNU binutils bug 23348.

Prior to SVN r329370 (which didn't intend to have functional changes),
the code for moving discardable sections to the end didn't clearly
express how other discardable sections should be ordered compared to
.reloc, but the change retained the exact same end result as before.

After SVN r329370, the code (and comments) more clearly indicate that
it tries to make the .reloc section the absolutely last one; this patch
changes that.

This matches how GNU binutils ld sorts .reloc compared to dwarf debug
info sections.

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

Signed-off-by: Martin Storsjö <martin@martin.st>
llvm-svn: 337598
2018-07-20 18:43:35 +00:00
..
CMakeLists.txt Merge {COFF,ELF}/Strings.cpp to Common/Strings.cpp. 2018-02-28 17:38:19 +00:00
Chunks.cpp [COFF] report file containing unsupported relocation 2018-06-07 00:50:03 +00:00
Chunks.h COFF: Preserve section type when processing /section flag. 2018-04-20 21:23:16 +00:00
Config.h [PDB] Add PDBSourcePath flag to support absolutize source file path 2018-07-19 04:56:22 +00:00
DLL.cpp Consistent (non) use of empty lines in include blocks 2018-02-20 21:53:18 +00:00
DLL.h COFF: Process /merge flag as we create output sections. 2018-04-07 00:46:55 +00:00
Driver.cpp [PDB] Add PDBSourcePath flag to support absolutize source file path 2018-07-19 04:56:22 +00:00
Driver.h Fix /WholeArchive bug. 2018-06-12 21:47:31 +00:00
DriverUtils.cpp lld-link: Add /lib to Options.td so that it appears in lld-link's help output. 2018-07-14 04:07:51 +00:00
ICF.cpp COFF: Allow ICFing sections with different alignments. 2018-05-14 18:36:51 +00:00
ICF.h Consistent use of header file for ICF and MarkLive 2018-02-20 22:09:59 +00:00
InputFiles.cpp [COFF] Store import symbol pointers as pointers to the base class 2018-07-10 10:40:11 +00:00
InputFiles.h [COFF] Store import symbol pointers as pointers to the base class 2018-07-10 10:40:11 +00:00
LTO.cpp Code cleanup in preparation for adding LTO for wasm. NFC. 2018-05-22 20:20:25 +00:00
LTO.h Code cleanup in preparation for adding LTO for wasm. NFC. 2018-05-22 20:20:25 +00:00
MapFile.cpp COFF: Move assignment of section RVAs to assignAddresses(). NFCI. 2018-03-15 21:13:46 +00:00
MapFile.h COFF: Change the /lldmap output format to be more like the ELF linker. 2017-01-14 03:14:46 +00:00
MarkLive.cpp COFF: Don't create unnecessary thunks. 2018-05-10 19:01:28 +00:00
MarkLive.h Consistent use of header file for ICF and MarkLive 2018-02-20 22:09:59 +00:00
MinGW.cpp COFF: Rename Chunk::getPermissions to getOutputCharacteristics. 2018-04-19 20:03:24 +00:00
MinGW.h [COFF] Avoid forward declaring StringSet, fix build 2017-10-19 20:19:16 +00:00
Options.td [PDB] Add PDBSourcePath flag to support absolutize source file path 2018-07-19 04:56:22 +00:00
PDB.cpp [PDB] Add PDBSourcePath flag to support absolutize source file path 2018-07-19 04:56:22 +00:00
PDB.h COFF: Friendlier undefined symbol errors. 2018-04-17 23:32:33 +00:00
README.md Update the documents of the new LLD. 2016-03-12 06:06:40 +00:00
SymbolTable.cpp [COFF] Store import symbol pointers as pointers to the base class 2018-07-10 10:40:11 +00:00
SymbolTable.h [COFF] Store import symbol pointers as pointers to the base class 2018-07-10 10:40:11 +00:00
Symbols.cpp COFF: Don't create unnecessary thunks. 2018-05-10 19:01:28 +00:00
Symbols.h Remove an unused accessor and simplify the logic a bit. NFC. 2018-02-17 20:41:38 +00:00
Writer.cpp [COFF] Sort .reloc before all other discardable sections 2018-07-20 18:43:35 +00:00
Writer.h COFF: Use (name, output characteristics) as a key when grouping input sections into output sections. 2018-04-20 21:10:33 +00:00

README.md

See docs/NewLLD.rst