diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 21:35:55 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 21:35:55 +0000 |
commit | 1e52e898a35b86ecd41b7040085e21d3a140a115 (patch) | |
tree | 97a1a3c25b38699a99c5f89badc2bf004cf1241d | |
parent | f1e1c239e31b467e17f1648b1f524fc9ab5b431a (diff) |
Vendor import of lld release_90 branch r369369:vendor/lld/lld-release_90-r369369
Notes
Notes:
svn path=/vendor/lld/dist-release_90/; revision=351312
svn path=/vendor/lld/lld-release_90-r369369/; revision=351313; tag=vendor/lld/lld-release_90-r369369
-rw-r--r-- | COFF/Driver.cpp | 4 | ||||
-rw-r--r-- | COFF/Writer.cpp | 34 | ||||
-rw-r--r-- | ELF/SyntheticSections.cpp | 14 | ||||
-rw-r--r-- | docs/ReleaseNotes.rst | 28 |
4 files changed, 74 insertions, 6 deletions
diff --git a/COFF/Driver.cpp b/COFF/Driver.cpp index d7af50b9318f..7214d12bde8a 100644 --- a/COFF/Driver.cpp +++ b/COFF/Driver.cpp @@ -184,8 +184,10 @@ void LinkerDriver::addBuffer(std::unique_ptr<MemoryBuffer> mb, if (wholeArchive) { std::unique_ptr<Archive> file = CHECK(Archive::create(mbref), filename + ": failed to parse archive"); + Archive *archive = file.get(); + make<std::unique_ptr<Archive>>(std::move(file)); // take ownership - for (MemoryBufferRef m : getArchiveMembers(file.get())) + for (MemoryBufferRef m : getArchiveMembers(archive)) addArchiveBuffer(m, "<whole-archive>", filename, 0); return; } diff --git a/COFF/Writer.cpp b/COFF/Writer.cpp index 36ef87de4263..cc75db0f519c 100644 --- a/COFF/Writer.cpp +++ b/COFF/Writer.cpp @@ -762,6 +762,28 @@ void Writer::locateImportTables() { } } +// Return whether a SectionChunk's suffix (the dollar and any trailing +// suffix) should be removed and sorted into the main suffixless +// PartialSection. +static bool shouldStripSectionSuffix(SectionChunk *sc, StringRef name) { + // On MinGW, comdat groups are formed by putting the comdat group name + // after the '$' in the section name. For .eh_frame$<symbol>, that must + // still be sorted before the .eh_frame trailer from crtend.o, thus just + // strip the section name trailer. For other sections, such as + // .tls$$<symbol> (where non-comdat .tls symbols are otherwise stored in + // ".tls$"), they must be strictly sorted after .tls. And for the + // hypothetical case of comdat .CRT$XCU, we definitely need to keep the + // suffix for sorting. Thus, to play it safe, only strip the suffix for + // the standard sections. + if (!config->mingw) + return false; + if (!sc || !sc->isCOMDAT()) + return false; + return name.startswith(".text$") || name.startswith(".data$") || + name.startswith(".rdata$") || name.startswith(".pdata$") || + name.startswith(".xdata$") || name.startswith(".eh_frame$"); +} + // Create output section objects and add them to OutputSections. void Writer::createSections() { // First, create the builtin sections. @@ -807,10 +829,7 @@ void Writer::createSections() { continue; } StringRef name = c->getSectionName(); - // On MinGW, comdat groups are formed by putting the comdat group name - // after the '$' in the section name. Such a section name suffix shouldn't - // imply separate alphabetical sorting of those section chunks though. - if (config->mingw && sc && sc->isCOMDAT()) + if (shouldStripSectionSuffix(sc, name)) name = name.split('$').first; PartialSection *pSec = createPartialSection(name, c->getOutputCharacteristics()); @@ -1076,6 +1095,13 @@ Optional<coff_symbol16> Writer::createSymbol(Defined *def) { } } + // Symbols that are runtime pseudo relocations don't point to the actual + // symbol data itself (as they are imported), but points to the IAT entry + // instead. Avoid emitting them to the symbol table, as they can confuse + // debuggers. + if (def->isRuntimePseudoReloc) + return None; + StringRef name = def->getName(); if (name.size() > COFF::NameSize) { sym.Name.Offset.Zeroes = 0; diff --git a/ELF/SyntheticSections.cpp b/ELF/SyntheticSections.cpp index f6d0f190d84d..35b9b8928c9f 100644 --- a/ELF/SyntheticSections.cpp +++ b/ELF/SyntheticSections.cpp @@ -3177,11 +3177,23 @@ static bool isDuplicateArmExidxSec(InputSection *prev, InputSection *cur) { // The .ARM.exidx table must be sorted in ascending order of the address of the // functions the table describes. Optionally duplicate adjacent table entries -// can be removed. At the end of the function the ExecutableSections must be +// can be removed. At the end of the function the executableSections must be // sorted in ascending order of address, Sentinel is set to the InputSection // with the highest address and any InputSections that have mergeable // .ARM.exidx table entries are removed from it. void ARMExidxSyntheticSection::finalizeContents() { + if (script->hasSectionsCommand) { + // The executableSections and exidxSections that we use to derive the + // final contents of this SyntheticSection are populated before the + // linker script assigns InputSections to OutputSections. The linker script + // SECTIONS command may have a /DISCARD/ entry that removes executable + // InputSections and their dependent .ARM.exidx section that we recorded + // earlier. + auto isDiscarded = [](const InputSection *isec) { return !isec->isLive(); }; + llvm::erase_if(executableSections, isDiscarded); + llvm::erase_if(exidxSections, isDiscarded); + } + // Sort the executable sections that may or may not have associated // .ARM.exidx sections by order of ascending address. This requires the // relative positions of InputSections to be known. diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst index 76207fec11ac..2d358bf8f246 100644 --- a/docs/ReleaseNotes.rst +++ b/docs/ReleaseNotes.rst @@ -28,6 +28,15 @@ ELF Improvements ``$ ld.lld --call-shared`` now prints ``unknown argument '--call-shared', did you mean '--call_shared'``. +* lld now supports replacing ``JAL`` with ``JALX`` instructions in case + of MIPS - microMIPS cross-mode jumps. + +* lld now creates LA25 thunks for MIPS R6 code. + +* Put MIPS-specific .reginfo, .MIPS.options, and .MIPS.abiflags sections + into corresponding PT_MIPS_REGINFO, PT_MIPS_OPTIONS, and PT_MIPS_ABIFLAGS + segments. + * ... COFF Improvements @@ -53,6 +62,14 @@ COFF Improvements * Several speed and memory usage improvements. +* Range extension thunks are now created for ARM64, if needed + +* lld-link now supports resource object files created by GNU windres and + MS cvtres, not only llvm-cvtres + +* The generated thunks for delayimports now share the majority of code + among thunks, significantly reducing the overhead of using delayimport + * ... MinGW Improvements @@ -62,6 +79,17 @@ MinGW Improvements terminators for the sections such as .eh_frame properly, fixing DWARF exception handling with libgcc and gcc's crtend.o. +* lld now also handles DWARF unwind info generated by GCC, when linking + with libgcc + +* Many more GNU ld options are now supported, which e.g. allows the lld + MinGW frontend to be called by GCC + +* PDB output can be requested without manually specifying the PDB file + name, with the new option ``-pdb=`` with an empty value to the option. + (The old existing syntax ``-pdb <filename>`` was more cumbersome to use + with an empty parameter value.) + MachO Improvements ------------------ |