svn commit: r351312 - in vendor/lld/dist-release_90: COFF ELF docs
Dimitry Andric
dim at FreeBSD.org
Tue Aug 20 21:35:57 UTC 2019
Author: dim
Date: Tue Aug 20 21:35:55 2019
New Revision: 351312
URL: https://svnweb.freebsd.org/changeset/base/351312
Log:
Vendor import of lld release_90 branch r369369:
https://llvm.org/svn/llvm-project/lld/branches/release_90@369369
Modified:
vendor/lld/dist-release_90/COFF/Driver.cpp
vendor/lld/dist-release_90/COFF/Writer.cpp
vendor/lld/dist-release_90/ELF/SyntheticSections.cpp
vendor/lld/dist-release_90/docs/ReleaseNotes.rst
Modified: vendor/lld/dist-release_90/COFF/Driver.cpp
==============================================================================
--- vendor/lld/dist-release_90/COFF/Driver.cpp Tue Aug 20 21:35:53 2019 (r351311)
+++ vendor/lld/dist-release_90/COFF/Driver.cpp Tue Aug 20 21:35:55 2019 (r351312)
@@ -184,8 +184,10 @@ void LinkerDriver::addBuffer(std::unique_ptr<MemoryBuf
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;
}
Modified: vendor/lld/dist-release_90/COFF/Writer.cpp
==============================================================================
--- vendor/lld/dist-release_90/COFF/Writer.cpp Tue Aug 20 21:35:53 2019 (r351311)
+++ vendor/lld/dist-release_90/COFF/Writer.cpp Tue Aug 20 21:35:55 2019 (r351312)
@@ -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());
@@ -1075,6 +1094,13 @@ Optional<coff_symbol16> Writer::createSymbol(Defined *
break;
}
}
+
+ // 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) {
Modified: vendor/lld/dist-release_90/ELF/SyntheticSections.cpp
==============================================================================
--- vendor/lld/dist-release_90/ELF/SyntheticSections.cpp Tue Aug 20 21:35:53 2019 (r351311)
+++ vendor/lld/dist-release_90/ELF/SyntheticSections.cpp Tue Aug 20 21:35:55 2019 (r351312)
@@ -3177,11 +3177,23 @@ static bool isDuplicateArmExidxSec(InputSection *prev,
// 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.
Modified: vendor/lld/dist-release_90/docs/ReleaseNotes.rst
==============================================================================
--- vendor/lld/dist-release_90/docs/ReleaseNotes.rst Tue Aug 20 21:35:53 2019 (r351311)
+++ vendor/lld/dist-release_90/docs/ReleaseNotes.rst Tue Aug 20 21:35:55 2019 (r351312)
@@ -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
@@ -61,6 +78,17 @@ MinGW Improvements
* lld now correctly links crtend.o as the last object file, handling
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
------------------
More information about the svn-src-all
mailing list