aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-14 15:39:25 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-14 15:39:25 +0000
commit1eafc0458f4bb4547fe78c62b78312ad4f719c38 (patch)
treedb247ebc1d3d05750e31ef4b162cf9ab4af9ddef
parentb047fead11133644be3dbae34b85be39ce2819e9 (diff)
downloadsrc-1eafc0458f4bb4547fe78c62b78312ad4f719c38.tar.gz
src-1eafc0458f4bb4547fe78c62b78312ad4f719c38.zip
Vendor import of lld release_40 branch r292009:vendor/lld/lld-release_40-r292009
Notes
Notes: svn path=/vendor/lld/dist/; revision=312181 svn path=/vendor/lld/lld-release_40-r292009/; revision=312182; tag=vendor/lld/lld-release_40-r292009
-rw-r--r--CMakeLists.txt3
-rw-r--r--COFF/PDB.cpp94
-rw-r--r--ELF/Driver.cpp3
-rw-r--r--ELF/Error.cpp4
-rw-r--r--ELF/Error.h7
-rw-r--r--ELF/InputFiles.cpp4
-rw-r--r--ELF/InputSection.cpp73
-rw-r--r--ELF/InputSection.h10
-rw-r--r--ELF/LinkerScript.cpp33
-rw-r--r--ELF/OutputSections.cpp7
-rw-r--r--ELF/OutputSections.h2
-rw-r--r--ELF/Relocations.cpp34
-rw-r--r--ELF/SymbolTable.cpp30
-rw-r--r--ELF/Symbols.cpp32
-rw-r--r--ELF/Symbols.h12
-rw-r--r--ELF/SyntheticSections.cpp33
-rw-r--r--ELF/Target.cpp22
-rw-r--r--ELF/Writer.cpp63
-rw-r--r--test/COFF/Inputs/pdb1.yaml172
-rw-r--r--test/COFF/Inputs/pdb2.yaml102
-rw-r--r--test/COFF/dumppdb.test181
-rw-r--r--test/COFF/pdb.test461
-rw-r--r--test/ELF/Inputs/copy-rel-pie.s2
-rw-r--r--test/ELF/Inputs/relocation-copy-relro.s13
-rw-r--r--test/ELF/Inputs/unknown-reloc.s2
-rw-r--r--test/ELF/aarch64-condb-reloc.s18
-rw-r--r--test/ELF/aarch64-gnu-ifunc-plt.s76
-rw-r--r--test/ELF/aarch64-tstbr14-reloc.s14
-rw-r--r--test/ELF/amdgpu-relocs.s4
-rw-r--r--test/ELF/arm-abs32-dyn.s4
-rw-r--r--test/ELF/arm-exidx-shared.s2
-rw-r--r--test/ELF/arm-fpic-got.s8
-rw-r--r--test/ELF/arm-gnu-ifunc-plt.s30
-rw-r--r--test/ELF/arm-pie-relative.s4
-rw-r--r--test/ELF/arm-plt-reloc.s24
-rw-r--r--test/ELF/arm-thumb-interwork-shared.s6
-rw-r--r--test/ELF/arm-thumb-plt-reloc.s24
-rw-r--r--test/ELF/arm-tls-norelax-gd-ie.s6
-rw-r--r--test/ELF/arm-tls-norelax-gd-le.s2
-rw-r--r--test/ELF/arm-tls-norelax-ie-le.s4
-rw-r--r--test/ELF/arm-tls-norelax-ld-le.s2
-rw-r--r--test/ELF/basic-mips.s36
-rw-r--r--test/ELF/basic.s1
-rw-r--r--test/ELF/basic64be.s62
-rw-r--r--test/ELF/combrelocs.s20
-rw-r--r--test/ELF/copy-rel-pie.s10
-rw-r--r--test/ELF/dynamic-reloc-index.s2
-rw-r--r--test/ELF/dynamic-reloc.s2
-rw-r--r--test/ELF/format-binary.test1
-rw-r--r--test/ELF/gnu-ifunc-plt-i386.s24
-rw-r--r--test/ELF/gnu-ifunc-plt.s28
-rw-r--r--test/ELF/gnu-ifunc-shared.s16
-rw-r--r--test/ELF/got-aarch64.s6
-rw-r--r--test/ELF/got-plt-header.s20
-rw-r--r--test/ELF/gotpc-relax-nopic.s24
-rw-r--r--test/ELF/i386-merge.s4
-rw-r--r--test/ELF/incompatible-section-types.s2
-rw-r--r--test/ELF/incompatible-section-types2.s7
-rw-r--r--test/ELF/invalid/invalid-relocation-x64.s4
-rw-r--r--test/ELF/linkerscript/orphan.s10
-rw-r--r--test/ELF/linkerscript/repsection-symbol.s6
-rw-r--r--test/ELF/linkerscript/sort-non-script.s2
-rw-r--r--test/ELF/lto/undefined-puts.ll2
-rw-r--r--test/ELF/lto/visibility.ll2
-rw-r--r--test/ELF/merge-section-types.s19
-rw-r--r--test/ELF/mips-26.s4
-rw-r--r--test/ELF/mips-32.s16
-rw-r--r--test/ELF/mips-64-disp.s18
-rw-r--r--test/ELF/mips-64-got.s18
-rw-r--r--test/ELF/mips-64.s12
-rw-r--r--test/ELF/mips-dynamic.s18
-rw-r--r--test/ELF/mips-got-and-copy.s12
-rw-r--r--test/ELF/mips-got-extsym.s4
-rw-r--r--test/ELF/mips-got-hilo.s12
-rw-r--r--test/ELF/mips-got-redundant.s16
-rw-r--r--test/ELF/mips-got-relocs.s28
-rw-r--r--test/ELF/mips-got-weak.s40
-rw-r--r--test/ELF/mips-got16.s40
-rw-r--r--test/ELF/mips-gp-ext.s20
-rw-r--r--test/ELF/mips-gp-lowest.s2
-rw-r--r--test/ELF/mips-hilo-gp-disp.s28
-rw-r--r--test/ELF/mips-hilo.s10
-rw-r--r--test/ELF/mips-options.s4
-rw-r--r--test/ELF/mips-pc-relocs.s4
-rw-r--r--test/ELF/mips-plt-r6.s4
-rw-r--r--test/ELF/mips-tls-64.s22
-rw-r--r--test/ELF/mips-tls-static-64.s4
-rw-r--r--test/ELF/mips-tls-static.s8
-rw-r--r--test/ELF/mips-tls.s18
-rw-r--r--test/ELF/mips-xgot-order.s6
-rw-r--r--test/ELF/plt-aarch64.s64
-rw-r--r--test/ELF/plt-i686.s36
-rw-r--r--test/ELF/plt.s38
-rw-r--r--test/ELF/ppc64-relocs.s4
-rw-r--r--test/ELF/ppc64-shared-rel-toc.s6
-rw-r--r--test/ELF/ppc64-toc-restore.s2
-rw-r--r--test/ELF/rel-offset.s4
-rw-r--r--test/ELF/relative-dynamic-reloc-pie.s6
-rw-r--r--test/ELF/relative-dynamic-reloc-ppc64.s4
-rw-r--r--test/ELF/relative-dynamic-reloc.s4
-rw-r--r--test/ELF/relocation-copy-flags.s12
-rw-r--r--test/ELF/relocation-copy-relro.s32
-rw-r--r--test/ELF/relocation-i686.s6
-rw-r--r--test/ELF/relocation-non-alloc.s12
-rw-r--r--test/ELF/relocation-none-i686.test23
-rw-r--r--test/ELF/relocation.s22
-rw-r--r--test/ELF/section-layout.s4
-rw-r--r--test/ELF/section-name.s12
-rw-r--r--test/ELF/sort-norosegment.s2
-rw-r--r--test/ELF/startstop.s12
-rw-r--r--test/ELF/synthetic-got.s22
-rw-r--r--test/ELF/tls-dynamic-i686.s21
-rw-r--r--test/ELF/tls-dynamic.s20
-rw-r--r--test/ELF/tls-offset.s4
-rw-r--r--test/ELF/undef-with-plt-addr.s4
-rw-r--r--test/ELF/undefined-versioned-symbol.s6
-rw-r--r--test/ELF/unknown-reloc.s14
-rw-r--r--test/ELF/version-script-anonymous-local.s61
-rw-r--r--test/ELF/x86-64-tls-gd-local.s10
119 files changed, 1615 insertions, 1157 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 23cef2e9fc67..48ac5e038cdb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
endif()
execute_process(COMMAND "${LLVM_CONFIG_PATH}" "--obj-root" "--includedir"
+ "--cmakedir"
RESULT_VARIABLE HAD_ERROR
OUTPUT_VARIABLE LLVM_CONFIG_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -23,12 +24,12 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
list(GET LLVM_CONFIG_OUTPUT 0 OBJ_ROOT)
list(GET LLVM_CONFIG_OUTPUT 1 MAIN_INCLUDE_DIR)
+ list(GET LLVM_CONFIG_OUTPUT 2 LLVM_CMAKE_PATH)
set(LLVM_OBJ_ROOT ${OBJ_ROOT} CACHE PATH "path to LLVM build tree")
set(LLVM_MAIN_INCLUDE_DIR ${MAIN_INCLUDE_DIR} CACHE PATH "path to llvm/include")
file(TO_CMAKE_PATH ${LLVM_OBJ_ROOT} LLVM_BINARY_DIR)
- set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
if(NOT EXISTS "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
message(FATAL_ERROR "LLVMConfig.cmake not found")
diff --git a/COFF/PDB.cpp b/COFF/PDB.cpp
index d5c52a69be69..923fc64c7734 100644
--- a/COFF/PDB.cpp
+++ b/COFF/PDB.cpp
@@ -14,8 +14,12 @@
#include "SymbolTable.h"
#include "Symbols.h"
#include "llvm/DebugInfo/CodeView/CVDebugRecord.h"
+#include "llvm/DebugInfo/CodeView/CVTypeDumper.h"
#include "llvm/DebugInfo/CodeView/SymbolDumper.h"
-#include "llvm/DebugInfo/CodeView/TypeDumper.h"
+#include "llvm/DebugInfo/CodeView/TypeDatabase.h"
+#include "llvm/DebugInfo/CodeView/TypeDumpVisitor.h"
+#include "llvm/DebugInfo/CodeView/TypeStreamMerger.h"
+#include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
#include "llvm/DebugInfo/MSF/ByteStream.h"
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
#include "llvm/DebugInfo/MSF/MSFCommon.h"
@@ -61,44 +65,75 @@ static SectionChunk *findByName(std::vector<SectionChunk *> &Sections,
return nullptr;
}
-static ArrayRef<uint8_t> getDebugT(ObjectFile *File) {
- SectionChunk *Sec = findByName(File->getDebugChunks(), ".debug$T");
+static ArrayRef<uint8_t> getDebugSection(ObjectFile *File, StringRef SecName) {
+ SectionChunk *Sec = findByName(File->getDebugChunks(), SecName);
if (!Sec)
return {};
// First 4 bytes are section magic.
ArrayRef<uint8_t> Data = Sec->getContents();
if (Data.size() < 4)
- fatal(".debug$T too short");
+ fatal(SecName + " too short");
if (read32le(Data.data()) != COFF::DEBUG_SECTION_MAGIC)
- fatal(".debug$T has an invalid magic");
+ fatal(SecName + " has an invalid magic");
return Data.slice(4);
}
+// Merge .debug$T sections and returns it.
+static std::vector<uint8_t> mergeDebugT(SymbolTable *Symtab) {
+ ScopedPrinter W(outs());
+
+ // Visit all .debug$T sections to add them to Builder.
+ codeview::TypeTableBuilder Builder(BAlloc);
+ for (ObjectFile *File : Symtab->ObjectFiles) {
+ ArrayRef<uint8_t> Data = getDebugSection(File, ".debug$T");
+ if (Data.empty())
+ continue;
+
+ msf::ByteStream Stream(Data);
+ codeview::CVTypeArray Types;
+ msf::StreamReader Reader(Stream);
+ if (auto EC = Reader.readArray(Types, Reader.getLength()))
+ fatal(EC, "Reader::readArray failed");
+ if (!codeview::mergeTypeStreams(Builder, Types))
+ fatal("codeview::mergeTypeStreams failed");
+ }
+
+ // Construct section contents.
+ std::vector<uint8_t> V;
+ Builder.ForEachRecord([&](TypeIndex TI, ArrayRef<uint8_t> Rec) {
+ V.insert(V.end(), Rec.begin(), Rec.end());
+ });
+ return V;
+}
+
static void dumpDebugT(ScopedPrinter &W, ObjectFile *File) {
- ArrayRef<uint8_t> Data = getDebugT(File);
+ ListScope LS(W, "DebugT");
+ ArrayRef<uint8_t> Data = getDebugSection(File, ".debug$T");
if (Data.empty())
return;
- msf::ByteStream Stream(Data);
- CVTypeDumper TypeDumper(&W, false);
- if (auto EC = TypeDumper.dump(Data))
+ TypeDatabase TDB;
+ TypeDumpVisitor TDV(TDB, &W, false);
+ CVTypeDumper TypeDumper(TDB);
+ if (auto EC = TypeDumper.dump(Data, TDV))
fatal(EC, "CVTypeDumper::dump failed");
}
static void dumpDebugS(ScopedPrinter &W, ObjectFile *File) {
- SectionChunk *Sec = findByName(File->getDebugChunks(), ".debug$S");
- if (!Sec)
+ ListScope LS(W, "DebugS");
+ ArrayRef<uint8_t> Data = getDebugSection(File, ".debug$S");
+ if (Data.empty())
return;
- msf::ByteStream Stream(Sec->getContents());
+ msf::ByteStream Stream(Data);
CVSymbolArray Symbols;
msf::StreamReader Reader(Stream);
if (auto EC = Reader.readArray(Symbols, Reader.getLength()))
fatal(EC, "StreamReader.readArray<CVSymbolArray> failed");
- CVTypeDumper TypeDumper(&W, false);
- CVSymbolDumper SymbolDumper(W, TypeDumper, nullptr, false);
+ TypeDatabase TDB;
+ CVSymbolDumper SymbolDumper(W, TDB, nullptr, false);
if (auto EC = SymbolDumper.dump(Symbols))
fatal(EC, "CVSymbolDumper::dump failed");
}
@@ -113,21 +148,15 @@ static void dumpCodeView(SymbolTable *Symtab) {
}
}
-static void addTypeInfo(SymbolTable *Symtab,
- pdb::TpiStreamBuilder &TpiBuilder) {
- for (ObjectFile *File : Symtab->ObjectFiles) {
- ArrayRef<uint8_t> Data = getDebugT(File);
- if (Data.empty())
- continue;
-
- msf::ByteStream Stream(Data);
- codeview::CVTypeArray Records;
- msf::StreamReader Reader(Stream);
- if (auto EC = Reader.readArray(Records, Reader.getLength()))
- fatal(EC, "Reader.readArray failed");
- for (const codeview::CVType &Rec : Records)
- TpiBuilder.addTypeRecord(Rec);
- }
+static void addTypeInfo(pdb::TpiStreamBuilder &TpiBuilder,
+ ArrayRef<uint8_t> Data) {
+ msf::ByteStream Stream(Data);
+ codeview::CVTypeArray Records;
+ msf::StreamReader Reader(Stream);
+ if (auto EC = Reader.readArray(Records, Reader.getLength()))
+ fatal(EC, "Reader.readArray failed");
+ for (const codeview::CVType &Rec : Records)
+ TpiBuilder.addTypeRecord(Rec);
}
// Creates a PDB file.
@@ -162,8 +191,11 @@ void coff::createPDB(StringRef Path, SymbolTable *Symtab,
// Add an empty TPI stream.
auto &TpiBuilder = Builder.getTpiBuilder();
TpiBuilder.setVersionHeader(pdb::PdbTpiV80);
- if (Config->DebugPdb)
- addTypeInfo(Symtab, TpiBuilder);
+ std::vector<uint8_t> TpiData;
+ if (Config->DebugPdb) {
+ TpiData = mergeDebugT(Symtab);
+ addTypeInfo(TpiBuilder, TpiData);
+ }
// Add an empty IPI stream.
auto &IpiBuilder = Builder.getIpiBuilder();
diff --git a/ELF/Driver.cpp b/ELF/Driver.cpp
index c8ea821ec522..b4544d78f725 100644
--- a/ELF/Driver.cpp
+++ b/ELF/Driver.cpp
@@ -24,6 +24,7 @@
#include "lld/Driver/Driver.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Object/Decompressor.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/TarWriter.h"
@@ -815,7 +816,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
[](InputSectionBase<ELFT> *S) {
if (!S->Live)
return;
- if (S->isCompressed())
+ if (Decompressor::isCompressedELFSection(S->Flags, S->Name))
S->uncompress();
if (auto *MS = dyn_cast<MergeInputSection<ELFT>>(S))
MS->splitIntoPieces();
diff --git a/ELF/Error.cpp b/ELF/Error.cpp
index 6e30f08143ed..d9b41f9c599e 100644
--- a/ELF/Error.cpp
+++ b/ELF/Error.cpp
@@ -103,4 +103,8 @@ void elf::fatal(std::error_code EC, const Twine &Prefix) {
fatal(Prefix + ": " + EC.message());
}
+void elf::fatal(Error &E, const Twine &Prefix) {
+ fatal(Prefix + ": " + llvm::toString(std::move(E)));
+}
+
} // namespace lld
diff --git a/ELF/Error.h b/ELF/Error.h
index 1ec683595cf4..f18cf456da6d 100644
--- a/ELF/Error.h
+++ b/ELF/Error.h
@@ -44,6 +44,7 @@ void error(std::error_code EC, const Twine &Prefix);
LLVM_ATTRIBUTE_NORETURN void exitLld(int Val);
LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &Msg);
LLVM_ATTRIBUTE_NORETURN void fatal(std::error_code EC, const Twine &Prefix);
+LLVM_ATTRIBUTE_NORETURN void fatal(Error &E, const Twine &Prefix);
// check() functions are convenient functions to strip errors
// from error-or-value objects.
@@ -55,11 +56,7 @@ template <class T> T check(ErrorOr<T> E) {
template <class T> T check(Expected<T> E) {
if (!E)
- handleAllErrors(std::move(E.takeError()),
- [](llvm::ErrorInfoBase &EIB) -> Error {
- fatal(EIB.message());
- return Error::success();
- });
+ fatal(llvm::toString(E.takeError()));
return std::move(*E);
}
diff --git a/ELF/InputFiles.cpp b/ELF/InputFiles.cpp
index 1fddf40f5b22..f3afb1c34562 100644
--- a/ELF/InputFiles.cpp
+++ b/ELF/InputFiles.cpp
@@ -857,8 +857,8 @@ template <class ELFT> void BinaryFile::parse() {
StringRef EndName = Saver.save(Twine(Filename) + "_end");
StringRef SizeName = Saver.save(Twine(Filename) + "_size");
- auto *Section =
- make<InputSection<ELFT>>(SHF_ALLOC, SHT_PROGBITS, 8, Data, ".data");
+ auto *Section = make<InputSection<ELFT>>(SHF_ALLOC | SHF_WRITE, SHT_PROGBITS,
+ 8, Data, ".data");
Sections.push_back(Section);
elf::Symtab<ELFT>::X->addRegular(StartName, STV_DEFAULT, STT_OBJECT, 0, 0,
diff --git a/ELF/InputSection.cpp b/ELF/InputSection.cpp
index e87d92aa207c..358004248373 100644
--- a/ELF/InputSection.cpp
+++ b/ELF/InputSection.cpp
@@ -19,6 +19,7 @@
#include "SyntheticSections.h"
#include "Target.h"
#include "Thunks.h"
+#include "llvm/Object/Decompressor.h"
#include "llvm/Support/Compression.h"
#include "llvm/Support/Endian.h"
#include <mutex>
@@ -35,7 +36,10 @@ using namespace lld::elf;
// Returns a string to construct an error message.
template <class ELFT>
std::string lld::toString(const InputSectionBase<ELFT> *Sec) {
- return (Sec->getFile()->getName() + ":(" + Sec->Name + ")").str();
+ // File can be absent if section is synthetic.
+ std::string FileName =
+ Sec->getFile() ? Sec->getFile()->getName() : "<internal>";
+ return (FileName + ":(" + Sec->Name + ")").str();
}
template <class ELFT>
@@ -102,11 +106,6 @@ template <class ELFT> size_t InputSectionBase<ELFT>::getSize() const {
return Data.size();
}
-// Returns a string for an error message.
-template <class SectionT> static std::string getName(SectionT *Sec) {
- return (Sec->getFile()->getName() + ":(" + Sec->Name + ")").str();
-}
-
template <class ELFT>
typename ELFT::uint InputSectionBase<ELFT>::getOffset(uintX_t Offset) const {
switch (kind()) {
@@ -128,71 +127,23 @@ typename ELFT::uint InputSectionBase<ELFT>::getOffset(uintX_t Offset) const {
llvm_unreachable("invalid section kind");
}
-template <class ELFT> bool InputSectionBase<ELFT>::isCompressed() const {
- return (Flags & SHF_COMPRESSED) || Name.startswith(".zdebug");
-}
-
-// Returns compressed data and its size when uncompressed.
-template <class ELFT>
-std::pair<ArrayRef<uint8_t>, uint64_t>
-InputSectionBase<ELFT>::getElfCompressedData(ArrayRef<uint8_t> Data) {
- // Compressed section with Elf_Chdr is the ELF standard.
- if (Data.size() < sizeof(Elf_Chdr))
- fatal(toString(this) + ": corrupted compressed section");
- auto *Hdr = reinterpret_cast<const Elf_Chdr *>(Data.data());
- if (Hdr->ch_type != ELFCOMPRESS_ZLIB)
- fatal(toString(this) + ": unsupported compression type");
- return {Data.slice(sizeof(*Hdr)), Hdr->ch_size};
-}
-
-// Returns compressed data and its size when uncompressed.
-template <class ELFT>
-std::pair<ArrayRef<uint8_t>, uint64_t>
-InputSectionBase<ELFT>::getRawCompressedData(ArrayRef<uint8_t> Data) {
- // Compressed sections without Elf_Chdr header contain this header
- // instead. This is a GNU extension.
- struct ZlibHeader {
- char Magic[4]; // Should be "ZLIB"
- char Size[8]; // Uncompressed size in big-endian
- };
-
- if (Data.size() < sizeof(ZlibHeader))
- fatal(toString(this) + ": corrupted compressed section");
- auto *Hdr = reinterpret_cast<const ZlibHeader *>(Data.data());
- if (memcmp(Hdr->Magic, "ZLIB", 4))
- fatal(toString(this) + ": broken ZLIB-compressed section");
- return {Data.slice(sizeof(*Hdr)), read64be(Hdr->Size)};
-}
-
// Uncompress section contents. Note that this function is called
// from parallel_for_each, so it must be thread-safe.
template <class ELFT> void InputSectionBase<ELFT>::uncompress() {
- if (!zlib::isAvailable())
- fatal(toString(this) +
- ": build lld with zlib to enable compressed sections support");
-
- // This section is compressed. Here we decompress it. Ideally, all
- // compressed sections have SHF_COMPRESSED bit and their contents
- // start with headers of Elf_Chdr type. However, sections whose
- // names start with ".zdebug_" don't have the bit and contains a raw
- // ZLIB-compressed data (which is a bad thing because section names
- // shouldn't be significant in ELF.) We need to be able to read both.
- ArrayRef<uint8_t> Buf; // Compressed data
- size_t Size; // Uncompressed size
- if (Flags & SHF_COMPRESSED)
- std::tie(Buf, Size) = getElfCompressedData(Data);
- else
- std::tie(Buf, Size) = getRawCompressedData(Data);
+ Decompressor Decompressor = check(Decompressor::create(
+ Name, toStringRef(Data), ELFT::TargetEndianness == llvm::support::little,
+ ELFT::Is64Bits));
- // Uncompress Buf.
+ size_t Size = Decompressor.getDecompressedSize();
char *OutputBuf;
{
static std::mutex Mu;
std::lock_guard<std::mutex> Lock(Mu);
OutputBuf = BAlloc.Allocate<char>(Size);
}
- if (zlib::uncompress(toStringRef(Buf), OutputBuf, Size) != zlib::StatusOK)
- fatal(toString(this) + ": error while uncompressing section");
+
+ if (Error E = Decompressor.decompress({OutputBuf, Size}))
+ fatal(E, toString(this));
Data = ArrayRef<uint8_t>((uint8_t *)OutputBuf, Size);
}
diff --git a/ELF/InputSection.h b/ELF/InputSection.h
index fc7a7fb60973..3f3a055dcc33 100644
--- a/ELF/InputSection.h
+++ b/ELF/InputSection.h
@@ -138,22 +138,12 @@ public:
// section.
uintX_t getOffset(uintX_t Offset) const;
- // ELF supports ZLIB-compressed section.
- // Returns true if the section is compressed.
- bool isCompressed() const;
void uncompress();
// Returns a source location string. Used to construct an error message.
std::string getLocation(uintX_t Offset);
void relocate(uint8_t *Buf, uint8_t *BufEnd);
-
-private:
- std::pair<ArrayRef<uint8_t>, uint64_t>
- getElfCompressedData(ArrayRef<uint8_t> Data);
-
- std::pair<ArrayRef<uint8_t>, uint64_t>
- getRawCompressedData(ArrayRef<uint8_t> Data);
};
// SectionPiece represents a piece of splittable section contents.
diff --git a/ELF/LinkerScript.cpp b/ELF/LinkerScript.cpp
index 59ef36c87de5..887ca12537ad 100644
--- a/ELF/LinkerScript.cpp
+++ b/ELF/LinkerScript.cpp
@@ -1014,6 +1014,7 @@ private:
void readAnonymousDeclaration();
void readVersionDeclaration(StringRef VerStr);
std::vector<SymbolVersion> readSymbols();
+ void readLocals();
ScriptConfiguration &Opt = *ScriptConfig;
bool IsUnderSysroot;
@@ -1861,17 +1862,22 @@ void ScriptParser::readAnonymousDeclaration() {
if (consume("global:") || peek() != "local:")
Config->VersionScriptGlobals = readSymbols();
- // Next, read local symbols.
- if (consume("local:")) {
- if (consume("*")) {
+ readLocals();
+ expect("}");
+ expect(";");
+}
+
+void ScriptParser::readLocals() {
+ if (!consume("local:"))
+ return;
+ std::vector<SymbolVersion> Locals = readSymbols();
+ for (SymbolVersion V : Locals) {
+ if (V.Name == "*") {
Config->DefaultSymbolVersion = VER_NDX_LOCAL;
- expect(";");
- } else {
- setError("local symbol list for anonymous version is not supported");
+ continue;
}
+ Config->VersionScriptLocals.push_back(V);
}
- expect("}");
- expect(";");
}
// Reads a list of symbols, e.g. "VerStr { global: foo; bar; local: *; };".
@@ -1885,16 +1891,7 @@ void ScriptParser::readVersionDeclaration(StringRef VerStr) {
if (consume("global:") || peek() != "local:")
Config->VersionDefinitions.back().Globals = readSymbols();
- // Read local symbols.
- if (consume("local:")) {
- if (consume("*")) {
- Config->DefaultSymbolVersion = VER_NDX_LOCAL;
- expect(";");
- } else {
- for (SymbolVersion V : readSymbols())
- Config->VersionScriptLocals.push_back(V);
- }
- }
+ readLocals();
expect("}");
// Each version may have a parent version. For example, "Ver2"
diff --git a/ELF/OutputSections.cpp b/ELF/OutputSections.cpp
index a9d951dcc745..7c708ce4ed67 100644
--- a/ELF/OutputSections.cpp
+++ b/ELF/OutputSections.cpp
@@ -636,7 +636,12 @@ OutputSectionFactory<ELFT>::create(const SectionKey &Key,
if (getIncompatibleFlags(Sec->Flags) != getIncompatibleFlags(C->Flags))
error("Section has flags incompatible with others with the same name " +
toString(C));
- if (Sec->Type != C->Type)
+ // Convert notbits to progbits if they are mixed. This happens is some
+ // linker scripts.
+ if (Sec->Type == SHT_NOBITS && C->Type == SHT_PROGBITS)
+ Sec->Type = SHT_PROGBITS;
+ if (Sec->Type != C->Type &&
+ !(Sec->Type == SHT_PROGBITS && C->Type == SHT_NOBITS))
error("Section has different type from others with the same name " +
toString(C));
Sec->Flags |= Flags;
diff --git a/ELF/OutputSections.h b/ELF/OutputSections.h
index 45e1a232e2a9..5c494bba977a 100644
--- a/ELF/OutputSections.h
+++ b/ELF/OutputSections.h
@@ -206,6 +206,7 @@ template <class ELFT> struct Out {
static uint8_t First;
static EhOutputSection<ELFT> *EhFrame;
static OutputSection<ELFT> *Bss;
+ static OutputSection<ELFT> *BssRelRo;
static OutputSectionBase *Opd;
static uint8_t *OpdBuf;
static PhdrEntry *TlsPhdr;
@@ -252,6 +253,7 @@ template <class ELFT> uint64_t getHeaderSize() {
template <class ELFT> uint8_t Out<ELFT>::First;
template <class ELFT> EhOutputSection<ELFT> *Out<ELFT>::EhFrame;
template <class ELFT> OutputSection<ELFT> *Out<ELFT>::Bss;
+template <class ELFT> OutputSection<ELFT> *Out<ELFT>::BssRelRo;
template <class ELFT> OutputSectionBase *Out<ELFT>::Opd;
template <class ELFT> uint8_t *Out<ELFT>::OpdBuf;
template <class ELFT> PhdrEntry *Out<ELFT>::TlsPhdr;
diff --git a/ELF/Relocations.cpp b/ELF/Relocations.cpp
index f7dcc5d24e93..cecd11e90790 100644
--- a/ELF/Relocations.cpp
+++ b/ELF/Relocations.cpp
@@ -399,7 +399,21 @@ template <class ELFT> static uint32_t getAlignment(SharedSymbol<ELFT> *SS) {
return 1 << TrailingZeros;
}
-// Reserve space in .bss for copy relocation.
+template <class ELFT> static bool isReadOnly(SharedSymbol<ELFT> *SS) {
+ typedef typename ELFT::uint uintX_t;
+ typedef typename ELFT::Phdr Elf_Phdr;
+
+ // Determine if the symbol is read-only by scanning the DSO's program headers.
+ uintX_t Value = SS->Sym.st_value;
+ for (const Elf_Phdr &Phdr : check(SS->file()->getObj().program_headers()))
+ if ((Phdr.p_type == ELF::PT_LOAD || Phdr.p_type == ELF::PT_GNU_RELRO) &&
+ !(Phdr.p_flags & ELF::PF_W) && Value >= Phdr.p_vaddr &&
+ Value < Phdr.p_vaddr + Phdr.p_memsz)
+ return true;
+ return false;
+}
+
+// Reserve space in .bss or .bss.rel.ro for copy relocation.
template <class ELFT> static void addCopyRelSymbol(SharedSymbol<ELFT> *SS) {
typedef typename ELFT::uint uintX_t;
typedef typename ELFT::Sym Elf_Sym;
@@ -409,10 +423,16 @@ template <class ELFT> static void addCopyRelSymbol(SharedSymbol<ELFT> *SS) {
if (SymSize == 0)
fatal("cannot create a copy relocation for symbol " + toString(*SS));
+ // See if this symbol is in a read-only segment. If so, preserve the symbol's
+ // memory protection by reserving space in the .bss.rel.ro section.
+ bool IsReadOnly = isReadOnly(SS);
+ OutputSection<ELFT> *CopySec =
+ IsReadOnly ? Out<ELFT>::BssRelRo : Out<ELFT>::Bss;
+
uintX_t Alignment = getAlignment(SS);
- uintX_t Off = alignTo(Out<ELFT>::Bss->Size, Alignment);
- Out<ELFT>::Bss->Size = Off + SymSize;
- Out<ELFT>::Bss->updateAlignment(Alignment);
+ uintX_t Off = alignTo(CopySec->Size, Alignment);
+ CopySec->Size = Off + SymSize;
+ CopySec->updateAlignment(Alignment);
uintX_t Shndx = SS->Sym.st_shndx;
uintX_t Value = SS->Sym.st_value;
// Look through the DSO's dynamic symbol table for aliases and create a
@@ -425,12 +445,12 @@ template <class ELFT> static void addCopyRelSymbol(SharedSymbol<ELFT> *SS) {
Symtab<ELFT>::X->find(check(S.getName(SS->file()->getStringTable()))));
if (!Alias)
continue;
- Alias->OffsetInBss = Off;
+ Alias->CopyIsInBssRelRo = IsReadOnly;
+ Alias->CopyOffset = Off;
Alias->NeedsCopyOrPltAddr = true;
Alias->symbol()->IsUsedInRegularObj = true;
}
- In<ELFT>::RelaDyn->addReloc(
- {Target->CopyRel, Out<ELFT>::Bss, SS->OffsetInBss, false, SS, 0});
+ In<ELFT>::RelaDyn->addReloc({Target->CopyRel, CopySec, Off, false, SS, 0});
}
template <class ELFT>
diff --git a/ELF/SymbolTable.cpp b/ELF/SymbolTable.cpp
index f08fa6229c1a..6afe3dde9bab 100644
--- a/ELF/SymbolTable.cpp
+++ b/ELF/SymbolTable.cpp
@@ -605,19 +605,16 @@ SymbolTable<ELFT>::findAllByVersion(SymbolVersion Ver) {
// If there's only one anonymous version definition in a version
// script file, the script does not actually define any symbol version,
-// but just specifies symbols visibilities. We assume that the script was
-// in the form of { global: foo; bar; local *; }. So, local is default.
-// In this function, we make specified symbols global.
+// but just specifies symbols visibilities.
template <class ELFT> void SymbolTable<ELFT>::handleAnonymousVersion() {
- for (SymbolVersion &Ver : Config->VersionScriptGlobals) {
- if (Ver.HasWildcard) {
- for (SymbolBody *B : findAllByVersion(Ver))
- B->symbol()->VersionId = VER_NDX_GLOBAL;
- continue;
- }
- for (SymbolBody *B : findByVersion(Ver))
- B->symbol()->VersionId = VER_NDX_GLOBAL;
- }
+ for (SymbolVersion &Ver : Config->VersionScriptGlobals)
+ assignExactVersion(Ver, VER_NDX_GLOBAL, "global");
+ for (SymbolVersion &Ver : Config->VersionScriptGlobals)
+ assignWildcardVersion(Ver, VER_NDX_GLOBAL);
+ for (SymbolVersion &Ver : Config->VersionScriptLocals)
+ assignExactVersion(Ver, VER_NDX_LOCAL, "local");
+ for (SymbolVersion &Ver : Config->VersionScriptLocals)
+ assignWildcardVersion(Ver, VER_NDX_LOCAL);
}
// Set symbol versions to symbols. This function handles patterns
@@ -673,10 +670,7 @@ template <class ELFT> void SymbolTable<ELFT>::scanVersionScript() {
Sym->body()->parseSymbolVersion();
// Handle edge cases first.
- if (!Config->VersionScriptGlobals.empty()) {
- handleAnonymousVersion();
- return;
- }
+ handleAnonymousVersion();
if (Config->VersionDefinitions.empty())
return;
@@ -687,8 +681,6 @@ template <class ELFT> void SymbolTable<ELFT>::scanVersionScript() {
// First, we assign versions to exact matching symbols,
// i.e. version definitions not containing any glob meta-characters.
- for (SymbolVersion &Ver : Config->VersionScriptLocals)
- assignExactVersion(Ver, VER_NDX_LOCAL, "local");
for (VersionDefinition &V : Config->VersionDefinitions)
for (SymbolVersion &Ver : V.Globals)
assignExactVersion(Ver, V.Id, V.Name);
@@ -697,8 +689,6 @@ template <class ELFT> void SymbolTable<ELFT>::scanVersionScript() {
// i.e. version definitions containing glob meta-characters.
// Note that because the last match takes precedence over previous matches,
// we iterate over the definitions in the reverse order.
- for (SymbolVersion &Ver : Config->VersionScriptLocals)
- assignWildcardVersion(Ver, VER_NDX_LOCAL);
for (VersionDefinition &V : llvm::reverse(Config->VersionDefinitions))
for (SymbolVersion &Ver : V.Globals)
assignWildcardVersion(Ver, V.Id);
diff --git a/ELF/Symbols.cpp b/ELF/Symbols.cpp
index f3edafaf4b78..289bc18487a8 100644
--- a/ELF/Symbols.cpp
+++ b/ELF/Symbols.cpp
@@ -81,7 +81,7 @@ static typename ELFT::uint getSymVA(const SymbolBody &Body,
return 0;
if (SS.isFunc())
return Body.getPltVA<ELFT>();
- return Out<ELFT>::Bss->Addr + SS.OffsetInBss;
+ return SS.getBssSectionForCopy()->Addr + SS.CopyOffset;
}
case SymbolBody::UndefinedKind:
return 0;
@@ -97,7 +97,8 @@ SymbolBody::SymbolBody(Kind K, StringRefZ Name, bool IsLocal, uint8_t StOther,
uint8_t Type)
: SymbolKind(K), NeedsCopyOrPltAddr(false), IsLocal(IsLocal),
IsInGlobalMipsGot(false), Is32BitMipsGot(false), IsInIplt(false),
- IsInIgot(false), Type(Type), StOther(StOther), Name(Name) {}
+ IsInIgot(false), CopyIsInBssRelRo(false), Type(Type), StOther(StOther),
+ Name(Name) {}
// Returns true if a symbol can be replaced at load-time by a symbol
// with the same name defined in other ELF executable or DSO.
@@ -245,6 +246,12 @@ Undefined<ELFT>::Undefined(StringRefZ Name, bool IsLocal, uint8_t StOther,
this->File = File;
}
+template <typename ELFT>
+OutputSection<ELFT> *SharedSymbol<ELFT>::getBssSectionForCopy() const {
+ assert(needsCopy());
+ return CopyIsInBssRelRo ? Out<ELFT>::BssRelRo : Out<ELFT>::Bss;
+}
+
DefinedCommon::DefinedCommon(StringRef Name, uint64_t Size, uint64_t Alignment,
uint8_t StOther, uint8_t Type, InputFile *File)
: Defined(SymbolBody::DefinedCommonKind, Name, /*IsLocal=*/false, StOther,
@@ -287,10 +294,22 @@ InputFile *LazyObject::fetch() {
return createObjectFile(MBRef);
}
-bool Symbol::includeInDynsym() const {
+uint8_t Symbol::computeBinding() const {
+ if (Config->Relocatable)
+ return Binding;
if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED)
+ return STB_LOCAL;
+ if (VersionId == VER_NDX_LOCAL && !body()->isUndefined())
+ return STB_LOCAL;
+ if (Config->NoGnuUnique && Binding == STB_GNU_UNIQUE)
+ return STB_GLOBAL;
+ return Binding;
+}
+
+bool Symbol::includeInDynsym() const {
+ if (computeBinding() == STB_LOCAL)
return false;
- return (ExportDynamic && VersionId != VER_NDX_LOCAL) || body()->isShared() ||
+ return ExportDynamic || body()->isShared() ||
(body()->isUndefined() && Config->Shared);
}
@@ -366,6 +385,11 @@ template class elf::Undefined<ELF32BE>;
template class elf::Undefined<ELF64LE>;
template class elf::Undefined<ELF64BE>;
+template class elf::SharedSymbol<ELF32LE>;
+template class elf::SharedSymbol<ELF32BE>;
+template class elf::SharedSymbol<ELF64LE>;
+template class elf::SharedSymbol<ELF64BE>;
+
template class elf::DefinedRegular<ELF32LE>;
template class elf::DefinedRegular<ELF32BE>;
template class elf::DefinedRegular<ELF64LE>;
diff --git a/ELF/Symbols.h b/ELF/Symbols.h
index 38889571679c..af85dc2b121d 100644
--- a/ELF/Symbols.h
+++ b/ELF/Symbols.h
@@ -123,6 +123,11 @@ public:
// True if this symbol is in the Igot sub-section of the .got.plt or .got.
unsigned IsInIgot : 1;
+ // True if this is a shared symbol in a read-only segment which requires a
+ // copy relocation. This causes space for the symbol to be allocated in the
+ // .bss.rel.ro section.
+ unsigned CopyIsInBssRelRo : 1;
+
// The following fields have the same meaning as the ELF symbol attributes.
uint8_t Type; // symbol type
uint8_t StOther; // st_other field value
@@ -282,13 +287,15 @@ public:
// This field is a pointer to the symbol's version definition.
const Elf_Verdef *Verdef;
- // OffsetInBss is significant only when needsCopy() is true.
- uintX_t OffsetInBss = 0;
+ // CopyOffset is significant only when needsCopy() is true.
+ uintX_t CopyOffset = 0;
// If non-null the symbol has a Thunk that may be used as an alternative
// destination for callers of this Symbol.
Thunk<ELFT> *ThunkData = nullptr;
bool needsCopy() const { return this->NeedsCopyOrPltAddr && !this->isFunc(); }
+
+ OutputSection<ELFT> *getBssSectionForCopy() const;
};
// This class represents a symbol defined in an archive file. It is
@@ -413,6 +420,7 @@ struct Symbol {
unsigned InVersionScript : 1;
bool includeInDynsym() const;
+ uint8_t computeBinding() const;
bool isWeak() const { return Binding == llvm::ELF::STB_WEAK; }
// This field is used to store the Symbol's SymbolBody. This instantiation of
diff --git a/ELF/SyntheticSections.cpp b/ELF/SyntheticSections.cpp
index 3c8a439ba308..5486b38eec10 100644
--- a/ELF/SyntheticSections.cpp
+++ b/ELF/SyntheticSections.cpp
@@ -1060,18 +1060,6 @@ static bool sortMipsSymbols(const SymbolBody *L, const SymbolBody *R) {
return L->GotIndex < R->GotIndex;
}
-static uint8_t getSymbolBinding(SymbolBody *Body) {
- Symbol *S = Body->symbol();
- if (Config->Relocatable)
- return S->Binding;
- uint8_t Visibility = S->Visibility;
- if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED)
- return STB_LOCAL;
- if (Config->NoGnuUnique && S->Binding == STB_GNU_UNIQUE)
- return STB_GLOBAL;
- return S->Binding;
-}
-
template <class ELFT> void SymbolTableSection<ELFT>::finalize() {
this->OutSec->Link = this->Link = StrTabSec.OutSec->SectionIndex;
this->OutSec->Info = this->Info = NumLocals + 1;
@@ -1085,11 +1073,12 @@ template <class ELFT> void SymbolTableSection<ELFT>::finalize() {
}
if (!StrTabSec.isDynamic()) {
- std::stable_sort(Symbols.begin(), Symbols.end(),
- [](const SymbolTableEntry &L, const SymbolTableEntry &R) {
- return getSymbolBinding(L.Symbol) == STB_LOCAL &&
- getSymbolBinding(R.Symbol) != STB_LOCAL;
- });
+ std::stable_sort(
+ Symbols.begin(), Symbols.end(),
+ [](const SymbolTableEntry &L, const SymbolTableEntry &R) {
+ return L.Symbol->symbol()->computeBinding() == STB_LOCAL &&
+ R.Symbol->symbol()->computeBinding() != STB_LOCAL;
+ });
return;
}
if (In<ELFT>::GnuHashTab)
@@ -1159,7 +1148,7 @@ void SymbolTableSection<ELFT>::writeGlobalSymbols(uint8_t *Buf) {
uint8_t Type = Body->Type;
uintX_t Size = Body->getSize<ELFT>();
- ESym->setBindingAndType(getSymbolBinding(Body), Type);
+ ESym->setBindingAndType(Body->symbol()->computeBinding(), Type);
ESym->st_size = Size;
ESym->st_name = StrOff;
ESym->setVisibility(Body->symbol()->Visibility);
@@ -1201,10 +1190,12 @@ SymbolTableSection<ELFT>::getOutputSection(SymbolBody *Sym) {
}
case SymbolBody::DefinedCommonKind:
return In<ELFT>::Common->OutSec;
- case SymbolBody::SharedKind:
- if (cast<SharedSymbol<ELFT>>(Sym)->needsCopy())
- return Out<ELFT>::Bss;
+ case SymbolBody::SharedKind: {
+ auto &SS = cast<SharedSymbol<ELFT>>(*Sym);
+ if (SS.needsCopy())
+ return SS.getBssSectionForCopy();
break;
+ }
case SymbolBody::UndefinedKind:
case SymbolBody::LazyArchiveKind:
case SymbolBody::LazyObjectKind:
diff --git a/ELF/Target.cpp b/ELF/Target.cpp
index cb2b178fa849..55fcf1734d1f 100644
--- a/ELF/Target.cpp
+++ b/ELF/Target.cpp
@@ -356,7 +356,9 @@ X86TargetInfo::X86TargetInfo() {
RelExpr X86TargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const {
switch (Type) {
- default:
+ case R_386_16:
+ case R_386_32:
+ case R_386_TLS_LDO_32:
return R_ABS;
case R_386_TLS_GD:
return R_TLSGD;
@@ -381,6 +383,12 @@ RelExpr X86TargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const {
return R_TLS;
case R_386_TLS_LE_32:
return R_NEG_TLS;
+ case R_386_NONE:
+ return R_HINT;
+ default:
+ error("do not know how to handle relocation '" + toString(Type) + "' (" +
+ Twine(Type) + ")");
+ return R_HINT;
}
}
@@ -623,7 +631,11 @@ template <class ELFT>
RelExpr X86_64TargetInfo<ELFT>::getRelExpr(uint32_t Type,
const SymbolBody &S) const {
switch (Type) {
- default:
+ case R_X86_64_32:
+ case R_X86_64_32S:
+ case R_X86_64_64:
+ case R_X86_64_DTPOFF32:
+ case R_X86_64_DTPOFF64:
return R_ABS;
case R_X86_64_TPOFF32:
return R_TLS;
@@ -649,6 +661,10 @@ RelExpr X86_64TargetInfo<ELFT>::getRelExpr(uint32_t Type,
return R_GOT_PC;
case R_X86_64_NONE:
return R_HINT;
+ default:
+ error("do not know how to handle relocation '" + toString(Type) + "' (" +
+ Twine(Type) + ")");
+ return R_HINT;
}
}
@@ -870,7 +886,7 @@ void X86_64TargetInfo<ELFT>::relocateOne(uint8_t *Loc, uint32_t Type,
write64le(Loc, Val);
break;
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type));
+ llvm_unreachable("unexpected relocation");
}
}
diff --git a/ELF/Writer.cpp b/ELF/Writer.cpp
index 154de8cf6d18..bddc42e1acf9 100644
--- a/ELF/Writer.cpp
+++ b/ELF/Writer.cpp
@@ -250,6 +250,8 @@ template <class ELFT> void Writer<ELFT>::createSyntheticSections() {
// Create singleton output sections.
Out<ELFT>::Bss =
make<OutputSection<ELFT>>(".bss", SHT_NOBITS, SHF_ALLOC | SHF_WRITE);
+ Out<ELFT>::BssRelRo = make<OutputSection<ELFT>>(".bss.rel.ro", SHT_NOBITS,
+ SHF_ALLOC | SHF_WRITE);
In<ELFT>::DynStrTab = make<StringTableSection<ELFT>>(".dynstr", true);
In<ELFT>::Dynamic = make<DynamicSection<ELFT>>();
Out<ELFT>::EhFrame = make<EhOutputSection<ELFT>>();
@@ -498,6 +500,8 @@ template <class ELFT> bool elf::isRelroSection(const OutputSectionBase *Sec) {
return true;
if (In<ELFT>::MipsGot && Sec == In<ELFT>::MipsGot->OutSec)
return true;
+ if (Sec == Out<ELFT>::BssRelRo)
+ return true;
StringRef S = Sec->getName();
return S == ".data.rel.ro" || S == ".ctors" || S == ".dtors" || S == ".jcr" ||
S == ".eh_frame" || S == ".openbsd.randomdata";
@@ -557,30 +561,38 @@ static bool compareSectionsNonScript(const OutputSectionBase *A,
// If we got here we know that both A and B are in the same PT_LOAD.
- // The TLS initialization block needs to be a single contiguous block in a R/W
- // PT_LOAD, so stick TLS sections directly before R/W sections. The TLS NOBITS
- // sections are placed here as they don't take up virtual address space in the
- // PT_LOAD.
bool AIsTls = A->Flags & SHF_TLS;
bool BIsTls = B->Flags & SHF_TLS;
- if (AIsTls != BIsTls)
- return AIsTls;
-
- // The next requirement we have is to put nobits sections last. The
- // reason is that the only thing the dynamic linker will see about
- // them is a p_memsz that is larger than p_filesz. Seeing that it
- // zeros the end of the PT_LOAD, so that has to correspond to the
- // nobits sections.
bool AIsNoBits = A->Type == SHT_NOBITS;
bool BIsNoBits = B->Type == SHT_NOBITS;
- if (AIsNoBits != BIsNoBits)
- return BIsNoBits;
- // We place RelRo section before plain r/w ones.
+ // The first requirement we have is to put (non-TLS) nobits sections last. The
+ // reason is that the only thing the dynamic linker will see about them is a
+ // p_memsz that is larger than p_filesz. Seeing that it zeros the end of the
+ // PT_LOAD, so that has to correspond to the nobits sections.
+ bool AIsNonTlsNoBits = AIsNoBits && !AIsTls;
+ bool BIsNonTlsNoBits = BIsNoBits && !BIsTls;
+ if (AIsNonTlsNoBits != BIsNonTlsNoBits)
+ return BIsNonTlsNoBits;
+
+ // We place nobits RelRo sections before plain r/w ones, and non-nobits RelRo
+ // sections after r/w ones, so that the RelRo sections are contiguous.
bool AIsRelRo = isRelroSection<ELFT>(A);
bool BIsRelRo = isRelroSection<ELFT>(B);
if (AIsRelRo != BIsRelRo)
- return AIsRelRo;
+ return AIsNonTlsNoBits ? AIsRelRo : BIsRelRo;
+
+ // The TLS initialization block needs to be a single contiguous block in a R/W
+ // PT_LOAD, so stick TLS sections directly before the other RelRo R/W
+ // sections. The TLS NOBITS sections are placed here as they don't take up
+ // virtual address space in the PT_LOAD.
+ if (AIsTls != BIsTls)
+ return AIsTls;
+
+ // Within the TLS initialization block, the non-nobits sections need to appear
+ // first.
+ if (AIsNoBits != BIsNoBits)
+ return BIsNoBits;
// Some architectures have additional ordering restrictions for sections
// within the same PT_LOAD.
@@ -1071,6 +1083,8 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
template <class ELFT> void Writer<ELFT>::addPredefinedSections() {
if (Out<ELFT>::Bss->Size > 0)
OutputSections.push_back(Out<ELFT>::Bss);
+ if (Out<ELFT>::BssRelRo->Size > 0)
+ OutputSections.push_back(Out<ELFT>::BssRelRo);
auto OS = dyn_cast_or_null<OutputSection<ELFT>>(findSection(".ARM.exidx"));
if (OS && !OS->Sections.empty() && !Config->Relocatable)
@@ -1272,8 +1286,9 @@ void Writer<ELFT>::addPtArmExid(std::vector<PhdrEntry> &Phdrs) {
Phdrs.push_back(ARMExidx);
}
-// The first section of each PT_LOAD and the first section after PT_GNU_RELRO
-// have to be page aligned so that the dynamic linker can set the permissions.
+// The first section of each PT_LOAD, the first section in PT_GNU_RELRO and the
+// first section after PT_GNU_RELRO have to be page aligned so that the dynamic
+// linker can set the permissions.
template <class ELFT> void Writer<ELFT>::fixSectionAlignments() {
for (const PhdrEntry &P : Phdrs)
if (P.p_type == PT_LOAD && P.First)
@@ -1282,6 +1297,8 @@ template <class ELFT> void Writer<ELFT>::fixSectionAlignments() {
for (const PhdrEntry &P : Phdrs) {
if (P.p_type != PT_GNU_RELRO)
continue;
+ if (P.First)
+ P.First->PageAlign = true;
// Find the first section after PT_GNU_RELRO. If it is in a PT_LOAD we
// have to align it to a page.
auto End = OutputSections.end();
@@ -1635,10 +1652,12 @@ static void unlinkAsync(StringRef Path) {
// Path as a new file. If we do that in a different thread, the new
// thread can remove the new file.
SmallString<128> TempPath;
- if (auto EC = sys::fs::createUniqueFile(Path + "tmp%%%%%%%%", TempPath))
- fatal(EC, "createUniqueFile failed");
- if (auto EC = sys::fs::rename(Path, TempPath))
- fatal(EC, "rename failed");
+ if (sys::fs::createUniqueFile(Path + "tmp%%%%%%%%", TempPath))
+ return;
+ if (sys::fs::rename(Path, TempPath)) {
+ sys::fs::remove(TempPath);
+ return;
+ }
// Remove TempPath in background.
std::thread([=] { ::remove(TempPath.str().str().c_str()); }).detach();
diff --git a/test/COFF/Inputs/pdb1.yaml b/test/COFF/Inputs/pdb1.yaml
new file mode 100644
index 000000000000..30ddbadd01ec
--- /dev/null
+++ b/test/COFF/Inputs/pdb1.yaml
@@ -0,0 +1,172 @@
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_AMD64
+ Characteristics: [ ]
+sections:
+ - Name: .drectve
+ Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
+ Alignment: 1
+ SectionData: 2020202F44454641554C544C49423A224C4942434D5422202F44454641554C544C49423A224F4C444E414D45532220
+ - Name: '.debug$S'
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
+ Alignment: 1
+ SectionData: 04000000F1000000580000001A00011100000000443A5C625C72657434322D6D61696E2E6F626A003A003C1100600000D00013000000F259000013000000F25900004D6963726F736F667420285229204F7074696D697A696E6720436F6D70696C657200F10000004E0000002A0047110000000000000000000000000E000000040000000900000005100000000000000000006D61696E001C001210280000000000000000000000000000000000000000000042110002004F110000F20000002000000000000000000000000E0000000000000001000000140000000000000002000080F400000018000000010000001001C538722F63570DF6705DDE06FE96E5D10000F30000001300000000643A5C625C72657434322D6D61696E2E630000F10000000800000006004C110E100000
+ Relocations:
+ - VirtualAddress: 140
+ SymbolName: main
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 144
+ SymbolName: main
+ Type: IMAGE_REL_AMD64_SECTION
+ - VirtualAddress: 196
+ SymbolName: main
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 200
+ SymbolName: main
+ Type: IMAGE_REL_AMD64_SECTION
+ - Name: '.debug$T'
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
+ Alignment: 1
+ SectionData: 0400000006000112000000000E0008107400000000000000001000000A000210011000000C0001000A00011201000000000000000E0008107400000000000000031000001200011600000000041000006D61696E00F3F2F10E0001160000000001100000666F6F000E00051600000000443A5C6200F3F2F12200051600000000433A5C767331345C56435C42494E5C616D6436345C636C2E6578650002010516000000002D5A37202D63202D4D54202D49433A5C767331345C56435C494E434C554445202D49433A5C767331345C56435C41544C4D46435C494E434C554445202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C31305C696E636C7564655C31302E302E31303135302E305C7563727422202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C4E4554465853444B5C342E365C696E636C7564655C756D22202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C382E315C696E636C7564655C73686172656422000A0004160100000009100000820005160A100000202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C382E315C696E636C7564655C756D22202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C382E315C696E636C7564655C77696E727422202D5443202D5800F3F2F1160005160000000072657434322D6D61696E2E6300F3F2F11600051600000000443A5C625C76633134302E70646200F11A000316050007100000081000000C1000000D1000000B100000F2F1
+ - Name: '.text$mn'
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 16
+ SectionData: 4883EC28E8000000004883C428C3
+ Relocations:
+ - VirtualAddress: 5
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_REL32
+ - Name: .xdata
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: '0104010004420000'
+ - Name: .pdata
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: '000000000E00000000000000'
+ Relocations:
+ - VirtualAddress: 0
+ SymbolName: '$LN3'
+ Type: IMAGE_REL_AMD64_ADDR32NB
+ - VirtualAddress: 4
+ SymbolName: '$LN3'
+ Type: IMAGE_REL_AMD64_ADDR32NB
+ - VirtualAddress: 8
+ SymbolName: '$unwind$main'
+ Type: IMAGE_REL_AMD64_ADDR32NB
+symbols:
+ - Name: '@comp.id'
+ Value: 17062386
+ SectionNumber: -1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: '@feat.00'
+ Value: 2147484048
+ SectionNumber: -1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: .drectve
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 47
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: '.debug$S'
+ Value: 0
+ SectionNumber: 2
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 304
+ NumberOfRelocations: 4
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: '.debug$T'
+ Value: 0
+ SectionNumber: 3
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 636
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: '.text$mn'
+ Value: 0
+ SectionNumber: 4
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 14
+ NumberOfRelocations: 1
+ NumberOfLinenumbers: 0
+ CheckSum: 1682752513
+ Number: 0
+ - Name: foo
+ Value: 0
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: main
+ Value: 0
+ SectionNumber: 4
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: '$LN3'
+ Value: 0
+ SectionNumber: 4
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_LABEL
+ - Name: .xdata
+ Value: 0
+ SectionNumber: 5
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 8
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 264583633
+ Number: 0
+ - Name: '$unwind$main'
+ Value: 0
+ SectionNumber: 5
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: .pdata
+ Value: 0
+ SectionNumber: 6
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 12
+ NumberOfRelocations: 3
+ NumberOfLinenumbers: 0
+ CheckSum: 361370162
+ Number: 0
+ - Name: '$pdata$main'
+ Value: 0
+ SectionNumber: 6
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+...
diff --git a/test/COFF/Inputs/pdb2.yaml b/test/COFF/Inputs/pdb2.yaml
new file mode 100644
index 000000000000..7a446b40f4f7
--- /dev/null
+++ b/test/COFF/Inputs/pdb2.yaml
@@ -0,0 +1,102 @@
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_AMD64
+ Characteristics: [ ]
+sections:
+ - Name: .drectve
+ Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
+ Alignment: 1
+ SectionData: 2020202F44454641554C544C49423A224C4942434D5422202F44454641554C544C49423A224F4C444E414D45532220
+ - Name: '.debug$S'
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
+ Alignment: 1
+ SectionData: 04000000F1000000570000001900011100000000443A5C625C72657434322D7375622E6F626A003A003C1100600000D00013000000F259000013000000F25900004D6963726F736F667420285229204F7074696D697A696E6720436F6D70696C65720000F10000004D000000290047110000000000000000000000000600000000000000050000000210000000000000000000666F6F001C001210000000000000000000000000000000000000000000000042110002004F11000000F2000000200000000000000000000000060000000000000001000000140000000000000001000080F400000018000000010000001001EC2D89EFF5A1FEB6B74EE4D79074072F0000F30000001200000000643A5C625C72657434322D7375622E63000000F10000000800000006004C110A100000
+ Relocations:
+ - VirtualAddress: 140
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 144
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECTION
+ - VirtualAddress: 196
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 200
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECTION
+ - Name: '.debug$T'
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
+ Alignment: 1
+ SectionData: 0400000006000112000000000E0008107400000000000000001000000E0001160000000001100000666F6F000E00051600000000443A5C6200F3F2F12200051600000000433A5C767331345C56435C42494E5C616D6436345C636C2E6578650002010516000000002D5A37202D63202D4D54202D49433A5C767331345C56435C494E434C554445202D49433A5C767331345C56435C41544C4D46435C494E434C554445202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C31305C696E636C7564655C31302E302E31303135302E305C7563727422202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C4E4554465853444B5C342E365C696E636C7564655C756D22202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C382E315C696E636C7564655C73686172656422000A00041601000000051000008200051606100000202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C382E315C696E636C7564655C756D22202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C382E315C696E636C7564655C77696E727422202D5443202D5800F3F2F1120005160000000072657434322D7375622E63001600051600000000443A5C625C76633134302E70646200F11A00031605000310000004100000081000000910000007100000F2F1
+ - Name: '.text$mn'
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 16
+ SectionData: B82A000000C3
+symbols:
+ - Name: '@comp.id'
+ Value: 17062386
+ SectionNumber: -1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: '@feat.00'
+ Value: 2147484048
+ SectionNumber: -1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: .drectve
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 47
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: '.debug$S'
+ Value: 0
+ SectionNumber: 2
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 304
+ NumberOfRelocations: 4
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: '.debug$T'
+ Value: 0
+ SectionNumber: 3
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 572
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: '.text$mn'
+ Value: 0
+ SectionNumber: 4
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 6
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 2139436471
+ Number: 0
+ - Name: foo
+ Value: 0
+ SectionNumber: 4
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
diff --git a/test/COFF/dumppdb.test b/test/COFF/dumppdb.test
deleted file mode 100644
index 787ee2edbeda..000000000000
--- a/test/COFF/dumppdb.test
+++ /dev/null
@@ -1,181 +0,0 @@
-# RUN: yaml2obj %s > %t.obj
-# RUN: lld-link /debug /pdb:%t.pdb /dumppdb /dll /out:%t.dll /entry:main \
-# RUN: /nodefaultlib %t.obj | FileCheck %s
-
-# CHECK: ArgList (0x1000) {
-# CHECK-NEXT: TypeLeafKind: LF_ARGLIST (0x1201)
-# CHECK-NEXT: NumArgs: 1
-# CHECK-NEXT: Arguments [
-# CHECK-NEXT: ArgType: 0x0
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: Procedure (0x1001) {
-# CHECK-NEXT: TypeLeafKind: LF_PROCEDURE (0x1008)
-# CHECK-NEXT: ReturnType: int (0x74)
-# CHECK-NEXT: CallingConvention: NearC (0x0)
-# CHECK-NEXT: FunctionOptions [ (0x0)
-# CHECK-NEXT: ]
-# CHECK-NEXT: NumParameters: 0
-# CHECK-NEXT: ArgListType: (<no type>) (0x1000)
-# CHECK-NEXT: }
-# CHECK-NEXT: FuncId (0x1002) {
-# CHECK-NEXT: TypeLeafKind: LF_FUNC_ID (0x1601)
-# CHECK-NEXT: ParentScope: 0x0
-# CHECK-NEXT: FunctionType: int (<no type>) (0x1001)
-# CHECK-NEXT: Name: main
-# CHECK-NEXT: }
-# CHECK-NEXT: StringId (0x1003) {
-# CHECK-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# CHECK-NEXT: Id: 0x0
-# CHECK-NEXT: StringData: D:\b
-# CHECK-NEXT: }
-# CHECK-NEXT: StringId (0x1004) {
-# CHECK-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# CHECK-NEXT: Id: 0x0
-# CHECK-NEXT: StringData: C:\vs14\VC\BIN\amd64\cl.exe
-# CHECK-NEXT: }
-# CHECK-NEXT: StringId (0x1005) {
-# CHECK-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# CHECK-NEXT: Id: 0x0
-# CHECK-NEXT: StringData: -Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared"
-# CHECK-NEXT: }
-# CHECK-NEXT: StringList (0x1006) {
-# CHECK-NEXT: TypeLeafKind: LF_SUBSTR_LIST (0x1604)
-# CHECK-NEXT: NumArgs: 1
-# CHECK-NEXT: Arguments [
-# CHECK-NEXT: ArgType: -Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" (0x1005)
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: StringId (0x1007) {
-# CHECK-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# CHECK-NEXT: Id: (-Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared") (0x1006)
-# CHECK-NEXT: StringData: -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X
-# CHECK-NEXT: }
-# CHECK-NEXT: StringId (0x1008) {
-# CHECK-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# CHECK-NEXT: Id: 0x0
-# CHECK-NEXT: StringData: ret42.c
-# CHECK-NEXT: }
-# CHECK-NEXT: StringId (0x1009) {
-# CHECK-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# CHECK-NEXT: Id: 0x0
-# CHECK-NEXT: StringData: D:\b\vc140.pdb
-# CHECK-NEXT: }
-# CHECK-NEXT: BuildInfo (0x100A) {
-# CHECK-NEXT: TypeLeafKind: LF_BUILDINFO (0x1603)
-# CHECK-NEXT: NumArgs: 5
-# CHECK-NEXT: Arguments [
-# CHECK-NEXT: ArgType: D:\b (0x1003)
-# CHECK-NEXT: ArgType: C:\vs14\VC\BIN\amd64\cl.exe (0x1004)
-# CHECK-NEXT: ArgType: ret42.c (0x1008)
-# CHECK-NEXT: ArgType: D:\b\vc140.pdb (0x1009)
-# CHECK-NEXT: ArgType: -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X (0x1007)
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: UnknownSym {
-# CHECK-NEXT: Kind: 0x0
-# CHECK-NEXT: Length: 6
-# CHECK-NEXT: }
-
---- !COFF
-header:
- Machine: IMAGE_FILE_MACHINE_AMD64
- Characteristics: [ ]
-sections:
- - Name: .drectve
- Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
- Alignment: 1
- SectionData: 2020202F44454641554C544C49423A224C4942434D5422202F44454641554C544C49423A224F4C444E414D45532220
- - Name: '.debug$S'
- Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
- Alignment: 1
- SectionData: 04000000F1000000530000001500011100000000443A5C625C72657434322E6F626A003A003C1100600000D00013000000F259000013000000F25900004D6963726F736F667420285229204F7074696D697A696E6720436F6D70696C65720000F10000004E0000002A00471100000000000000000000000006000000000000000500000002100000000000000000006D61696E001C001210000000000000000000000000000000000000000000000042110002004F110000F2000000200000000000000000000000060000000000000001000000140000000000000001000080F4000000180000000100000010010BFC79AA614B536E3D64B110330D1E580000F30000000E00000000643A5C625C72657434322E63000000F10000000800000006004C110A100000
- Relocations:
- - VirtualAddress: 136
- SymbolName: main
- Type: IMAGE_REL_AMD64_SECREL
- - VirtualAddress: 140
- SymbolName: main
- Type: IMAGE_REL_AMD64_SECTION
- - VirtualAddress: 192
- SymbolName: main
- Type: IMAGE_REL_AMD64_SECREL
- - VirtualAddress: 196
- SymbolName: main
- Type: IMAGE_REL_AMD64_SECTION
- - Name: '.debug$T'
- Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
- Alignment: 1
- SectionData: 040000000A00011201000000000000000E0008107400000000000000001000001200011600000000011000006D61696E00F3F2F10E00051600000000443A5C6200F3F2F12200051600000000433A5C767331345C56435C42494E5C616D6436345C636C2E6578650002010516000000002D5A37202D63202D4D54202D49433A5C767331345C56435C494E434C554445202D49433A5C767331345C56435C41544C4D46435C494E434C554445202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C31305C696E636C7564655C31302E302E31303135302E305C7563727422202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C4E4554465853444B5C342E365C696E636C7564655C756D22202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C382E315C696E636C7564655C73686172656422000A00041601000000051000008200051606100000202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C382E315C696E636C7564655C756D22202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C382E315C696E636C7564655C77696E727422202D5443202D5800F3F2F10E0005160000000072657434322E63001600051600000000443A5C625C76633134302E70646200F11A00031605000310000004100000081000000910000007100000F2F1
- - Name: '.text$mn'
- Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
- Alignment: 16
- SectionData: B82A000000C3
-symbols:
- - Name: '@comp.id'
- Value: 17062386
- SectionNumber: -1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- - Name: '@feat.00'
- Value: 2147484048
- SectionNumber: -1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- - Name: .drectve
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 47
- NumberOfRelocations: 0
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- - Name: '.debug$S'
- Value: 0
- SectionNumber: 2
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 296
- NumberOfRelocations: 4
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- - Name: '.debug$T'
- Value: 0
- SectionNumber: 3
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 576
- NumberOfRelocations: 0
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- - Name: '.text$mn'
- Value: 0
- SectionNumber: 4
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 6
- NumberOfRelocations: 0
- NumberOfLinenumbers: 0
- CheckSum: 2139436471
- Number: 0
- - Name: main
- Value: 0
- SectionNumber: 4
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_FUNCTION
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-...
diff --git a/test/COFF/pdb.test b/test/COFF/pdb.test
index b20a58938920..5939b825f9a2 100644
--- a/test/COFF/pdb.test
+++ b/test/COFF/pdb.test
@@ -1,16 +1,15 @@
-# RUN: yaml2obj %s > %t.obj
+# RUN: yaml2obj < %p/Inputs/pdb1.yaml > %t1.obj
+# RUN: yaml2obj < %p/Inputs/pdb2.yaml > %t2.obj
# RUN: lld-link /debug /pdb:%t.pdb /dll /out:%t.dll /entry:main /nodefaultlib \
-# RUN: /debugpdb %t.obj
+# RUN: /debugpdb %t1.obj %t2.obj
+
# RUN: llvm-pdbdump pdb2yaml -stream-metadata -stream-directory -pdb-stream \
# RUN: -dbi-stream -ipi-stream -tpi-stream %t.pdb | FileCheck %s
-# RUN: llvm-pdbdump raw -modules -section-map -section-headers -section-contribs \
-# RUN: -tpi-records %t.pdb | FileCheck -check-prefix RAW %s
-
# CHECK: MSF:
# CHECK-NEXT: SuperBlock:
# CHECK-NEXT: BlockSize: 4096
-# CHECK-NEXT: FreeBlockMap:
+# CHECK-NEXT: FreeBlockMap: 1
# CHECK-NEXT: NumBlocks: 10
# CHECK-NEXT: NumDirectoryBytes: 48
# CHECK-NEXT: Unknown1: 0
@@ -19,7 +18,7 @@
# CHECK-NEXT: DirectoryBlocks: [ 9 ]
# CHECK-NEXT: NumStreams: 6
# CHECK-NEXT: FileSize: 40960
-# CHECK-NEXT: StreamSizes: [ 0, 48, 628, 266, 56, 80 ]
+# CHECK-NEXT: StreamSizes: [ 0, 48, 736, 390, 56, 160 ]
# CHECK-NEXT: StreamMap:
# CHECK-NEXT: - Stream: [ ]
# CHECK-NEXT: - Stream: [ 5 ]
@@ -28,13 +27,8 @@
# CHECK-NEXT: - Stream: [ 8 ]
# CHECK-NEXT: - Stream: [ 4 ]
# CHECK-NEXT: PdbStream:
-# Ensure that the Guid matches the RSDS record:
-# PDBSignature: 0x53445352
-# PDBGUID (38 9A CC F2 14 A4 7F A2 6C F0 08 04 47 CF 5C 48)
-# PDBAge: 1
# CHECK-NEXT: Age: 1
-# Guid: '{389ACCF2-14A4-7FA2-6CF0-080447CF5C48}'
-# CHECK-NEXT: Guid: '{{.*}}'
+# CHECK-NEXT: Guid:
# CHECK-NEXT: Signature: 0
# CHECK-NEXT: Version: VC70
# CHECK-NEXT: NamedStreams:
@@ -51,7 +45,7 @@
# CHECK-NEXT: Records:
# CHECK-NEXT: - Kind: LF_ARGLIST
# CHECK-NEXT: ArgList:
-# CHECK-NEXT: ArgIndices: [ 0 ]
+# CHECK-NEXT: ArgIndices: [ ]
# CHECK-NEXT: - Kind: LF_PROCEDURE
# CHECK-NEXT: Procedure:
# CHECK-NEXT: ReturnType: 116
@@ -59,11 +53,30 @@
# CHECK-NEXT: Options: [ None ]
# CHECK-NEXT: ParameterCount: 0
# CHECK-NEXT: ArgumentList: 4096
+# CHECK-NEXT: - Kind: LF_POINTER
+# CHECK-NEXT: Pointer:
+# CHECK-NEXT: ReferentType: 4097
+# CHECK-NEXT: Attrs: 65548
+# CHECK-NEXT: - Kind: LF_ARGLIST
+# CHECK-NEXT: ArgList:
+# CHECK-NEXT: ArgIndices: [ 0 ]
+# CHECK-NEXT: - Kind: LF_PROCEDURE
+# CHECK-NEXT: Procedure:
+# CHECK-NEXT: ReturnType: 116
+# CHECK-NEXT: CallConv: NearC
+# CHECK-NEXT: Options: [ None ]
+# CHECK-NEXT: ParameterCount: 0
+# CHECK-NEXT: ArgumentList: 4099
# CHECK-NEXT: - Kind: LF_FUNC_ID
# CHECK-NEXT: FuncId:
# CHECK-NEXT: ParentScope: 0
-# CHECK-NEXT: FunctionType: 4097
+# CHECK-NEXT: FunctionType: 4100
# CHECK-NEXT: Name: main
+# CHECK-NEXT: - Kind: LF_FUNC_ID
+# CHECK-NEXT: FuncId:
+# CHECK-NEXT: ParentScope: 0
+# CHECK-NEXT: FunctionType: 4097
+# CHECK-NEXT: Name: foo
# CHECK-NEXT: - Kind: LF_STRING_ID
# CHECK-NEXT: StringId:
# CHECK-NEXT: Id: 0
@@ -78,34 +91,110 @@
# CHECK-NEXT: String: '-Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared"'
# CHECK-NEXT: - Kind: LF_SUBSTR_LIST
# CHECK-NEXT: ArgList:
-# CHECK-NEXT: ArgIndices: [ 4101 ]
+# CHECK-NEXT: ArgIndices: [ 4105 ]
# CHECK-NEXT: - Kind: LF_STRING_ID
# CHECK-NEXT: StringId:
-# CHECK-NEXT: Id: 4102
+# CHECK-NEXT: Id: 4106
# CHECK-NEXT: String: ' -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X'
# CHECK-NEXT: - Kind: LF_STRING_ID
# CHECK-NEXT: StringId:
# CHECK-NEXT: Id: 0
-# CHECK-NEXT: String: ret42.c
+# CHECK-NEXT: String: ret42-main.c
# CHECK-NEXT: - Kind: LF_STRING_ID
# CHECK-NEXT: StringId:
# CHECK-NEXT: Id: 0
# CHECK-NEXT: String: 'D:\b\vc140.pdb'
# CHECK-NEXT: - Kind: LF_BUILDINFO
# CHECK-NEXT: BuildInfo:
-# CHECK-NEXT: ArgIndices: [ 4099, 4100, 4104, 4105, 4103 ]
+# CHECK-NEXT: ArgIndices: [ 4103, 4104, 4108, 4109, 4107 ]
+# CHECK-NEXT: - Kind: LF_STRING_ID
+# CHECK-NEXT: StringId:
+# CHECK-NEXT: Id: 0
+# CHECK-NEXT: String: ret42-sub.c
+# CHECK-NEXT: - Kind: LF_BUILDINFO
+# CHECK-NEXT: BuildInfo:
+# CHECK-NEXT: ArgIndices: [ 4103, 4104, 4111, 4109, 4107 ]
# CHECK-NEXT: IpiStream:
# CHECK-NEXT: Version: VC80
# CHECK-NEXT: Records:
-# CHECK-NEXT: ...
-# RAW: Type Info Stream (TPI) {
+# RAW: FileHeaders {
+# RAW-NEXT: BlockSize: 4096
+# RAW-NEXT: FreeBlockMap: 1
+# RAW-NEXT: NumBlocks: 10
+# RAW-NEXT: NumDirectoryBytes: 48
+# RAW-NEXT: Unknown1: 0
+# RAW-NEXT: BlockMapAddr: 3
+# RAW-NEXT: NumDirectoryBlocks: 1
+# RAW-NEXT: DirectoryBlocks: [9]
+# RAW-NEXT: NumStreams: 6
+# RAW-NEXT: }
+# RAW-NEXT: Streams [
+# RAW-NEXT: Stream 0: [Old MSF Directory] (0 bytes)
+# RAW-NEXT: Stream 1: [PDB Stream] (48 bytes)
+# RAW-NEXT: Stream 2: [TPI Stream] (736 bytes)
+# RAW-NEXT: Stream 3: [DBI Stream] (390 bytes)
+# RAW-NEXT: Stream 4: [IPI Stream] (56 bytes)
+# RAW-NEXT: Stream 5: [Section Header Data] (160 bytes)
+# RAW-NEXT: ]
+# RAW-NEXT: Msf Free Pages: []
+# RAW-NEXT: Orphaned Pages: []
+# RAW-NEXT: Multiply Used Pages: []
+# RAW-NEXT: Use After Free Pages: []
+# RAW-NEXT: StreamBlocks [
+# RAW-NEXT: Stream 0: []
+# RAW-NEXT: Stream 1: [5]
+# RAW-NEXT: Stream 2: [7]
+# RAW-NEXT: Stream 3: [6]
+# RAW-NEXT: Stream 4: [8]
+# RAW-NEXT: Stream 5: [4]
+# RAW-NEXT: ]
+# RAW-NEXT: PDB Stream {
+# RAW-NEXT: Version: 20000404
+# RAW-NEXT: Signature: 0x0
+# RAW-NEXT: Age: 1
+# RAW-NEXT: Guid: {7EBCCC79-C488-0267-C898-06D7E94A8A10}
+# RAW-NEXT: }
+# RAW-NEXT: Type Info Stream (TPI) {
# RAW-NEXT: TPI Version: 20040203
-# RAW-NEXT: Record count: 11
+# RAW-NEXT: Record count: 17
# RAW-NEXT: Records [
# RAW-NEXT: {
# RAW-NEXT: ArgList (0x1000) {
# RAW-NEXT: TypeLeafKind: LF_ARGLIST (0x1201)
+# RAW-NEXT: NumArgs: 0
+# RAW-NEXT: Arguments [
+# RAW-NEXT: ]
+# RAW-NEXT: }
+# RAW-NEXT: }
+# RAW-NEXT: {
+# RAW-NEXT: Procedure (0x1001) {
+# RAW-NEXT: TypeLeafKind: LF_PROCEDURE (0x1008)
+# RAW-NEXT: ReturnType: int (0x74)
+# RAW-NEXT: CallingConvention: NearC (0x0)
+# RAW-NEXT: FunctionOptions [ (0x0)
+# RAW-NEXT: ]
+# RAW-NEXT: NumParameters: 0
+# RAW-NEXT: ArgListType: () (0x1000)
+# RAW-NEXT: }
+# RAW-NEXT: }
+# RAW-NEXT: {
+# RAW-NEXT: Pointer (0x1002) {
+# RAW-NEXT: TypeLeafKind: LF_POINTER (0x1002)
+# RAW-NEXT: PointeeType: int () (0x1001)
+# RAW-NEXT: PointerAttributes: 0x1000C
+# RAW-NEXT: PtrType: Near64 (0xC)
+# RAW-NEXT: PtrMode: Pointer (0x0)
+# RAW-NEXT: IsFlat: 0
+# RAW-NEXT: IsConst: 0
+# RAW-NEXT: IsVolatile: 0
+# RAW-NEXT: IsUnaligned: 0
+# RAW-NEXT: SizeOf: 8
+# RAW-NEXT: }
+# RAW-NEXT: }
+# RAW-NEXT: {
+# RAW-NEXT: ArgList (0x1003) {
+# RAW-NEXT: TypeLeafKind: LF_ARGLIST (0x1201)
# RAW-NEXT: NumArgs: 1
# RAW-NEXT: Arguments [
# RAW-NEXT: ArgType: 0x0
@@ -113,88 +202,136 @@
# RAW-NEXT: }
# RAW-NEXT: }
# RAW-NEXT: {
-# RAW-NEXT: Procedure (0x1001) {
+# RAW-NEXT: Procedure (0x1004) {
# RAW-NEXT: TypeLeafKind: LF_PROCEDURE (0x1008)
# RAW-NEXT: ReturnType: int (0x74)
# RAW-NEXT: CallingConvention: NearC (0x0)
# RAW-NEXT: FunctionOptions [ (0x0)
# RAW-NEXT: ]
# RAW-NEXT: NumParameters: 0
-# RAW-NEXT: ArgListType: (<no type>) (0x1000)
+# RAW-NEXT: ArgListType: (<no type>) (0x1003)
# RAW-NEXT: }
# RAW-NEXT: }
# RAW-NEXT: {
-# RAW-NEXT: FuncId (0x1002) {
+# RAW-NEXT: FuncId (0x1005) {
# RAW-NEXT: TypeLeafKind: LF_FUNC_ID (0x1601)
# RAW-NEXT: ParentScope: 0x0
-# RAW-NEXT: FunctionType: int (<no type>) (0x1001)
+# RAW-NEXT: FunctionType: int (<no type>) (0x1004)
# RAW-NEXT: Name: main
# RAW-NEXT: }
# RAW-NEXT: }
# RAW-NEXT: {
-# RAW-NEXT: StringId (0x1003) {
+# RAW-NEXT: FuncId (0x1006) {
+# RAW-NEXT: TypeLeafKind: LF_FUNC_ID (0x1601)
+# RAW-NEXT: ParentScope: 0x0
+# RAW-NEXT: FunctionType: int () (0x1001)
+# RAW-NEXT: Name: foo
+# RAW-NEXT: }
+# RAW-NEXT: }
+# RAW-NEXT: {
+# RAW-NEXT: StringId (0x1007) {
# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
# RAW-NEXT: Id: 0x0
# RAW-NEXT: StringData: D:\b
# RAW-NEXT: }
# RAW-NEXT: }
# RAW-NEXT: {
-# RAW-NEXT: StringId (0x1004) {
+# RAW-NEXT: StringId (0x1008) {
# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
# RAW-NEXT: Id: 0x0
# RAW-NEXT: StringData: C:\vs14\VC\BIN\amd64\cl.exe
# RAW-NEXT: }
# RAW-NEXT: }
# RAW-NEXT: {
-# RAW-NEXT: StringId (0x1005) {
+# RAW-NEXT: StringId (0x1009) {
# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
# RAW-NEXT: Id: 0x0
# RAW-NEXT: StringData: -Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared"
# RAW-NEXT: }
# RAW-NEXT: }
# RAW-NEXT: {
-# RAW-NEXT: StringList (0x1006) {
+# RAW-NEXT: StringList (0x100A) {
# RAW-NEXT: TypeLeafKind: LF_SUBSTR_LIST (0x1604)
# RAW-NEXT: NumArgs: 1
# RAW-NEXT: Arguments [
-# RAW-NEXT: ArgType: -Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" (0x1005)
+# RAW-NEXT: ArgType: -Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" (0x1009)
# RAW-NEXT: ]
# RAW-NEXT: }
# RAW-NEXT: }
# RAW-NEXT: {
-# RAW-NEXT: StringId (0x1007) {
+# RAW-NEXT: StringId (0x100B) {
# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# RAW-NEXT: Id: (-Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared") (0x1006)
+# RAW-NEXT: Id: (-Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared") (0x100A)
# RAW-NEXT: StringData: -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X
# RAW-NEXT: }
# RAW-NEXT: }
# RAW-NEXT: {
-# RAW-NEXT: StringId (0x1008) {
+# RAW-NEXT: StringId (0x100C) {
# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
# RAW-NEXT: Id: 0x0
-# RAW-NEXT: StringData: ret42.c
+# RAW-NEXT: StringData: ret42-main.c
# RAW-NEXT: }
# RAW-NEXT: }
# RAW-NEXT: {
-# RAW-NEXT: StringId (0x1009) {
+# RAW-NEXT: StringId (0x100D) {
# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
# RAW-NEXT: Id: 0x0
# RAW-NEXT: StringData: D:\b\vc140.pdb
# RAW-NEXT: }
# RAW-NEXT: }
# RAW-NEXT: {
-# RAW-NEXT: BuildInfo (0x100A) {
+# RAW-NEXT: BuildInfo (0x100E) {
# RAW-NEXT: TypeLeafKind: LF_BUILDINFO (0x1603)
# RAW-NEXT: NumArgs: 5
# RAW-NEXT: Arguments [
-# RAW-NEXT: ArgType: D:\b (0x1003)
-# RAW-NEXT: ArgType: C:\vs14\VC\BIN\amd64\cl.exe (0x1004)
-# RAW-NEXT: ArgType: ret42.c (0x1008)
-# RAW-NEXT: ArgType: D:\b\vc140.pdb (0x1009)
-# RAW-NEXT: ArgType: -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X (0x1007)
+# RAW-NEXT: ArgType: D:\b (0x1007)
+# RAW-NEXT: ArgType: C:\vs14\VC\BIN\amd64\cl.exe (0x1008)
+# RAW-NEXT: ArgType: ret42-main.c (0x100C)
+# RAW-NEXT: ArgType: D:\b\vc140.pdb (0x100D)
+# RAW-NEXT: ArgType: -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X (0x100B)
# RAW-NEXT: ]
# RAW-NEXT: }
# RAW-NEXT: }
+# RAW-NEXT: {
+# RAW-NEXT: StringId (0x100F) {
+# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
+# RAW-NEXT: Id: 0x0
+# RAW-NEXT: StringData: ret42-sub.c
+# RAW-NEXT: }
+# RAW-NEXT: }
+# RAW-NEXT: {
+# RAW-NEXT: BuildInfo (0x1010) {
+# RAW-NEXT: TypeLeafKind: LF_BUILDINFO (0x1603)
+# RAW-NEXT: NumArgs: 5
+# RAW-NEXT: Arguments [
+# RAW-NEXT: ArgType: D:\b (0x1007)
+# RAW-NEXT: ArgType: C:\vs14\VC\BIN\amd64\cl.exe (0x1008)
+# RAW-NEXT: ArgType: ret42-sub.c (0x100F)
+# RAW-NEXT: ArgType: D:\b\vc140.pdb (0x100D)
+# RAW-NEXT: ArgType: -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X (0x100B)
+# RAW-NEXT: ]
+# RAW-NEXT: }
+# RAW-NEXT: }
+# RAW-NEXT: Hash {
+# RAW-NEXT: Number of Hash Buckets: 4096
+# RAW-NEXT: Hash Key Size: 4
+# RAW-NEXT: Values: []
+# RAW-NEXT: Type Index Offsets: []
+# RAW-NEXT: Hash Adjustments: []
+# RAW-NEXT: }
+# RAW-NEXT: ]
+# RAW-NEXT: }
+# RAW-NEXT: Type Info Stream (IPI) {
+# RAW-NEXT: IPI Version: 20040203
+# RAW-NEXT: Record count: 0
+# RAW-NEXT: Records [
+# RAW-NEXT: Hash {
+# RAW-NEXT: Number of Hash Buckets: 4096
+# RAW-NEXT: Hash Key Size: 4
+# RAW-NEXT: Values: []
+# RAW-NEXT: Type Index Offsets: []
+# RAW-NEXT: Hash Adjustments: []
+# RAW-NEXT: }
# RAW-NEXT: ]
# RAW-NEXT: }
# RAW-NEXT: DBI Stream {
@@ -222,13 +359,64 @@
# RAW-NEXT: Symbol Byte Size: 0
# RAW-NEXT: Type Server Index: 0
# RAW-NEXT: Has EC Info: No
+# RAW-NEXT: 0 Contributing Source Files [
+# RAW-NEXT: ]
# RAW-NEXT: }
# RAW-NEXT: ]
# RAW-NEXT: }
# RAW-NEXT: Section Contributions [
# RAW-NEXT: Contribution {
# RAW-NEXT: ISect: 0
-# RAW-NEXT: Off: 1140
+# RAW-NEXT: Off: 1288
+# RAW-NEXT: Size: 14
+# RAW-NEXT: Characteristics [ (0x60500020)
+# RAW-NEXT: IMAGE_SCN_ALIGN_16BYTES (0x500000)
+# RAW-NEXT: IMAGE_SCN_CNT_CODE (0x20)
+# RAW-NEXT: IMAGE_SCN_MEM_EXECUTE (0x20000000)
+# RAW-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
+# RAW-NEXT: ]
+# RAW-NEXT: Module {
+# RAW-NEXT: Index: 0
+# RAW-NEXT: Name: * Linker *
+# RAW-NEXT: }
+# RAW-NEXT: Data CRC: 0
+# RAW-NEXT: Reloc CRC: 0
+# RAW-NEXT: }
+# RAW-NEXT: Contribution {
+# RAW-NEXT: ISect: 0
+# RAW-NEXT: Off: 1312
+# RAW-NEXT: Size: 8
+# RAW-NEXT: Characteristics [ (0x40300040)
+# RAW-NEXT: IMAGE_SCN_ALIGN_4BYTES (0x300000)
+# RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
+# RAW-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
+# RAW-NEXT: ]
+# RAW-NEXT: Module {
+# RAW-NEXT: Index: 0
+# RAW-NEXT: Name: * Linker *
+# RAW-NEXT: }
+# RAW-NEXT: Data CRC: 0
+# RAW-NEXT: Reloc CRC: 0
+# RAW-NEXT: }
+# RAW-NEXT: Contribution {
+# RAW-NEXT: ISect: 0
+# RAW-NEXT: Off: 1320
+# RAW-NEXT: Size: 12
+# RAW-NEXT: Characteristics [ (0x40300040)
+# RAW-NEXT: IMAGE_SCN_ALIGN_4BYTES (0x300000)
+# RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
+# RAW-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
+# RAW-NEXT: ]
+# RAW-NEXT: Module {
+# RAW-NEXT: Index: 0
+# RAW-NEXT: Name: * Linker *
+# RAW-NEXT: }
+# RAW-NEXT: Data CRC: 0
+# RAW-NEXT: Reloc CRC: 0
+# RAW-NEXT: }
+# RAW-NEXT: Contribution {
+# RAW-NEXT: ISect: 0
+# RAW-NEXT: Off: 1144
# RAW-NEXT: Size: 6
# RAW-NEXT: Characteristics [ (0x60500020)
# RAW-NEXT: IMAGE_SCN_ALIGN_16BYTES (0x500000)
@@ -246,6 +434,20 @@
# RAW-NEXT: ]
# RAW-NEXT: Section Map [
# RAW-NEXT: Entry {
+# RAW-NEXT: Flags [ (0x109)
+# RAW-NEXT: AddressIs32Bit (0x8)
+# RAW-NEXT: IsSelector (0x100)
+# RAW-NEXT: Read (0x1)
+# RAW-NEXT: ]
+# RAW-NEXT: Ovl: 0
+# RAW-NEXT: Group: 0
+# RAW-NEXT: Frame: 1
+# RAW-NEXT: SecName: 65535
+# RAW-NEXT: ClassName: 65535
+# RAW-NEXT: Offset: 0
+# RAW-NEXT: SecByteLength: 12
+# RAW-NEXT: }
+# RAW-NEXT: Entry {
# RAW-NEXT: Flags [ (0x10D)
# RAW-NEXT: AddressIs32Bit (0x8)
# RAW-NEXT: Execute (0x4)
@@ -254,11 +456,11 @@
# RAW-NEXT: ]
# RAW-NEXT: Ovl: 0
# RAW-NEXT: Group: 0
-# RAW-NEXT: Frame: 1
+# RAW-NEXT: Frame: 2
# RAW-NEXT: SecName: 65535
# RAW-NEXT: ClassName: 65535
# RAW-NEXT: Offset: 0
-# RAW-NEXT: SecByteLength: 6
+# RAW-NEXT: SecByteLength: 22
# RAW-NEXT: }
# RAW-NEXT: Entry {
# RAW-NEXT: Flags [ (0x109)
@@ -268,11 +470,25 @@
# RAW-NEXT: ]
# RAW-NEXT: Ovl: 0
# RAW-NEXT: Group: 0
-# RAW-NEXT: Frame: 2
+# RAW-NEXT: Frame: 3
# RAW-NEXT: SecName: 65535
# RAW-NEXT: ClassName: 65535
# RAW-NEXT: Offset: 0
-# RAW-NEXT: SecByteLength:
+# RAW-NEXT: SecByteLength: 8
+# RAW-NEXT: }
+# RAW-NEXT: Entry {
+# RAW-NEXT: Flags [ (0x109)
+# RAW-NEXT: AddressIs32Bit (0x8)
+# RAW-NEXT: IsSelector (0x100)
+# RAW-NEXT: Read (0x1)
+# RAW-NEXT: ]
+# RAW-NEXT: Ovl: 0
+# RAW-NEXT: Group: 0
+# RAW-NEXT: Frame: 4
+# RAW-NEXT: SecName: 65535
+# RAW-NEXT: ClassName: 65535
+# RAW-NEXT: Offset: 0
+# RAW-NEXT: SecByteLength: 101
# RAW-NEXT: }
# RAW-NEXT: Entry {
# RAW-NEXT: Flags [ (0x208)
@@ -281,20 +497,37 @@
# RAW-NEXT: ]
# RAW-NEXT: Ovl: 0
# RAW-NEXT: Group: 0
-# RAW-NEXT: Frame: 3
+# RAW-NEXT: Frame: 5
# RAW-NEXT: SecName: 65535
# RAW-NEXT: ClassName: 65535
# RAW-NEXT: Offset: 0
# RAW-NEXT: SecByteLength: 4294967295
# RAW-NEXT: }
# RAW-NEXT: ]
+# RAW-NEXT: Globals Stream not present
+# RAW-NEXT: Publics Stream not present
# RAW-NEXT: Section Headers [
# RAW-NEXT: {
-# RAW-NEXT: Name: .text
-# RAW-NEXT: Virtual Size: 6
+# RAW-NEXT: Name: .pdata
+# RAW-NEXT: Virtual Size: 12
# RAW-NEXT: Virtual Address: 4096
# RAW-NEXT: Size of Raw Data: 512
-# RAW-NEXT: File Pointer to Raw Data: 512
+# RAW-NEXT: File Pointer to Raw Data: 1024
+# RAW-NEXT: File Pointer to Relocations: 0
+# RAW-NEXT: File Pointer to Linenumbers: 0
+# RAW-NEXT: Number of Relocations: 0
+# RAW-NEXT: Number of Linenumbers: 0
+# RAW-NEXT: Characteristics [ (0x40000040)
+# RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
+# RAW-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
+# RAW-NEXT: ]
+# RAW-NEXT: }
+# RAW-NEXT: {
+# RAW-NEXT: Name: .text
+# RAW-NEXT: Virtual Size: 22
+# RAW-NEXT: Virtual Address: 8192
+# RAW-NEXT: Size of Raw Data: 512
+# RAW-NEXT: File Pointer to Raw Data: 1536
# RAW-NEXT: File Pointer to Relocations: 0
# RAW-NEXT: File Pointer to Linenumbers: 0
# RAW-NEXT: Number of Relocations: 0
@@ -306,11 +539,26 @@
# RAW-NEXT: ]
# RAW-NEXT: }
# RAW-NEXT: {
+# RAW-NEXT: Name: .xdata
+# RAW-NEXT: Virtual Size: 8
+# RAW-NEXT: Virtual Address: 12288
+# RAW-NEXT: Size of Raw Data: 512
+# RAW-NEXT: File Pointer to Raw Data: 2048
+# RAW-NEXT: File Pointer to Relocations: 0
+# RAW-NEXT: File Pointer to Linenumbers: 0
+# RAW-NEXT: Number of Relocations: 0
+# RAW-NEXT: Number of Linenumbers: 0
+# RAW-NEXT: Characteristics [ (0x40000040)
+# RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
+# RAW-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
+# RAW-NEXT: ]
+# RAW-NEXT: }
+# RAW-NEXT: {
# RAW-NEXT: Name: .rdata
-# RAW-NEXT: Virtual Size:
-# RAW-NEXT: Virtual Address: 8192
+# RAW-NEXT: Virtual Size: 101
+# RAW-NEXT: Virtual Address: 16384
# RAW-NEXT: Size of Raw Data: 512
-# RAW-NEXT: File Pointer to Raw Data: 1024
+# RAW-NEXT: File Pointer to Raw Data: 2560
# RAW-NEXT: File Pointer to Relocations: 0
# RAW-NEXT: File Pointer to Linenumbers: 0
# RAW-NEXT: Number of Relocations: 0
@@ -321,106 +569,5 @@
# RAW-NEXT: ]
# RAW-NEXT: }
# RAW-NEXT: ]
-
---- !COFF
-header:
- Machine: IMAGE_FILE_MACHINE_AMD64
- Characteristics: [ ]
-sections:
- - Name: .drectve
- Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
- Alignment: 1
- SectionData: 2020202F44454641554C544C49423A224C4942434D5422202F44454641554C544C49423A224F4C444E414D45532220
- - Name: '.debug$S'
- Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
- Alignment: 1
- SectionData: 04000000F1000000530000001500011100000000443A5C625C72657434322E6F626A003A003C1100600000D00013000000F259000013000000F25900004D6963726F736F667420285229204F7074696D697A696E6720436F6D70696C65720000F10000004E0000002A00471100000000000000000000000006000000000000000500000002100000000000000000006D61696E001C001210000000000000000000000000000000000000000000000042110002004F110000F2000000200000000000000000000000060000000000000001000000140000000000000001000080F4000000180000000100000010010BFC79AA614B536E3D64B110330D1E580000F30000000E00000000643A5C625C72657434322E63000000F10000000800000006004C110A100000
- Relocations:
- - VirtualAddress: 136
- SymbolName: main
- Type: IMAGE_REL_AMD64_SECREL
- - VirtualAddress: 140
- SymbolName: main
- Type: IMAGE_REL_AMD64_SECTION
- - VirtualAddress: 192
- SymbolName: main
- Type: IMAGE_REL_AMD64_SECREL
- - VirtualAddress: 196
- SymbolName: main
- Type: IMAGE_REL_AMD64_SECTION
- - Name: '.debug$T'
- Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
- Alignment: 1
- SectionData: 040000000A00011201000000000000000E0008107400000000000000001000001200011600000000011000006D61696E00F3F2F10E00051600000000443A5C6200F3F2F12200051600000000433A5C767331345C56435C42494E5C616D6436345C636C2E6578650002010516000000002D5A37202D63202D4D54202D49433A5C767331345C56435C494E434C554445202D49433A5C767331345C56435C41544C4D46435C494E434C554445202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C31305C696E636C7564655C31302E302E31303135302E305C7563727422202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C4E4554465853444B5C342E365C696E636C7564655C756D22202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C382E315C696E636C7564655C73686172656422000A00041601000000051000008200051606100000202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C382E315C696E636C7564655C756D22202D4922433A5C50726F6772616D2046696C65732028783836295C57696E646F7773204B6974735C382E315C696E636C7564655C77696E727422202D5443202D5800F3F2F10E0005160000000072657434322E63001600051600000000443A5C625C76633134302E70646200F11A00031605000310000004100000081000000910000007100000F2F1
- - Name: '.text$mn'
- Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
- Alignment: 16
- SectionData: B82A000000C3
-symbols:
- - Name: '@comp.id'
- Value: 17062386
- SectionNumber: -1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- - Name: '@feat.00'
- Value: 2147484048
- SectionNumber: -1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- - Name: .drectve
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 47
- NumberOfRelocations: 0
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- - Name: '.debug$S'
- Value: 0
- SectionNumber: 2
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 296
- NumberOfRelocations: 4
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- - Name: '.debug$T'
- Value: 0
- SectionNumber: 3
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 576
- NumberOfRelocations: 0
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- - Name: '.text$mn'
- Value: 0
- SectionNumber: 4
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 6
- NumberOfRelocations: 0
- NumberOfLinenumbers: 0
- CheckSum: 2139436471
- Number: 0
- - Name: main
- Value: 0
- SectionNumber: 4
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_FUNCTION
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-...
+# RAW-NEXT: New FPO [
+# RAW-NEXT: ]
diff --git a/test/ELF/Inputs/copy-rel-pie.s b/test/ELF/Inputs/copy-rel-pie.s
index 6cd681fcecb4..6dac01ddec62 100644
--- a/test/ELF/Inputs/copy-rel-pie.s
+++ b/test/ELF/Inputs/copy-rel-pie.s
@@ -1,9 +1,11 @@
+.data
.global foo
.type foo, @object
.size foo, 4
foo:
.long 0
+.text
.global bar
.type bar, @function
bar:
diff --git a/test/ELF/Inputs/relocation-copy-relro.s b/test/ELF/Inputs/relocation-copy-relro.s
new file mode 100644
index 000000000000..5f44e0ee7a83
--- /dev/null
+++ b/test/ELF/Inputs/relocation-copy-relro.s
@@ -0,0 +1,13 @@
+.rodata
+.globl a
+.size a, 4
+.type a, @object
+a:
+.word 1
+
+.section .data.rel.ro,"aw",%progbits
+.globl b
+.size b, 4
+.type b, @object
+b:
+.word 2
diff --git a/test/ELF/Inputs/unknown-reloc.s b/test/ELF/Inputs/unknown-reloc.s
new file mode 100644
index 000000000000..370ba33aaf7c
--- /dev/null
+++ b/test/ELF/Inputs/unknown-reloc.s
@@ -0,0 +1,2 @@
+.global und
+und:
diff --git a/test/ELF/aarch64-condb-reloc.s b/test/ELF/aarch64-condb-reloc.s
index b2af445f4b6d..23c16c2db898 100644
--- a/test/ELF/aarch64-condb-reloc.s
+++ b/test/ELF/aarch64-condb-reloc.s
@@ -36,8 +36,8 @@
#DSOREL-NEXT: SHF_ALLOC
#DSOREL-NEXT: SHF_WRITE
#DSOREL-NEXT: ]
-#DSOREL-NEXT: Address: 0x30000
-#DSOREL-NEXT: Offset: 0x30000
+#DSOREL-NEXT: Address: 0x20000
+#DSOREL-NEXT: Offset: 0x20000
#DSOREL-NEXT: Size: 48
#DSOREL-NEXT: Link: 0
#DSOREL-NEXT: Info: 0
@@ -46,9 +46,9 @@
#DSOREL-NEXT: }
#DSOREL: Relocations [
#DSOREL-NEXT: Section ({{.*}}) .rela.plt {
-#DSOREL-NEXT: 0x30018 R_AARCH64_JUMP_SLOT _foo
-#DSOREL-NEXT: 0x30020 R_AARCH64_JUMP_SLOT _bar
-#DSOREL-NEXT: 0x30028 R_AARCH64_JUMP_SLOT _dah
+#DSOREL-NEXT: 0x20018 R_AARCH64_JUMP_SLOT _foo
+#DSOREL-NEXT: 0x20020 R_AARCH64_JUMP_SLOT _bar
+#DSOREL-NEXT: 0x20028 R_AARCH64_JUMP_SLOT _dah
#DSOREL-NEXT: }
#DSOREL-NEXT:]
@@ -72,22 +72,22 @@
#DSO-NEXT: Disassembly of section .plt:
#DSO-NEXT: .plt:
#DSO-NEXT: 10030: {{.*}} stp x16, x30, [sp, #-16]!
-#DSO-NEXT: 10034: {{.*}} adrp x16, #131072
+#DSO-NEXT: 10034: {{.*}} adrp x16, #65536
#DSO-NEXT: 10038: {{.*}} ldr x17, [x16, #16]
#DSO-NEXT: 1003c: {{.*}} add x16, x16, #16
#DSO-NEXT: 10040: {{.*}} br x17
#DSO-NEXT: 10044: {{.*}} nop
#DSO-NEXT: 10048: {{.*}} nop
#DSO-NEXT: 1004c: {{.*}} nop
-#DSO-NEXT: 10050: {{.*}} adrp x16, #131072
+#DSO-NEXT: 10050: {{.*}} adrp x16, #65536
#DSO-NEXT: 10054: {{.*}} ldr x17, [x16, #24]
#DSO-NEXT: 10058: {{.*}} add x16, x16, #24
#DSO-NEXT: 1005c: {{.*}} br x17
-#DSO-NEXT: 10060: {{.*}} adrp x16, #131072
+#DSO-NEXT: 10060: {{.*}} adrp x16, #65536
#DSO-NEXT: 10064: {{.*}} ldr x17, [x16, #32]
#DSO-NEXT: 10068: {{.*}} add x16, x16, #32
#DSO-NEXT: 1006c: {{.*}} br x17
-#DSO-NEXT: 10070: {{.*}} adrp x16, #131072
+#DSO-NEXT: 10070: {{.*}} adrp x16, #65536
#DSO-NEXT: 10074: {{.*}} ldr x17, [x16, #40]
#DSO-NEXT: 10078: {{.*}} add x16, x16, #40
#DSO-NEXT: 1007c: {{.*}} br x17
diff --git a/test/ELF/aarch64-gnu-ifunc-plt.s b/test/ELF/aarch64-gnu-ifunc-plt.s
index 50e63f5257eb..be9a8a7e674a 100644
--- a/test/ELF/aarch64-gnu-ifunc-plt.s
+++ b/test/ELF/aarch64-gnu-ifunc-plt.s
@@ -10,19 +10,19 @@
// Check that the IRELATIVE relocations are after the JUMP_SLOT in the plt
// CHECK: Relocations [
// CHECK-NEXT: Section (4) .rela.plt {
-// CHECK: 0x40018 R_AARCH64_JUMP_SLOT bar2 0x0
-// CHECK-NEXT: 0x40020 R_AARCH64_JUMP_SLOT zed2 0x0
-// CHECK-NEXT: 0x40028 R_AARCH64_IRELATIVE - 0x20000
-// CHECK-NEXT: 0x40030 R_AARCH64_IRELATIVE - 0x20004
+// CHECK: 0x30018 R_AARCH64_JUMP_SLOT bar2 0x0
+// CHECK-NEXT: 0x30020 R_AARCH64_JUMP_SLOT zed2 0x0
+// CHECK-NEXT: 0x30028 R_AARCH64_IRELATIVE - 0x20000
+// CHECK-NEXT: 0x30030 R_AARCH64_IRELATIVE - 0x20004
// CHECK-NEXT: }
// CHECK-NEXT: ]
// Check that .got.plt entries point back to PLT header
// GOTPLT: Contents of section .got.plt:
-// GOTPLT-NEXT: 40000 00000000 00000000 00000000 00000000
-// GOTPLT-NEXT: 40010 00000000 00000000 20000200 00000000
-// GOTPLT-NEXT: 40020 20000200 00000000 20000200 00000000
-// GOTPLT-NEXT: 40030 20000200 00000000
+// GOTPLT-NEXT: 30000 00000000 00000000 00000000 00000000
+// GOTPLT-NEXT: 30010 00000000 00000000 20000200 00000000
+// GOTPLT-NEXT: 30020 20000200 00000000 20000200 00000000
+// GOTPLT-NEXT: 30030 20000200 00000000
// Check that the PLTRELSZ tag includes the IRELATIVE relocations
// CHECK: DynamicSection [
@@ -31,40 +31,40 @@
// Check that a PLT header is written and the ifunc entries appear last
// DISASM: Disassembly of section .text:
// DISASM-NEXT: foo:
-// DISASM-NEXT: 20000: c0 03 5f d6 ret
+// DISASM-NEXT: 20000: {{.*}} ret
// DISASM: bar:
-// DISASM-NEXT: 20004: c0 03 5f d6 ret
+// DISASM-NEXT: 20004: {{.*}} ret
// DISASM: _start:
-// DISASM-NEXT: 20008: 16 00 00 94 bl #88
-// DISASM-NEXT: 2000c: 19 00 00 94 bl #100
-// DISASM-NEXT: 20010: 0c 00 00 94 bl #48
-// DISASM-NEXT: 20014: 0f 00 00 94 bl #60
+// DISASM-NEXT: 20008: {{.*}} bl #88
+// DISASM-NEXT: 2000c: {{.*}} bl #100
+// DISASM-NEXT: 20010: {{.*}} bl #48
+// DISASM-NEXT: 20014: {{.*}} bl #60
// DISASM-NEXT: Disassembly of section .plt:
// DISASM-NEXT: .plt:
-// DISASM-NEXT: 20020: f0 7b bf a9 stp x16, x30, [sp, #-16]!
-// DISASM-NEXT: 20024: 10 01 00 90 adrp x16, #131072
-// DISASM-NEXT: 20028: 11 0a 40 f9 ldr x17, [x16, #16]
-// DISASM-NEXT: 2002c: 10 42 00 91 add x16, x16, #16
-// DISASM-NEXT: 20030: 20 02 1f d6 br x17
-// DISASM-NEXT: 20034: 1f 20 03 d5 nop
-// DISASM-NEXT: 20038: 1f 20 03 d5 nop
-// DISASM-NEXT: 2003c: 1f 20 03 d5 nop
-// DISASM-NEXT: 20040: 10 01 00 90 adrp x16, #131072
-// DISASM-NEXT: 20044: 11 0e 40 f9 ldr x17, [x16, #24]
-// DISASM-NEXT: 20048: 10 62 00 91 add x16, x16, #24
-// DISASM-NEXT: 2004c: 20 02 1f d6 br x17
-// DISASM-NEXT: 20050: 10 01 00 90 adrp x16, #131072
-// DISASM-NEXT: 20054: 11 12 40 f9 ldr x17, [x16, #32]
-// DISASM-NEXT: 20058: 10 82 00 91 add x16, x16, #32
-// DISASM-NEXT: 2005c: 20 02 1f d6 br x17
-// DISASM-NEXT: 20060: 10 01 00 90 adrp x16, #131072
-// DISASM-NEXT: 20064: 11 16 40 f9 ldr x17, [x16, #40]
-// DISASM-NEXT: 20068: 10 a2 00 91 add x16, x16, #40
-// DISASM-NEXT: 2006c: 20 02 1f d6 br x17
-// DISASM-NEXT: 20070: 10 01 00 90 adrp x16, #131072
-// DISASM-NEXT: 20074: 11 1a 40 f9 ldr x17, [x16, #48]
-// DISASM-NEXT: 20078: 10 c2 00 91 add x16, x16, #48
-// DISASM-NEXT: 2007c: 20 02 1f d6 br x17
+// DISASM-NEXT: 20020: {{.*}} stp x16, x30, [sp, #-16]!
+// DISASM-NEXT: 20024: {{.*}} adrp x16, #65536
+// DISASM-NEXT: 20028: {{.*}} ldr x17, [x16, #16]
+// DISASM-NEXT: 2002c: {{.*}} add x16, x16, #16
+// DISASM-NEXT: 20030: {{.*}} br x17
+// DISASM-NEXT: 20034: {{.*}} nop
+// DISASM-NEXT: 20038: {{.*}} nop
+// DISASM-NEXT: 2003c: {{.*}} nop
+// DISASM-NEXT: 20040: {{.*}} adrp x16, #65536
+// DISASM-NEXT: 20044: {{.*}} ldr x17, [x16, #24]
+// DISASM-NEXT: 20048: {{.*}} add x16, x16, #24
+// DISASM-NEXT: 2004c: {{.*}} br x17
+// DISASM-NEXT: 20050: {{.*}} adrp x16, #65536
+// DISASM-NEXT: 20054: {{.*}} ldr x17, [x16, #32]
+// DISASM-NEXT: 20058: {{.*}} add x16, x16, #32
+// DISASM-NEXT: 2005c: {{.*}} br x17
+// DISASM-NEXT: 20060: {{.*}} adrp x16, #65536
+// DISASM-NEXT: 20064: {{.*}} ldr x17, [x16, #40]
+// DISASM-NEXT: 20068: {{.*}} add x16, x16, #40
+// DISASM-NEXT: 2006c: {{.*}} br x17
+// DISASM-NEXT: 20070: {{.*}} adrp x16, #65536
+// DISASM-NEXT: 20074: {{.*}} ldr x17, [x16, #48]
+// DISASM-NEXT: 20078: {{.*}} add x16, x16, #48
+// DISASM-NEXT: 2007c: {{.*}} br x17
.text
.type foo STT_GNU_IFUNC
diff --git a/test/ELF/aarch64-tstbr14-reloc.s b/test/ELF/aarch64-tstbr14-reloc.s
index 6523a9c1cc9d..c0a0a543a6c5 100644
--- a/test/ELF/aarch64-tstbr14-reloc.s
+++ b/test/ELF/aarch64-tstbr14-reloc.s
@@ -35,8 +35,8 @@
#DSOREL-NEXT: SHF_ALLOC
#DSOREL-NEXT: SHF_WRITE
#DSOREL-NEXT: ]
-#DSOREL-NEXT: Address: 0x30000
-#DSOREL-NEXT: Offset: 0x30000
+#DSOREL-NEXT: Address: 0x20000
+#DSOREL-NEXT: Offset: 0x20000
#DSOREL-NEXT: Size: 40
#DSOREL-NEXT: Link: 0
#DSOREL-NEXT: Info: 0
@@ -45,8 +45,8 @@
#DSOREL-NEXT: }
#DSOREL: Relocations [
#DSOREL-NEXT: Section ({{.*}}) .rela.plt {
-#DSOREL-NEXT: 0x30018 R_AARCH64_JUMP_SLOT _foo
-#DSOREL-NEXT: 0x30020 R_AARCH64_JUMP_SLOT _bar
+#DSOREL-NEXT: 0x20018 R_AARCH64_JUMP_SLOT _foo
+#DSOREL-NEXT: 0x20020 R_AARCH64_JUMP_SLOT _bar
#DSOREL-NEXT: }
#DSOREL-NEXT:]
@@ -72,18 +72,18 @@
#DSO-NEXT: Disassembly of section .plt:
#DSO-NEXT: .plt:
#DSO-NEXT: 10030: {{.*}} stp x16, x30, [sp, #-16]!
-#DSO-NEXT: 10034: {{.*}} adrp x16, #131072
+#DSO-NEXT: 10034: {{.*}} adrp x16, #65536
#DSO-NEXT: 10038: {{.*}} ldr x17, [x16, #16]
#DSO-NEXT: 1003c: {{.*}} add x16, x16, #16
#DSO-NEXT: 10040: {{.*}} br x17
#DSO-NEXT: 10044: {{.*}} nop
#DSO-NEXT: 10048: {{.*}} nop
#DSO-NEXT: 1004c: {{.*}} nop
-#DSO-NEXT: 10050: {{.*}} adrp x16, #131072
+#DSO-NEXT: 10050: {{.*}} adrp x16, #65536
#DSO-NEXT: 10054: {{.*}} ldr x17, [x16, #24]
#DSO-NEXT: 10058: {{.*}} add x16, x16, #24
#DSO-NEXT: 1005c: {{.*}} br x17
-#DSO-NEXT: 10060: {{.*}} adrp x16, #131072
+#DSO-NEXT: 10060: {{.*}} adrp x16, #65536
#DSO-NEXT: 10064: {{.*}} ldr x17, [x16, #32]
#DSO-NEXT: 10068: {{.*}} add x16, x16, #32
#DSO-NEXT: 1006c: {{.*}} br x17
diff --git a/test/ELF/amdgpu-relocs.s b/test/ELF/amdgpu-relocs.s
index 965a812b14b9..1adb1faf20fd 100644
--- a/test/ELF/amdgpu-relocs.s
+++ b/test/ELF/amdgpu-relocs.s
@@ -89,5 +89,5 @@ ptr:
# CHECK-NEXT: ]
# OBJDUMP: Contents of section nonalloc:
-# OBJDUMP-NEXT: 0000 00000000 14380000 00000000 18340000
-# OBJDUMP-NEXT: 00000000 1c300000
+# OBJDUMP-NEXT: 0000 00000000 04480000 00000000 08440000
+# OBJDUMP-NEXT: 00000000 0c400000
diff --git a/test/ELF/arm-abs32-dyn.s b/test/ELF/arm-abs32-dyn.s
index 68183fe6f198..afdf573680cd 100644
--- a/test/ELF/arm-abs32-dyn.s
+++ b/test/ELF/arm-abs32-dyn.s
@@ -18,8 +18,8 @@ bar:
// RUN: llvm-readobj -symbols -dyn-relocations %t.so | FileCheck %s
// CHECK: Dynamic Relocations {
-// CHECK-NEXT: 0x2004 R_ARM_RELATIVE
-// CHECK-NEXT: 0x2000 R_ARM_ABS32 foo 0x0
+// CHECK-NEXT: 0x1004 R_ARM_RELATIVE
+// CHECK-NEXT: 0x1000 R_ARM_ABS32 foo 0x0
// CHECK-NEXT: }
// CHECK: Symbols [
diff --git a/test/ELF/arm-exidx-shared.s b/test/ELF/arm-exidx-shared.s
index 86b2d1fe00d8..13628405ed35 100644
--- a/test/ELF/arm-exidx-shared.s
+++ b/test/ELF/arm-exidx-shared.s
@@ -38,7 +38,7 @@ __aeabi_unwind_cpp_pr0:
// CHECK: Relocations [
// CHECK-NEXT: Section (6) .rel.plt {
-// CHECK-NEXT: 0x300C R_ARM_JUMP_SLOT __gxx_personality_v0
+// CHECK-NEXT: 0x200C R_ARM_JUMP_SLOT __gxx_personality_v0
// CHECK-EXTAB: Contents of section .ARM.extab.text.func2:
// 014c + 0ed8 = 0x1024 = __gxx_personality_v0(PLT)
diff --git a/test/ELF/arm-fpic-got.s b/test/ELF/arm-fpic-got.s
index 4b6002d3c077..a5f8152350cc 100644
--- a/test/ELF/arm-fpic-got.s
+++ b/test/ELF/arm-fpic-got.s
@@ -36,7 +36,7 @@ val:
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x12000
+// CHECK-NEXT: Address: 0x13000
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: 4
// CHECK-NEXT: Link:
@@ -45,7 +45,7 @@ val:
// CHECK-NEXT: EntrySize:
// SYMBOLS: Name: val
-// SYMBOLS-NEXT: Value: 0x13000
+// SYMBOLS-NEXT: Value: 0x12000
// SYMBOLS-NEXT: Size: 4
// SYMBOLS-NEXT: Binding: Global
// SYMBOLS-NEXT: Type: Object
@@ -59,5 +59,5 @@ val:
// CODE-NEXT: 11008: 00 00 90 e5 ldr r0, [r0]
// CODE-NEXT: 1100c: 1e ff 2f e1 bx lr
// CODE: $d.1:
-// 0x11004 + 0x0ff4 + 8 = 0x12000 = .got
-// CODE-NEXT: 11010: f4 0f 00 00
+// 0x11004 + 0x1ff4 + 8 = 0x13000 = .got
+// CODE-NEXT: 11010: f4 1f 00 00
diff --git a/test/ELF/arm-gnu-ifunc-plt.s b/test/ELF/arm-gnu-ifunc-plt.s
index 30ef66a3b775..cd1e8b740b3e 100644
--- a/test/ELF/arm-gnu-ifunc-plt.s
+++ b/test/ELF/arm-gnu-ifunc-plt.s
@@ -10,23 +10,23 @@
// Check that the IRELATIVE relocations are last in the .got
// CHECK: Relocations [
// CHECK-NEXT: Section (4) .rel.dyn {
-// CHECK-NEXT: 0x12078 R_ARM_GLOB_DAT bar2 0x0
-// CHECK-NEXT: 0x1207C R_ARM_GLOB_DAT zed2 0x0
-// CHECK-NEXT: 0x12080 R_ARM_IRELATIVE - 0x0
-// CHECK-NEXT: 0x12084 R_ARM_IRELATIVE - 0x0
+// CHECK-NEXT: 0x13078 R_ARM_GLOB_DAT bar2 0x0
+// CHECK-NEXT: 0x1307C R_ARM_GLOB_DAT zed2 0x0
+// CHECK-NEXT: 0x13080 R_ARM_IRELATIVE - 0x0
+// CHECK-NEXT: 0x13084 R_ARM_IRELATIVE - 0x0
// CHECK-NEXT: }
// CHECK-NEXT: Section (5) .rel.plt {
-// CHECK-NEXT: 0x1300C R_ARM_JUMP_SLOT bar2 0x0
-// CHECK-NEXT: 0x13010 R_ARM_JUMP_SLOT zed2 0x0
+// CHECK-NEXT: 0x1200C R_ARM_JUMP_SLOT bar2 0x0
+// CHECK-NEXT: 0x12010 R_ARM_JUMP_SLOT zed2 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
// Check that the GOT entries refer back to the ifunc resolver
+// GOTPLT: Contents of section .got.plt:
+// GOTPLT-NEXT: 12000 00000000 00000000 00000000 20100100
+// GOTPLT-NEXT: 12010 20100100
// GOTPLT: Contents of section .got:
-// GOTPLT-NEXT: 12078 00000000 00000000 00100100 04100100
-// GOTPLT-NEXT: Contents of section .got.plt:
-// GOTPLT-NEXT: 13000 00000000 00000000 00000000 20100100
-// GOTPLT-NEXT: 13010 20100100
+// GOTPLT-NEXT: 13078 00000000 00000000 00100100 04100100
// DISASM: Disassembly of section .text:
// DISASM-NEXT: foo:
@@ -46,15 +46,15 @@
// DISASM-NEXT: 11024: 04 e0 9f e5 ldr lr, [pc, #4]
// DISASM-NEXT: 11028: 0e e0 8f e0 add lr, pc, lr
// DISASM-NEXT: 1102c: 08 f0 be e5 ldr pc, [lr, #8]!
-// DISASM-NEXT: 11030: d0 1f 00 00
+// DISASM-NEXT: 11030: d0 0f 00 00
// DISASM-NEXT: 11034: 04 c0 9f e5 ldr r12, [pc, #4]
// DISASM-NEXT: 11038: 0f c0 8c e0 add r12, r12, pc
// DISASM-NEXT: 1103c: 00 f0 9c e5 ldr pc, [r12]
-// DISASM-NEXT: 11040: cc 1f 00 00
+// DISASM-NEXT: 11040: cc 0f 00 00
// DISASM-NEXT: 11044: 04 c0 9f e5 ldr r12, [pc, #4]
// DISASM-NEXT: 11048: 0f c0 8c e0 add r12, r12, pc
// DISASM-NEXT: 1104c: 00 f0 9c e5 ldr pc, [r12]
-// DISASM-NEXT: 11050: c0 1f 00 00
+// DISASM-NEXT: 11050: c0 0f 00 00
// Alignment to 16 byte boundary not strictly necessary on ARM, but harmless
// DISASM-NEXT: 11054: 00 00 00 00 andeq r0, r0, r0
// DISASM-NEXT: 11058: 00 00 00 00 andeq r0, r0, r0
@@ -62,11 +62,11 @@
// DISASM-NEXT: 11060: 04 c0 9f e5 ldr r12, [pc, #4]
// DISASM-NEXT: 11064: 0f c0 8c e0 add r12, r12, pc
// DISASM-NEXT: 11068: 00 f0 9c e5 ldr pc, [r12]
-// DISASM-NEXT: 1106c: 14 10 00 00
+// DISASM-NEXT: 1106c: 14 20 00 00
// DISASM-NEXT: 11070: 04 c0 9f e5 ldr r12, [pc, #4]
// DISASM-NEXT: 11074: 0f c0 8c e0 add r12, r12, pc
// DISASM-NEXT: 11078: 00 f0 9c e5 ldr pc, [r12]
-// DISASM-NEXT: 1107c: 08 10 00 00
+// DISASM-NEXT: 1107c: 08 20 00 00
.syntax unified
diff --git a/test/ELF/arm-pie-relative.s b/test/ELF/arm-pie-relative.s
index 223fcca08a2c..f965c24f4fa6 100644
--- a/test/ELF/arm-pie-relative.s
+++ b/test/ELF/arm-pie-relative.s
@@ -19,7 +19,7 @@ sym:
// CHECK: Relocations [
// CHECK-NEXT: Section (4) .rel.dyn {
-// CHECK-NEXT: 0x2058 R_ARM_RELATIVE
+// CHECK-NEXT: 0x3058 R_ARM_RELATIVE
// GOT: Contents of section .got:
-// GOT-NEXT: 2058 00300000
+// GOT-NEXT: 3058 00200000
diff --git a/test/ELF/arm-plt-reloc.s b/test/ELF/arm-plt-reloc.s
index 0616aa7966a9..9d4ecbd6774f 100644
--- a/test/ELF/arm-plt-reloc.s
+++ b/test/ELF/arm-plt-reloc.s
@@ -52,23 +52,23 @@ _start:
// DSO-NEXT: 1024: 04 e0 9f e5 ldr lr, [pc, #4]
// DSO-NEXT: 1028: 0e e0 8f e0 add lr, pc, lr
// DSO-NEXT: 102c: 08 f0 be e5 ldr pc, [lr, #8]!
-// 0x1028 + 8 + 1fd0 = 0x3000
-// DSO-NEXT: 1030: d0 1f 00 00
+// 0x1028 + 8 + 0fd0 = 0x2000
+// DSO-NEXT: 1030: d0 0f 00 00
// DSO-NEXT: 1034: 04 c0 9f e5 ldr r12, [pc, #4]
// DSO-NEXT: 1038: 0f c0 8c e0 add r12, r12, pc
// DSO-NEXT: 103c: 00 f0 9c e5 ldr pc, [r12]
-// 0x1038 + 8 + 1fcc = 0x300c
-// DSO-NEXT: 1040: cc 1f 00 00
+// 0x1038 + 8 + 0fcc = 0x200c
+// DSO-NEXT: 1040: cc 0f 00 00
// DSO-NEXT: 1044: 04 c0 9f e5 ldr r12, [pc, #4]
// DSO-NEXT: 1048: 0f c0 8c e0 add r12, r12, pc
// DSO-NEXT: 104c: 00 f0 9c e5 ldr pc, [r12]
-// 0x1048 + 8 + 1fc0 = 0x3010
-// DSO-NEXT: 1050: c0 1f 00 00
+// 0x1048 + 8 + 0fc0 = 0x2010
+// DSO-NEXT: 1050: c0 0f 00 00
// DSO-NEXT: 1054: 04 c0 9f e5 ldr r12, [pc, #4]
// DSO-NEXT: 1058: 0f c0 8c e0 add r12, r12, pc
// DSO-NEXT: 105c: 00 f0 9c e5 ldr pc, [r12]
-// 0x1058 + 8 + 1fb4 = 0x3014
-// DSO-NEXT: 1060: b4 1f 00 00
+// 0x1058 + 8 + 0fb4 = 0x2014
+// DSO-NEXT: 1060: b4 0f 00 00
// DSOREL: Name: .got.plt
// DSOREL-NEXT: Type: SHT_PROGBITS
@@ -76,7 +76,7 @@ _start:
// DSOREL-NEXT: SHF_ALLOC
// DSOREL-NEXT: SHF_WRITE
// DSOREL-NEXT: ]
-// DSOREL-NEXT: Address: 0x3000
+// DSOREL-NEXT: Address: 0x2000
// DSOREL-NEXT: Offset:
// DSOREL-NEXT: Size: 24
// DSOREL-NEXT: Link:
@@ -85,6 +85,6 @@ _start:
// DSOREL-NEXT: EntrySize:
// DSOREL: Relocations [
// DSOREL-NEXT: Section (4) .rel.plt {
-// DSOREL-NEXT: 0x300C R_ARM_JUMP_SLOT func1 0x0
-// DSOREL-NEXT: 0x3010 R_ARM_JUMP_SLOT func2 0x0
-// DSOREL-NEXT: 0x3014 R_ARM_JUMP_SLOT func3 0x0
+// DSOREL-NEXT: 0x200C R_ARM_JUMP_SLOT func1 0x0
+// DSOREL-NEXT: 0x2010 R_ARM_JUMP_SLOT func2 0x0
+// DSOREL-NEXT: 0x2014 R_ARM_JUMP_SLOT func3 0x0
diff --git a/test/ELF/arm-thumb-interwork-shared.s b/test/ELF/arm-thumb-interwork-shared.s
index ffd055e5b621..460931876dcc 100644
--- a/test/ELF/arm-thumb-interwork-shared.s
+++ b/test/ELF/arm-thumb-interwork-shared.s
@@ -33,12 +33,12 @@ sym1:
// PLT-NEXT: 1024: 04 e0 9f e5 ldr lr, [pc, #4]
// PLT-NEXT: 1028: 0e e0 8f e0 add lr, pc, lr
// PLT-NEXT: 102c: 08 f0 be e5 ldr pc, [lr, #8]!
-// PLT-NEXT: 1030: d0 1f 00 00
+// PLT-NEXT: 1030: d0 0f 00 00
// PLT-NEXT: 1034: 04 c0 9f e5 ldr r12, [pc, #4]
// PLT-NEXT: 1038: 0f c0 8c e0 add r12, r12, pc
// PLT-NEXT: 103c: 00 f0 9c e5 ldr pc, [r12]
-// PLT-NEXT: 1040: cc 1f 00 00
+// PLT-NEXT: 1040: cc 0f 00 00
// PLT-NEXT: 1044: 04 c0 9f e5 ldr r12, [pc, #4]
// PLT-NEXT: 1048: 0f c0 8c e0 add r12, r12, pc
// PLT-NEXT: 104c: 00 f0 9c e5 ldr pc, [r12]
-// PLT-NEXT: 1050: c0 1f 00 00
+// PLT-NEXT: 1050: c0 0f 00 00
diff --git a/test/ELF/arm-thumb-plt-reloc.s b/test/ELF/arm-thumb-plt-reloc.s
index 6294e909f078..36c64b1ec306 100644
--- a/test/ELF/arm-thumb-plt-reloc.s
+++ b/test/ELF/arm-thumb-plt-reloc.s
@@ -63,23 +63,23 @@ _start:
// DSOARM-NEXT: 1024: 04 e0 9f e5 ldr lr, [pc, #4]
// DSOARM-NEXT: 1028: 0e e0 8f e0 add lr, pc, lr
// DSOARM-NEXT: 102c: 08 f0 be e5 ldr pc, [lr, #8]!
-// DSOARM-NEXT: 1030: d0 1f 00 00
-// 0x1028 + 8 + 1fd0 = 0x3000
+// DSOARM-NEXT: 1030: d0 0f 00 00
+// 0x1028 + 8 + 0fd0 = 0x2000
// DSOARM-NEXT: 1034: 04 c0 9f e5 ldr r12, [pc, #4]
// DSOARM-NEXT: 1038: 0f c0 8c e0 add r12, r12, pc
// DSOARM-NEXT: 103c: 00 f0 9c e5 ldr pc, [r12]
-// DSOARM-NEXT: 1040: cc 1f 00 00
-// 0x1038 + 8 + 1fcc = 0x300c
+// DSOARM-NEXT: 1040: cc 0f 00 00
+// 0x1038 + 8 + 0fcc = 0x200c
// DSOARM-NEXT: 1044: 04 c0 9f e5 ldr r12, [pc, #4]
// DSOARM-NEXT: 1048: 0f c0 8c e0 add r12, r12, pc
// DSOARM-NEXT: 104c: 00 f0 9c e5 ldr pc, [r12]
-// DSOARM-NEXT: 1050: c0 1f 00 00
-// 0x1048 + 8 + 1fc0 = 0x3010
+// DSOARM-NEXT: 1050: c0 0f 00 00
+// 0x1048 + 8 + 0fc0 = 0x2010
// DSOARM-NEXT: 1054: 04 c0 9f e5 ldr r12, [pc, #4]
// DSOARM-NEXT: 1058: 0f c0 8c e0 add r12, r12, pc
// DSOARM-NEXT: 105c: 00 f0 9c e5 ldr pc, [r12]
-// DSOARM-NEXT: 1060: b4 1f 00 00
-// 0x1058 + 8 + 1fb4 = 0x3014
+// DSOARM-NEXT: 1060: b4 0f 00 00
+// 0x1058 + 8 + 0fb4 = 0x2014
// DSOREL: Name: .got.plt
// DSOREL-NEXT: Type: SHT_PROGBITS
@@ -87,7 +87,7 @@ _start:
// DSOREL-NEXT: SHF_ALLOC
// DSOREL-NEXT: SHF_WRITE
// DSOREL-NEXT: ]
-// DSOREL-NEXT: Address: 0x3000
+// DSOREL-NEXT: Address: 0x2000
// DSOREL-NEXT: Offset:
// DSOREL-NEXT: Size: 24
// DSOREL-NEXT: Link:
@@ -96,6 +96,6 @@ _start:
// DSOREL-NEXT: EntrySize:
// DSOREL: Relocations [
// DSOREL-NEXT: Section (4) .rel.plt {
-// DSOREL-NEXT: 0x300C R_ARM_JUMP_SLOT func1 0x0
-// DSOREL-NEXT: 0x3010 R_ARM_JUMP_SLOT func2 0x0
-// DSOREL-NEXT: 0x3014 R_ARM_JUMP_SLOT func3 0x0
+// DSOREL-NEXT: 0x200C R_ARM_JUMP_SLOT func1 0x0
+// DSOREL-NEXT: 0x2010 R_ARM_JUMP_SLOT func2 0x0
+// DSOREL-NEXT: 0x2014 R_ARM_JUMP_SLOT func3 0x0
diff --git a/test/ELF/arm-tls-norelax-gd-ie.s b/test/ELF/arm-tls-norelax-gd-ie.s
index 3bd3db08ccf4..2617089b4080 100644
--- a/test/ELF/arm-tls-norelax-gd-ie.s
+++ b/test/ELF/arm-tls-norelax-gd-ie.s
@@ -25,6 +25,6 @@ func:
.Lt0: .word y(TLSGD) + (. - .L0 - 8)
// CHECK: Dynamic Relocations {
-// CHECK-NEXT: 0x12078 R_ARM_TLS_DTPMOD32 y
-// CHECK-NEXT: 0x1207C R_ARM_TLS_DTPOFF32 y
-// CHECK-NEXT: 0x1300C R_ARM_JUMP_SLOT __tls_get_addr
+// CHECK-NEXT: 0x13078 R_ARM_TLS_DTPMOD32 y
+// CHECK-NEXT: 0x1307C R_ARM_TLS_DTPOFF32 y
+// CHECK-NEXT: 0x1200C R_ARM_JUMP_SLOT __tls_get_addr
diff --git a/test/ELF/arm-tls-norelax-gd-le.s b/test/ELF/arm-tls-norelax-gd-le.s
index 67952b1f8565..41df72494f8b 100644
--- a/test/ELF/arm-tls-norelax-gd-le.s
+++ b/test/ELF/arm-tls-norelax-gd-le.s
@@ -33,5 +33,5 @@ x:
// CHECK: Contents of section .got:
// Module index is always 1 for executable
-// CHECK-NEXT: 12060 01000000 00000000
+// CHECK-NEXT: 13060 01000000 00000000
diff --git a/test/ELF/arm-tls-norelax-ie-le.s b/test/ELF/arm-tls-norelax-ie-le.s
index ecb68293829a..e8c528b401ca 100644
--- a/test/ELF/arm-tls-norelax-ie-le.s
+++ b/test/ELF/arm-tls-norelax-ie-le.s
@@ -36,6 +36,6 @@ x2:
.space 4
.type x2, %object
-// CHECK: Contents of section .got
+// CHECK: Contents of section .got:
// x1 at offset 8 from TP, x2 at offset c from TP. Offsets include TCB size of 8
-// CHECK-NEXT: 12064 08000000 0c000000
+// CHECK-NEXT: 13064 08000000 0c000000
diff --git a/test/ELF/arm-tls-norelax-ld-le.s b/test/ELF/arm-tls-norelax-ld-le.s
index 380610ef394b..9fd822aefef7 100644
--- a/test/ELF/arm-tls-norelax-ld-le.s
+++ b/test/ELF/arm-tls-norelax-ld-le.s
@@ -32,4 +32,4 @@ x:
.word 10
// CHECK: Contents of section .got:
-// CHECK-NEXT: 12064 01000000 00000000
+// CHECK-NEXT: 13064 01000000 00000000
diff --git a/test/ELF/basic-mips.s b/test/ELF/basic-mips.s
index 84a7663675fc..67b58f8f028c 100644
--- a/test/ELF/basic-mips.s
+++ b/test/ELF/basic-mips.s
@@ -27,7 +27,7 @@ __start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x20000
# CHECK-NEXT: ProgramHeaderOffset: 0x34
-# CHECK-NEXT: SectionHeaderOffset: 0x30098
+# CHECK-NEXT: SectionHeaderOffset: 0x200A0
# CHECK-NEXT: Flags [
# CHECK-NEXT: EF_MIPS_ABI_O32
# CHECK-NEXT: EF_MIPS_ARCH_32
@@ -103,35 +103,35 @@ __start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 4
-# CHECK-NEXT: Name: .got
+# CHECK-NEXT: Name: .data
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT: Flags [ (0x10000003)
+# CHECK-NEXT: Flags [ (0x3)
# CHECK-NEXT: SHF_ALLOC (0x2)
-# CHECK-NEXT: SHF_MIPS_GPREL (0x10000000)
# CHECK-NEXT: SHF_WRITE (0x1)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x30000
# CHECK-NEXT: Offset: 0x20000
-# CHECK-NEXT: Size: 8
+# CHECK-NEXT: Size: 0
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
-# CHECK-NEXT: AddressAlignment: 4
+# CHECK-NEXT: AddressAlignment: 16
# CHECK-NEXT: EntrySize: 0
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 5
-# CHECK-NEXT: Name: .data
+# CHECK-NEXT: Name: .got
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT: Flags [ (0x3)
+# CHECK-NEXT: Flags [ (0x10000003)
# CHECK-NEXT: SHF_ALLOC (0x2)
+# CHECK-NEXT: SHF_MIPS_GPREL (0x10000000)
# CHECK-NEXT: SHF_WRITE (0x1)
# CHECK-NEXT: ]
-# CHECK-NEXT: Address: 0x40000
-# CHECK-NEXT: Offset: 0x30000
-# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Address: 0x30000
+# CHECK-NEXT: Offset: 0x20000
+# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
-# CHECK-NEXT: AddressAlignment: 16
+# CHECK-NEXT: AddressAlignment: 4
# CHECK-NEXT: EntrySize: 0
# CHECK-NEXT: }
# CHECK-NEXT: Section {
@@ -143,7 +143,7 @@ __start:
# CHECK-NEXT: SHF_WRITE (0x1)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x40000
-# CHECK-NEXT: Offset: 0x30000
+# CHECK-NEXT: Offset: 0x20008
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@@ -159,7 +159,7 @@ __start:
# CHECK-NEXT: SHF_STRINGS (0x20)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x30000
+# CHECK-NEXT: Offset: 0x20008
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@@ -173,7 +173,7 @@ __start:
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x30008
+# CHECK-NEXT: Offset: 0x20010
# CHECK-NEXT: Size: 48
# CHECK-NEXT: Link: 10
# CHECK-NEXT: Info: 1
@@ -187,7 +187,7 @@ __start:
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x30038
+# CHECK-NEXT: Offset: 0x20040
# CHECK-NEXT: Size: 82
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@@ -201,7 +201,7 @@ __start:
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x3008A
+# CHECK-NEXT: Offset: 0x20092
# CHECK-NEXT: Size: 13
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@@ -283,7 +283,7 @@ __start:
# CHECK-NEXT: Offset: 0x20000
# CHECK-NEXT: VirtualAddress: 0x30000
# CHECK-NEXT: PhysicalAddress: 0x30000
-# CHECK-NEXT: FileSize: 65536
+# CHECK-NEXT: FileSize: 8
# CHECK-NEXT: MemSize: 65536
# CHECK-NEXT: Flags [
# CHECK-NEXT: PF_R
diff --git a/test/ELF/basic.s b/test/ELF/basic.s
index e284f9bd40d2..93ef03f9cd81 100644
--- a/test/ELF/basic.s
+++ b/test/ELF/basic.s
@@ -4,6 +4,7 @@
# RUN: ld.lld %t -o %t2
# RUN: llvm-readobj -file-headers -sections -program-headers -symbols %t2 \
# RUN: | FileCheck %s
+# RUN: ld.lld %t -o /dev/null
# exits with return code 42 on linux
.globl _start
diff --git a/test/ELF/basic64be.s b/test/ELF/basic64be.s
index 1ad982f04867..d16f4a074175 100644
--- a/test/ELF/basic64be.s
+++ b/test/ELF/basic64be.s
@@ -38,7 +38,7 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x10020040
# CHECK-NEXT: ProgramHeaderOffset: 0x40
-# CHECK-NEXT: SectionHeaderOffset: 0x200D8
+# CHECK-NEXT: SectionHeaderOffset: 0x30080
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 64
@@ -85,24 +85,6 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 2
-# CHECK-NEXT: Name: .got
-# CHECK-NEXT: Type: SHT_PROGBITS
-# CHECK-NEXT: Flags [
-# CHECK-NEXT: SHF_ALLOC
-# CHECK-NEXT: SHF_WRITE
-# CHECK-NEXT: ]
-# CHECK-NEXT: Address: 0x10020000
-# CHECK-NEXT: Offset: 0x20000
-# CHECK-NEXT: Size: 0
-# CHECK-NEXT: Link: 0
-# CHECK-NEXT: Info: 0
-# CHECK-NEXT: AddressAlignment: 8
-# CHECK-NEXT: EntrySize: 0
-# CHECK-NEXT: SectionData (
-# CHECK-NEXT: )
-# CHECK-NEXT: }
-# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 3
# CHECK-NEXT: Name: .toc
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x3)
@@ -122,7 +104,7 @@ _start:
# CHECK-NEXT: )
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 4
+# CHECK-NEXT: Index: 3
# CHECK-NEXT: Name: .toc1
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x3)
@@ -142,7 +124,7 @@ _start:
# CHECK-NEXT: )
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 5
+# CHECK-NEXT: Index: 4
# CHECK-NEXT: Name: .opd
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x3)
@@ -157,11 +139,29 @@ _start:
# CHECK-NEXT: AddressAlignment: 1
# CHECK-NEXT: EntrySize: 0
# CHECK-NEXT: SectionData (
-# CHECK-NEXT: 0000: 00000000 10010000 00000000 10028000 |................|
+# CHECK-NEXT: 0000: 00000000 10010000 00000000 10038000 |................|
# CHECK-NEXT: 0010: 00000000 00000000 |........|
# CHECK-NEXT: )
# CHECK-NEXT: }
# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 5
+# CHECK-NEXT: Name: .got
+# CHECK-NEXT: Type: SHT_PROGBITS
+# CHECK-NEXT: Flags [
+# CHECK-NEXT: SHF_ALLOC
+# CHECK-NEXT: SHF_WRITE
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x10030000
+# CHECK-NEXT: Offset: 0x30000
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Link: 0
+# CHECK-NEXT: Info: 0
+# CHECK-NEXT: AddressAlignment: 8
+# CHECK-NEXT: EntrySize: 0
+# CHECK-NEXT: SectionData (
+# CHECK-NEXT: )
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 6
# CHECK-NEXT: Name: .comment
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
@@ -170,7 +170,7 @@ _start:
# CHECK-NEXT: SHF_STRINGS (0x20)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x20058
+# CHECK-NEXT: Offset: 0x30000
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@@ -187,7 +187,7 @@ _start:
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x20060
+# CHECK-NEXT: Offset: 0x30008
# CHECK-NEXT: Size: 48
# CHECK-NEXT: Link: 9
# CHECK-NEXT: Info: 1
@@ -203,7 +203,7 @@ _start:
# CHECK-NEXT: Flags [
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x20090
+# CHECK-NEXT: Offset: 0x30038
# CHECK-NEXT: Size: 63
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@@ -219,7 +219,7 @@ _start:
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x200CF
+# CHECK-NEXT: Offset: 0x30077
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@@ -273,8 +273,8 @@ _start:
# CHECK-NEXT: Offset: 0x20000
# CHECK-NEXT: VirtualAddress: 0x10020000
# CHECK-NEXT: PhysicalAddress: 0x10020000
-# CHECK-NEXT: FileSize: 88
-# CHECK-NEXT: MemSize: 88
+# CHECK-NEXT: FileSize: 65536
+# CHECK-NEXT: MemSize: 65536
# CHECK-NEXT: Flags [ (0x6)
# CHECK-NEXT: PF_R (0x4)
# CHECK-NEXT: PF_W (0x2)
@@ -283,9 +283,9 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: ProgramHeader {
# CHECK-NEXT: Type: PT_GNU_RELRO
-# CHECK-NEXT: Offset: 0x20000
-# CHECK-NEXT: VirtualAddress: 0x10020000
-# CHECK-NEXT: PhysicalAddress: 0x10020000
+# CHECK-NEXT: Offset: 0x30000
+# CHECK-NEXT: VirtualAddress: 0x10030000
+# CHECK-NEXT: PhysicalAddress: 0x10030000
# CHECK-NEXT: FileSize: 0
# CHECK-NEXT: MemSize: 0
# CHECK-NEXT: Flags [ (0x4)
diff --git a/test/ELF/combrelocs.s b/test/ELF/combrelocs.s
index 5b876ee221a4..3c8be807053b 100644
--- a/test/ELF/combrelocs.s
+++ b/test/ELF/combrelocs.s
@@ -7,31 +7,31 @@
# CHECK: Relocations [
# CHECK-NEXT: Section ({{.*}}) .rela.dyn {
# CHECK-NEXT: Relocation {
-# CHECK-NEXT: Offset: 0x2000
+# CHECK-NEXT: Offset: 0x1000
# CHECK-NEXT: Type: R_X86_64_64
# CHECK-NEXT: Symbol: aaa (1)
# CHECK-NEXT: Addend: 0x0
# CHECK-NEXT: }
# CHECK-NEXT: Relocation {
-# CHECK-NEXT: Offset: 0x2018
+# CHECK-NEXT: Offset: 0x1018
# CHECK-NEXT: Type: R_X86_64_64
# CHECK-NEXT: Symbol: aaa (1)
# CHECK-NEXT: Addend: 0x0
# CHECK-NEXT: }
# CHECK-NEXT: Relocation {
-# CHECK-NEXT: Offset: 0x2010
+# CHECK-NEXT: Offset: 0x1010
# CHECK-NEXT: Type: R_X86_64_64
# CHECK-NEXT: Symbol: bbb (2)
# CHECK-NEXT: Addend: 0x0
# CHECK-NEXT: }
# CHECK-NEXT: Relocation {
-# CHECK-NEXT: Offset: 0x2008
+# CHECK-NEXT: Offset: 0x1008
# CHECK-NEXT: Type: R_X86_64_64
# CHECK-NEXT: Symbol: ccc (3)
# CHECK-NEXT: Addend: 0x0
# CHECK-NEXT: }
# CHECK-NEXT: Relocation {
-# CHECK-NEXT: Offset: 0x2020
+# CHECK-NEXT: Offset: 0x1020
# CHECK-NEXT: Type: R_X86_64_64
# CHECK-NEXT: Symbol: ddd (4)
# CHECK-NEXT: Addend: 0x0
@@ -49,31 +49,31 @@
# NOCOMB: Relocations [
# NOCOMB-NEXT: Section ({{.*}}) .rela.dyn {
# NOCOMB-NEXT: Relocation {
-# NOCOMB-NEXT: Offset: 0x2000
+# NOCOMB-NEXT: Offset: 0x1000
# NOCOMB-NEXT: Type: R_X86_64_64
# NOCOMB-NEXT: Symbol: aaa (1)
# NOCOMB-NEXT: Addend: 0x0
# NOCOMB-NEXT: }
# NOCOMB-NEXT: Relocation {
-# NOCOMB-NEXT: Offset: 0x2008
+# NOCOMB-NEXT: Offset: 0x1008
# NOCOMB-NEXT: Type: R_X86_64_64
# NOCOMB-NEXT: Symbol: ccc (3)
# NOCOMB-NEXT: Addend: 0x0
# NOCOMB-NEXT: }
# NOCOMB-NEXT: Relocation {
-# NOCOMB-NEXT: Offset: 0x2010
+# NOCOMB-NEXT: Offset: 0x1010
# NOCOMB-NEXT: Type: R_X86_64_64
# NOCOMB-NEXT: Symbol: bbb (2)
# NOCOMB-NEXT: Addend: 0x0
# NOCOMB-NEXT: }
# NOCOMB-NEXT: Relocation {
-# NOCOMB-NEXT: Offset: 0x2018
+# NOCOMB-NEXT: Offset: 0x1018
# NOCOMB-NEXT: Type: R_X86_64_64
# NOCOMB-NEXT: Symbol: aaa (1)
# NOCOMB-NEXT: Addend: 0x0
# NOCOMB-NEXT: }
# NOCOMB-NEXT: Relocation {
-# NOCOMB-NEXT: Offset: 0x2020
+# NOCOMB-NEXT: Offset: 0x1020
# NOCOMB-NEXT: Type: R_X86_64_64
# NOCOMB-NEXT: Symbol: ddd (4)
# NOCOMB-NEXT: Addend: 0x0
diff --git a/test/ELF/copy-rel-pie.s b/test/ELF/copy-rel-pie.s
index be7d5acaeba9..769a2431d850 100644
--- a/test/ELF/copy-rel-pie.s
+++ b/test/ELF/copy-rel-pie.s
@@ -24,21 +24,21 @@ _start:
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x3020
+// CHECK-NEXT: Address: 0x4000
// CHECK: Relocations [
// CHECK-NEXT: Section (4) .rela.dyn {
-// CHECK-NEXT: 0x3020 R_X86_64_COPY foo 0x0
+// CHECK-NEXT: 0x4000 R_X86_64_COPY foo 0x0
// CHECK-NEXT: }
// CHECK-NEXT: Section (5) .rela.plt {
-// CHECK-NEXT: 0x3018 R_X86_64_JUMP_SLOT bar 0x0
+// CHECK-NEXT: 0x2018 R_X86_64_JUMP_SLOT bar 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
// (0x1010 + 0x10) - 0x1005 = 27
-// 0x3020 - 0x100a = 8214
+// 0x4000 - 0x100a = 12278
// DISASM: Disassembly of section .text:
// DISASM-NEXT: _start:
// DISASM-NEXT: 1000: e8 1b 00 00 00 callq 27
-// DISASM-NEXT: 1005: e8 16 20 00 00 callq 8214 <foo>
+// DISASM-NEXT: 1005: e8 f6 2f 00 00 callq 12278 <foo>
diff --git a/test/ELF/dynamic-reloc-index.s b/test/ELF/dynamic-reloc-index.s
index ba3c5791beb0..47e8c6c4ef7d 100644
--- a/test/ELF/dynamic-reloc-index.s
+++ b/test/ELF/dynamic-reloc-index.s
@@ -8,7 +8,7 @@
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.plt {
-// CHECK-NEXT: 0x203018 R_X86_64_JUMP_SLOT bar 0x0
+// CHECK-NEXT: 0x202018 R_X86_64_JUMP_SLOT bar 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
diff --git a/test/ELF/dynamic-reloc.s b/test/ELF/dynamic-reloc.s
index 07894cffc90d..8fda0b45abea 100644
--- a/test/ELF/dynamic-reloc.s
+++ b/test/ELF/dynamic-reloc.s
@@ -33,7 +33,7 @@
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.plt {
// CHECK-NEXT: Relocation {
-// CHECK-NEXT: Offset: 0x203018
+// CHECK-NEXT: Offset: 0x202018
// CHECK-NEXT: Type: R_X86_64_JUMP_SLOT
// CHECK-NEXT: Symbol: bar
// CHECK-NEXT: Addend: 0x0
diff --git a/test/ELF/format-binary.test b/test/ELF/format-binary.test
index 586f5f963dfa..94b9b51afe78 100644
--- a/test/ELF/format-binary.test
+++ b/test/ELF/format-binary.test
@@ -15,6 +15,7 @@
# CHECK-NEXT: Type: SHT_PROGBITS
# CHECK-NEXT: Flags [
# CHECK-NEXT: SHF_ALLOC
+# CHECK-NEXT: SHF_WRITE
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset:
diff --git a/test/ELF/gnu-ifunc-plt-i386.s b/test/ELF/gnu-ifunc-plt-i386.s
index 75ebc8dd76ef..50f10c5fe6ca 100644
--- a/test/ELF/gnu-ifunc-plt-i386.s
+++ b/test/ELF/gnu-ifunc-plt-i386.s
@@ -10,16 +10,16 @@
// Check that the IRELATIVE relocations are after the JUMP_SLOT in the plt
// CHECK: Relocations [
// CHECK-NEXT: Section (4) .rel.plt {
-// CHECK-NEXT: 0x1300C R_386_JUMP_SLOT bar2
-// CHECK-NEXT: 0x13010 R_386_JUMP_SLOT zed2
-// CHECK-NEXT: 0x13014 R_386_IRELATIVE
-// CHECK-NEXT: 0x13018 R_386_IRELATIVE
+// CHECK-NEXT: 0x1200C R_386_JUMP_SLOT bar2
+// CHECK-NEXT: 0x12010 R_386_JUMP_SLOT zed2
+// CHECK-NEXT: 0x12014 R_386_IRELATIVE
+// CHECK-NEXT: 0x12018 R_386_IRELATIVE
// Check that IRELATIVE .got.plt entries point to ifunc resolver and not
// back to the plt entry + 6.
// GOTPLT: Contents of section .got.plt:
-// GOTPLT: 13000 00200100 00000000 00000000 36100100
-// GOTPLT-NEXT: 13010 46100100 00100100 01100100
+// GOTPLT: 12000 00300100 00000000 00000000 36100100
+// GOTPLT-NEXT: 12010 46100100 00100100 01100100
// Check that the PLTRELSZ tag includes the IRELATIVE relocations
// CHECK: DynamicSection [
@@ -38,22 +38,22 @@
// DISASM-NEXT: 11011: e8 2a 00 00 00 calll 42
// DISASM-NEXT: Disassembly of section .plt:
// DISASM-NEXT: .plt:
-// DISASM-NEXT: 11020: ff 35 04 30 01 00 pushl 77828
-// DISASM-NEXT: 11026: ff 25 08 30 01 00 jmpl *77832
+// DISASM-NEXT: 11020: ff 35 04 20 01 00 pushl 73732
+// DISASM-NEXT: 11026: ff 25 08 20 01 00 jmpl *73736
// DISASM-NEXT: 1102c: 90 nop
// DISASM-NEXT: 1102d: 90 nop
// DISASM-NEXT: 1102e: 90 nop
// DISASM-NEXT: 1102f: 90 nop
-// DISASM-NEXT: 11030: ff 25 0c 30 01 00 jmpl *77836
+// DISASM-NEXT: 11030: ff 25 0c 20 01 00 jmpl *73740
// DISASM-NEXT: 11036: 68 00 00 00 00 pushl $0
// DISASM-NEXT: 1103b: e9 e0 ff ff ff jmp -32 <.plt>
-// DISASM-NEXT: 11040: ff 25 10 30 01 00 jmpl *77840
+// DISASM-NEXT: 11040: ff 25 10 20 01 00 jmpl *73744
// DISASM-NEXT: 11046: 68 08 00 00 00 pushl $8
// DISASM-NEXT: 1104b: e9 d0 ff ff ff jmp -48 <.plt>
-// DISASM-NEXT: 11050: ff 25 14 30 01 00 jmpl *77844
+// DISASM-NEXT: 11050: ff 25 14 20 01 00 jmpl *73748
// DISASM-NEXT: 11056: 68 30 00 00 00 pushl $48
// DISASM-NEXT: 1105b: e9 e0 ff ff ff jmp -32 <.plt+0x20>
-// DISASM-NEXT: 11060: ff 25 18 30 01 00 jmpl *77848
+// DISASM-NEXT: 11060: ff 25 18 20 01 00 jmpl *73752
// DISASM-NEXT: 11066: 68 38 00 00 00 pushl $56
// DISASM-NEXT: 1106b: e9 d0 ff ff ff jmp -48 <.plt+0x20>
diff --git a/test/ELF/gnu-ifunc-plt.s b/test/ELF/gnu-ifunc-plt.s
index c7bd6b67b115..cf46380d3894 100644
--- a/test/ELF/gnu-ifunc-plt.s
+++ b/test/ELF/gnu-ifunc-plt.s
@@ -10,17 +10,17 @@
// Check that the IRELATIVE relocations are after the JUMP_SLOT in the plt
// CHECK: Relocations [
// CHECK-NEXT: Section (4) .rela.plt {
-// CHECK-NEXT: 0x203018 R_X86_64_JUMP_SLOT bar2 0x0
-// CHECK-NEXT: 0x203020 R_X86_64_JUMP_SLOT zed2 0x0
-// CHECK-NEXT: 0x203028 R_X86_64_IRELATIVE - 0x201000
-// CHECK-NEXT: 0x203030 R_X86_64_IRELATIVE - 0x201001
+// CHECK-NEXT: 0x202018 R_X86_64_JUMP_SLOT bar2 0x0
+// CHECK-NEXT: 0x202020 R_X86_64_JUMP_SLOT zed2 0x0
+// CHECK-NEXT: 0x202028 R_X86_64_IRELATIVE - 0x201000
+// CHECK-NEXT: 0x202030 R_X86_64_IRELATIVE - 0x201001
// Check that .got.plt entries point back to PLT header
// GOTPLT: Contents of section .got.plt:
-// GOTPLT-NEXT: 203000 00202000 00000000 00000000 00000000 . .............
-// GOTPLT-NEXT: 203010 00000000 00000000 36102000 00000000 ........6. .....
-// GOTPLT-NEXT: 203020 46102000 00000000 56102000 00000000 F. .....V. .....
-// GOTPLT-NEXT: 203030 66102000 00000000
+// GOTPLT-NEXT: 202000 00302000 00000000 00000000 00000000
+// GOTPLT-NEXT: 202010 00000000 00000000 36102000 00000000
+// GOTPLT-NEXT: 202020 46102000 00000000 56102000 00000000
+// GOTPLT-NEXT: 202030 66102000 00000000
// Check that the PLTRELSZ tag includes the IRELATIVE relocations
// CHECK: DynamicSection [
@@ -39,19 +39,19 @@
// DISASM-NEXT: 201011: e8 2a 00 00 00 callq 42
// DISASM-NEXT: Disassembly of section .plt:
// DISASM-NEXT: .plt:
-// DISASM-NEXT: 201020: ff 35 e2 1f 00 00 pushq 8162(%rip)
-// DISASM-NEXT: 201026: ff 25 e4 1f 00 00 jmpq *8164(%rip)
+// DISASM-NEXT: 201020: ff 35 e2 0f 00 00 pushq 4066(%rip)
+// DISASM-NEXT: 201026: ff 25 e4 0f 00 00 jmpq *4068(%rip)
// DISASM-NEXT: 20102c: 0f 1f 40 00 nopl (%rax)
-// DISASM-NEXT: 201030: ff 25 e2 1f 00 00 jmpq *8162(%rip)
+// DISASM-NEXT: 201030: ff 25 e2 0f 00 00 jmpq *4066(%rip)
// DISASM-NEXT: 201036: 68 00 00 00 00 pushq $0
// DISASM-NEXT: 20103b: e9 e0 ff ff ff jmp -32 <.plt>
-// DISASM-NEXT: 201040: ff 25 da 1f 00 00 jmpq *8154(%rip)
+// DISASM-NEXT: 201040: ff 25 da 0f 00 00 jmpq *4058(%rip)
// DISASM-NEXT: 201046: 68 01 00 00 00 pushq $1
// DISASM-NEXT: 20104b: e9 d0 ff ff ff jmp -48 <.plt>
-// DISASM-NEXT: 201050: ff 25 d2 1f 00 00 jmpq *8146(%rip)
+// DISASM-NEXT: 201050: ff 25 d2 0f 00 00 jmpq *4050(%rip)
// DISASM-NEXT: 201056: 68 00 00 00 00 pushq $0
// DISASM-NEXT: 20105b: e9 e0 ff ff ff jmp -32 <.plt+0x20>
-// DISASM-NEXT: 201060: ff 25 ca 1f 00 00 jmpq *8138(%rip)
+// DISASM-NEXT: 201060: ff 25 ca 0f 00 00 jmpq *4042(%rip)
// DISASM-NEXT: 201066: 68 01 00 00 00 pushq $1
// DISASM-NEXT: 20106b: e9 d0 ff ff ff jmp -48 <.plt+0x20>
diff --git a/test/ELF/gnu-ifunc-shared.s b/test/ELF/gnu-ifunc-shared.s
index 30142b6dfe59..aee870c28e11 100644
--- a/test/ELF/gnu-ifunc-shared.s
+++ b/test/ELF/gnu-ifunc-shared.s
@@ -20,24 +20,24 @@
// DISASM-NEXT: 1012: c3 retq
// DISASM-NEXT: Disassembly of section .plt:
// DISASM-NEXT: .plt:
-// DISASM-NEXT: 1020: ff 35 e2 1f 00 00 pushq 8162(%rip)
-// DISASM-NEXT: 1026: ff 25 e4 1f 00 00 jmpq *8164(%rip)
+// DISASM-NEXT: 1020: ff 35 e2 0f 00 00 pushq 4066(%rip)
+// DISASM-NEXT: 1026: ff 25 e4 0f 00 00 jmpq *4068(%rip)
// DISASM-NEXT: 102c: 0f 1f 40 00 nopl (%rax)
-// DISASM-NEXT: 1030: ff 25 e2 1f 00 00 jmpq *8162(%rip)
+// DISASM-NEXT: 1030: ff 25 e2 0f 00 00 jmpq *4066(%rip)
// DISASM-NEXT: 1036: 68 00 00 00 00 pushq $0
// DISASM-NEXT: 103b: e9 e0 ff ff ff jmp -32 <.plt>
-// DISASM-NEXT: 1040: ff 25 da 1f 00 00 jmpq *8154(%rip)
+// DISASM-NEXT: 1040: ff 25 da 0f 00 00 jmpq *4058(%rip)
// DISASM-NEXT: 1046: 68 01 00 00 00 pushq $1
// DISASM-NEXT: 104b: e9 d0 ff ff ff jmp -48 <.plt>
-// DISASM-NEXT: 1050: ff 25 d2 1f 00 00 jmpq *8146(%rip)
+// DISASM-NEXT: 1050: ff 25 d2 0f 00 00 jmpq *4050(%rip)
// DISASM-NEXT: 1056: 68 00 00 00 00 pushq $0
// DISASM-NEXT: 105b: e9 e0 ff ff ff jmp -32 <.plt+0x20>
// CHECK: Relocations [
// CHECK-NEXT: Section (4) .rela.plt {
-// CHECK-NEXT: 0x3018 R_X86_64_JUMP_SLOT fct2 0x0
-// CHECK-NEXT: 0x3020 R_X86_64_JUMP_SLOT f2 0x0
-// CHECK-NEXT: 0x3028 R_X86_64_IRELATIVE - 0x1000
+// CHECK-NEXT: 0x2018 R_X86_64_JUMP_SLOT fct2 0x0
+// CHECK-NEXT: 0x2020 R_X86_64_JUMP_SLOT f2 0x0
+// CHECK-NEXT: 0x2028 R_X86_64_IRELATIVE - 0x1000
// Hidden expect IRELATIVE
.globl fct
diff --git a/test/ELF/got-aarch64.s b/test/ELF/got-aarch64.s
index 8f39d5a4804f..ef6943881edc 100644
--- a/test/ELF/got-aarch64.s
+++ b/test/ELF/got-aarch64.s
@@ -10,7 +10,7 @@
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x20090
+// CHECK-NEXT: Address: 0x30090
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: 8
// CHECK-NEXT: Link: 0
@@ -19,7 +19,7 @@
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
-// CHECK-NEXT: 0x20090 R_AARCH64_GLOB_DAT dat 0x0
+// CHECK-NEXT: 0x30090 R_AARCH64_GLOB_DAT dat 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
@@ -27,7 +27,7 @@
// 0x20098 & 0xff8 = 0x98 = 152
// DISASM: main:
-// DISASM-NEXT: 10000: 80 00 00 90 adrp x0, #65536
+// DISASM-NEXT: 10000: 00 01 00 90 adrp x0, #131072
// DISASM-NEXT: 10004: 00 48 40 f9 ldr x0, [x0, #144]
.global main,foo,dat
diff --git a/test/ELF/got-plt-header.s b/test/ELF/got-plt-header.s
index 691516d1a348..a6b10fa3a0a0 100644
--- a/test/ELF/got-plt-header.s
+++ b/test/ELF/got-plt-header.s
@@ -6,25 +6,25 @@
// Check that the first .got.plt entry has the address of the dynamic table.
-// CHECK: Type: SHT_DYNAMIC
-// CHECK-NEXT: Flags [
-// CHECK-NEXT: SHF_ALLOC
-// CHECK-NEXT: SHF_WRITE
-// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x2000
-
// CHECK: Name: .got.plt
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x3000
-// CHECK-NEXT: Offset: 0x3000
+// CHECK-NEXT: Address: 0x2000
+// CHECK-NEXT: Offset: 0x2000
// CHECK-NEXT: Size: 32
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
// CHECK-NEXT: AddressAlignment: 8
// CHECK-NEXT: EntrySize: 0
// CHECK-NEXT: SectionData (
-// CHECK-NEXT: 0000: 00200000 00000000 00000000 00000000
+// CHECK-NEXT: 0000: 00300000 00000000 00000000 00000000
+
+// CHECK: Type: SHT_DYNAMIC
+// CHECK-NEXT: Flags [
+// CHECK-NEXT: SHF_ALLOC
+// CHECK-NEXT: SHF_WRITE
+// CHECK-NEXT: ]
+// CHECK-NEXT: Address: 0x3000
diff --git a/test/ELF/gotpc-relax-nopic.s b/test/ELF/gotpc-relax-nopic.s
index 3c7a4012a7d9..dc7dcf2e91e7 100644
--- a/test/ELF/gotpc-relax-nopic.s
+++ b/test/ELF/gotpc-relax-nopic.s
@@ -36,8 +36,8 @@
# SEC-PIC-NEXT: SHF_ALLOC
# SEC-PIC-NEXT: SHF_WRITE
# SEC-PIC-NEXT: ]
-# SEC-PIC-NEXT: Address: 0x20A0
-# SEC-PIC-NEXT: Offset: 0x20A0
+# SEC-PIC-NEXT: Address: 0x30A0
+# SEC-PIC-NEXT: Offset: 0x30A0
# SEC-PIC-NEXT: Size: 8
# SEC-PIC-NEXT: Link:
# SEC-PIC-NEXT: Info:
@@ -46,7 +46,7 @@
# SEC-PIC-NEXT: }
# SEC-PIC: Relocations [
# SEC-PIC-NEXT: Section ({{.*}}) .rela.dyn {
-# SEC-PIC-NEXT: 0x20A0 R_X86_64_RELATIVE - 0x3000
+# SEC-PIC-NEXT: 0x30A0 R_X86_64_RELATIVE - 0x2000
# SEC-PIC-NEXT: }
# SEC-PIC-NEXT: ]
# SEC-PIC: 0x000000006FFFFFF9 RELACOUNT 1
@@ -56,15 +56,15 @@
## 0x102a + 4207 + 7 = 0x20A0
# DISASM-PIC: Disassembly of section .text:
# DISASM-PIC-NEXT: _start:
-# DISASM-PIC-NEXT: 1000: {{.*}} adcq 4249(%rip), %rax
-# DISASM-PIC-NEXT: 1007: {{.*}} addq 4242(%rip), %rbx
-# DISASM-PIC-NEXT: 100e: {{.*}} andq 4235(%rip), %rcx
-# DISASM-PIC-NEXT: 1015: {{.*}} cmpq 4228(%rip), %rdx
-# DISASM-PIC-NEXT: 101c: {{.*}} orq 4221(%rip), %rdi
-# DISASM-PIC-NEXT: 1023: {{.*}} sbbq 4214(%rip), %rsi
-# DISASM-PIC-NEXT: 102a: {{.*}} subq 4207(%rip), %rbp
-# DISASM-PIC-NEXT: 1031: {{.*}} xorq 4200(%rip), %r8
-# DISASM-PIC-NEXT: 1038: {{.*}} testq 4193(%rip), %r15
+# DISASM-PIC-NEXT: 1000: {{.*}} adcq 8345(%rip), %rax
+# DISASM-PIC-NEXT: 1007: {{.*}} addq 8338(%rip), %rbx
+# DISASM-PIC-NEXT: 100e: {{.*}} andq 8331(%rip), %rcx
+# DISASM-PIC-NEXT: 1015: {{.*}} cmpq 8324(%rip), %rdx
+# DISASM-PIC-NEXT: 101c: {{.*}} orq 8317(%rip), %rdi
+# DISASM-PIC-NEXT: 1023: {{.*}} sbbq 8310(%rip), %rsi
+# DISASM-PIC-NEXT: 102a: {{.*}} subq 8303(%rip), %rbp
+# DISASM-PIC-NEXT: 1031: {{.*}} xorq 8296(%rip), %r8
+# DISASM-PIC-NEXT: 1038: {{.*}} testq 8289(%rip), %r15
.data
.type bar, @object
diff --git a/test/ELF/i386-merge.s b/test/ELF/i386-merge.s
index 5d48d4d07f08..00c954945a0f 100644
--- a/test/ELF/i386-merge.s
+++ b/test/ELF/i386-merge.s
@@ -27,8 +27,8 @@
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x2000
-// CHECK-NEXT: Offset: 0x2000
+// CHECK-NEXT: Address: 0x1000
+// CHECK-NEXT: Offset: 0x1000
// CHECK-NEXT: Size: 4
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
diff --git a/test/ELF/incompatible-section-types.s b/test/ELF/incompatible-section-types.s
index 0d075aca068b..3cc168c2646c 100644
--- a/test/ELF/incompatible-section-types.s
+++ b/test/ELF/incompatible-section-types.s
@@ -6,5 +6,5 @@
.section .foo, "aw", @progbits, unique, 1
.quad 0
-.section .foo, "aw", @nobits, unique, 2
+.section .foo, "aw", @init_array, unique, 2
.quad 0
diff --git a/test/ELF/incompatible-section-types2.s b/test/ELF/incompatible-section-types2.s
new file mode 100644
index 000000000000..2cf9b8548aa1
--- /dev/null
+++ b/test/ELF/incompatible-section-types2.s
@@ -0,0 +1,7 @@
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+// RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
+
+// CHECK: error: Section has different type from others with the same name <internal>:(.shstrtab)
+
+.section .shstrtab,""
+.short 20
diff --git a/test/ELF/invalid/invalid-relocation-x64.s b/test/ELF/invalid/invalid-relocation-x64.s
index 1ad9afa4c649..4934874bf167 100644
--- a/test/ELF/invalid/invalid-relocation-x64.s
+++ b/test/ELF/invalid/invalid-relocation-x64.s
@@ -26,5 +26,5 @@ Sections:
Type: R_X86_64_NONE
# RUN: not ld.lld %p/Inputs/invalid-relocation-x64.elf -o %t2 2>&1 | FileCheck %s
-# CHECK: unrecognized reloc 152
-# CHECK: unrecognized reloc 153
+# CHECK: do not know how to handle relocation 'Unknown' (152)
+# CHECK: do not know how to handle relocation 'Unknown' (153)
diff --git a/test/ELF/linkerscript/orphan.s b/test/ELF/linkerscript/orphan.s
index 3daa6fbf63c9..f51085383a9e 100644
--- a/test/ELF/linkerscript/orphan.s
+++ b/test/ELF/linkerscript/orphan.s
@@ -9,15 +9,15 @@
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -section-headers %t1 | FileCheck %s
-## .jcr is a relro section and should be placed before other RW sections.
+## .jcr is a relro section and should be placed after other RW sections.
## .bss is SHT_NOBITS section and should be last RW section, so some space
## in ELF file could be saved.
# CHECK: 0 00000000 0000000000000000
# CHECK-NEXT: 1 .text 00000000 0000000000000000 TEXT DATA
-# CHECK-NEXT: 2 .jcr 00000008 0000000000000000 DATA
-# CHECK-NEXT: 3 .rw1 00000008 0000000000000008 DATA
-# CHECK-NEXT: 4 .rw2 00000008 0000000000000010 DATA
-# CHECK-NEXT: 5 .rw3 00000008 0000000000000018 DATA
+# CHECK-NEXT: 2 .rw1 00000008 0000000000000000 DATA
+# CHECK-NEXT: 3 .rw2 00000008 0000000000000008 DATA
+# CHECK-NEXT: 4 .rw3 00000008 0000000000000010 DATA
+# CHECK-NEXT: 5 .jcr 00000008 0000000000000018 DATA
# CHECK-NEXT: 6 .bss 00000008 0000000000000020 BSS
.section .rw1, "aw"
diff --git a/test/ELF/linkerscript/repsection-symbol.s b/test/ELF/linkerscript/repsection-symbol.s
index 6786ac47255c..d2d8c9dd56ef 100644
--- a/test/ELF/linkerscript/repsection-symbol.s
+++ b/test/ELF/linkerscript/repsection-symbol.s
@@ -10,13 +10,13 @@
# RUN: llvm-readobj -t %t1 | FileCheck %s
# CHECK: Name: foo1
-# CHECK-NEXT: Value: 0x288
+# CHECK-NEXT: Value: 0x228
# CHECK: Name: foo2
-# CHECK-NEXT: Value: 0x290
+# CHECK-NEXT: Value: 0x230
# CHECK: Name: foo3
-# CHECK-NEXT: Value: 0x294
+# CHECK-NEXT: Value: 0x234
.section .foo.1,"a"
.long 1
diff --git a/test/ELF/linkerscript/sort-non-script.s b/test/ELF/linkerscript/sort-non-script.s
index 75a2d450adcc..b0517608d51b 100644
--- a/test/ELF/linkerscript/sort-non-script.s
+++ b/test/ELF/linkerscript/sort-non-script.s
@@ -9,8 +9,8 @@
# CHECK-NEXT: .dynsym {{.*}} A
# CHECK-NEXT: .hash {{.*}} A
# CHECK-NEXT: .dynstr {{.*}} A
-# CHECK-NEXT: .dynamic {{.*}} WA
# CHECK-NEXT: foo {{.*}} WA
+# CHECK-NEXT: .dynamic {{.*}} WA
.section foo, "aw"
.byte 0
diff --git a/test/ELF/lto/undefined-puts.ll b/test/ELF/lto/undefined-puts.ll
index 07b2b4ef6414..d13630368de9 100644
--- a/test/ELF/lto/undefined-puts.ll
+++ b/test/ELF/lto/undefined-puts.ll
@@ -20,7 +20,7 @@ declare i32 @printf(i8*, ...)
; Check that puts symbol is present in the dynamic symbol table and
; there's a relocation for it.
; CHECK: Dynamic Relocations {
-; CHECK-NEXT: 0x203018 R_X86_64_JUMP_SLOT puts 0x0
+; CHECK-NEXT: 0x202018 R_X86_64_JUMP_SLOT puts 0x0
; CHECK-NEXT: }
; CHECK: DynamicSymbols [
diff --git a/test/ELF/lto/visibility.ll b/test/ELF/lto/visibility.ll
index 718cc5b06986..9acc0e2efaaf 100644
--- a/test/ELF/lto/visibility.ll
+++ b/test/ELF/lto/visibility.ll
@@ -15,7 +15,7 @@
; CHECK-NEXT: Section: .text
; CHECK: Name: a
-; CHECK-NEXT: Value: 0x3000
+; CHECK-NEXT: Value: 0x2000
; CHECK-NEXT: Size: 0
; CHECK-NEXT: Binding: Local
; CHECK-NEXT: Type: None
diff --git a/test/ELF/merge-section-types.s b/test/ELF/merge-section-types.s
new file mode 100644
index 000000000000..ee80fe177fe0
--- /dev/null
+++ b/test/ELF/merge-section-types.s
@@ -0,0 +1,19 @@
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+// RUN: ld.lld -shared %t.o -o %t
+// RUN: llvm-readobj -s %t | FileCheck %s
+
+// CHECK: Name: .foo
+// CHECK-NEXT: Type: SHT_PROGBITS
+// CHECK-NEXT: Flags [
+// CHECK-NEXT: SHF_ALLOC
+// CHECK-NEXT: SHF_WRITE
+// CHECK-NEXT: ]
+// CHECK-NEXT: Address: 0x1000
+// CHECK-NEXT: Offset: 0x1000
+// CHECK-NEXT: Size: 16
+
+.section .foo, "aw", @progbits, unique, 1
+.quad 0
+
+.section .foo, "aw", @nobits, unique, 2
+.quad 0
diff --git a/test/ELF/mips-26.s b/test/ELF/mips-26.s
index b463c1ac2127..749920b88c8b 100644
--- a/test/ELF/mips-26.s
+++ b/test/ELF/mips-26.s
@@ -27,7 +27,7 @@
# CHECK-NEXT: 20018: 00 00 00 00 nop
# CHECK-NEXT: Disassembly of section .plt:
# CHECK-NEXT: .plt:
-# CHECK-NEXT: 20020: 3c 1c 00 04 lui $gp, 4
+# CHECK-NEXT: 20020: 3c 1c 00 03 lui $gp, 3
# CHECK-NEXT: 20024: 8f 99 00 04 lw $25, 4($gp)
# CHECK-NEXT: 20028: 27 9c 00 04 addiu $gp, $gp, 4
# CHECK-NEXT: 2002c: 03 1c c0 23 subu $24, $24, $gp
@@ -35,7 +35,7 @@
# CHECK-NEXT: 20034: 00 18 c0 82 srl $24, $24, 2
# CHECK-NEXT: 20038: 03 20 f8 09 jalr $25
# CHECK-NEXT: 2003c: 27 18 ff fe addiu $24, $24, -2
-# CHECK-NEXT: 20040: 3c 0f 00 04 lui $15, 4
+# CHECK-NEXT: 20040: 3c 0f 00 03 lui $15, 3
# CHECK-NEXT: 20044: 8d f9 00 0c lw $25, 12($15)
# CHECK-NEXT: 20048: 03 20 00 08 jr $25
# CHECK-NEXT: 2004c: 25 f8 00 0c addiu $24, $15, 12
diff --git a/test/ELF/mips-32.s b/test/ELF/mips-32.s
index 8801bcf91f48..ef97afcc0313 100644
--- a/test/ELF/mips-32.s
+++ b/test/ELF/mips-32.s
@@ -34,21 +34,21 @@ v2:
.word v1 # R_MIPS_32 target v1 addend 0
# BE: Contents of section .data:
-# BE-NEXT: 30000 00000000 00000004 00030000
+# BE-NEXT: 20000 00000000 00000004 00020000
# ^-- v2+4 ^-- v1
# EL: Contents of section .data:
-# EL-NEXT: 30000 00000000 04000000 00000300
+# EL-NEXT: 20000 00000000 04000000 00000200
# ^-- v2+4 ^-- v1
# SYM: SYMBOL TABLE:
-# SYM: 00030000 l .data 00000004 v1
-# SYM: 00030004 g .data 00000008 v2
+# SYM: 00020000 l .data 00000004 v1
+# SYM: 00020004 g .data 00000008 v2
# REL: Relocations [
# REL-NEXT: Section (7) .rel.dyn {
-# REL-NEXT: 0x30008 R_MIPS_REL32 - 0x0
-# REL-NEXT: 0x30004 R_MIPS_REL32 v2 0x0
+# REL-NEXT: 0x20008 R_MIPS_REL32 - 0x0
+# REL-NEXT: 0x20004 R_MIPS_REL32 v2 0x0
# REL-NEXT: }
# REL-NEXT: ]
@@ -68,8 +68,8 @@ v2:
# REL-NEXT: Entry {
# REL-NEXT: Address:
# REL-NEXT: Access:
-# REL-NEXT: Initial: 0x30004
-# REL-NEXT: Value: 0x30004
+# REL-NEXT: Initial: 0x20004
+# REL-NEXT: Value: 0x20004
# REL-NEXT: Type: Object
# REL-NEXT: Section: .data
# REL-NEXT: Name: v2
diff --git a/test/ELF/mips-64-disp.s b/test/ELF/mips-64-disp.s
index 95568071a07f..04dd743d0b56 100644
--- a/test/ELF/mips-64-disp.s
+++ b/test/ELF/mips-64-disp.s
@@ -18,23 +18,23 @@
# CHECK-NEXT: 20010: 24 42 80 38 addiu $2, $2, -32712
# CHECK: 0000000000020014 .text 00000000 foo
-# CHECK: 0000000000037ff0 *ABS* 00000000 .hidden _gp
+# CHECK: 0000000000047ff0 *ABS* 00000000 .hidden _gp
# CHECK: 0000000000020000 .text 00000000 __start
# CHECK: 0000000000000000 g F *UND* 00000000 foo1a
# GOT: Relocations [
# GOT-NEXT: ]
# GOT-NEXT: Primary GOT {
-# GOT-NEXT: Canonical gp value: 0x37FF0
+# GOT-NEXT: Canonical gp value: 0x47FF0
# GOT-NEXT: Reserved entries [
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30000
+# GOT-NEXT: Address: 0x40000
# GOT-NEXT: Access: -32752
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Purpose: Lazy resolver
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30008
+# GOT-NEXT: Address: 0x40008
# GOT-NEXT: Access: -32744
# GOT-NEXT: Initial: 0x8000000000000000
# GOT-NEXT: Purpose: Module pointer (GNU extension)
@@ -42,29 +42,29 @@
# GOT-NEXT: ]
# GOT-NEXT: Local entries [
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30010
+# GOT-NEXT: Address: 0x40010
# GOT-NEXT: Access: -32736
# GOT-NEXT: Initial: 0x20014
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30018
+# GOT-NEXT: Address: 0x40018
# GOT-NEXT: Access: -32728
# GOT-NEXT: Initial: 0x20004
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30020
+# GOT-NEXT: Address: 0x40020
# GOT-NEXT: Access: -32720
# GOT-NEXT: Initial: 0x20008
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30028
+# GOT-NEXT: Address: 0x40028
# GOT-NEXT: Access: -32712
# GOT-NEXT: Initial: 0x2000C
# GOT-NEXT: }
# GOT-NEXT: ]
# GOT-NEXT: Global entries [
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30030
+# GOT-NEXT: Address: 0x40030
# GOT-NEXT: Access: -32704
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Value: 0x0
diff --git a/test/ELF/mips-64-got.s b/test/ELF/mips-64-got.s
index f489b4451b61..9bb45c57aa9f 100644
--- a/test/ELF/mips-64-got.s
+++ b/test/ELF/mips-64-got.s
@@ -19,23 +19,23 @@
# CHECK-NEXT: 20010: 24 42 80 38 addiu $2, $2, -32712
# CHECK: 0000000000020018 .text 00000000 foo
-# CHECK: 0000000000037ff0 *ABS* 00000000 .hidden _gp
+# CHECK: 0000000000047ff0 *ABS* 00000000 .hidden _gp
# CHECK: 0000000000020000 .text 00000000 __start
# CHECK: 0000000000020014 .text 00000000 bar
# GOT: Relocations [
# GOT-NEXT: ]
# GOT-NEXT: Primary GOT {
-# GOT-NEXT: Canonical gp value: 0x37FF0
+# GOT-NEXT: Canonical gp value: 0x47FF0
# GOT-NEXT: Reserved entries [
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30000
+# GOT-NEXT: Address: 0x40000
# GOT-NEXT: Access: -32752
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Purpose: Lazy resolver
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30008
+# GOT-NEXT: Address: 0x40008
# GOT-NEXT: Access: -32744
# GOT-NEXT: Initial: 0x8000000000000000
# GOT-NEXT: Purpose: Module pointer (GNU extension)
@@ -43,29 +43,29 @@
# GOT-NEXT: ]
# GOT-NEXT: Local entries [
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30010
+# GOT-NEXT: Address: 0x40010
# GOT-NEXT: Access: -32736
# GOT-NEXT: Initial: 0x20000
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30018
+# GOT-NEXT: Address: 0x40018
# GOT-NEXT: Access: -32728
# GOT-NEXT: Initial: 0x30000
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30020
+# GOT-NEXT: Address: 0x40020
# GOT-NEXT: Access: -32720
# GOT-NEXT: Initial: 0x20014
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30028
+# GOT-NEXT: Address: 0x40028
# GOT-NEXT: Access: -32712
# GOT-NEXT: Initial: 0x20018
# GOT-NEXT: }
# GOT-NEXT: ]
# GOT-NEXT: Global entries [
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x30030
+# GOT-NEXT: Address: 0x40030
# GOT-NEXT: Access: -32704
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Value: 0x0
diff --git a/test/ELF/mips-64.s b/test/ELF/mips-64.s
index 689669e4b09f..dd8a58d604c5 100644
--- a/test/ELF/mips-64.s
+++ b/test/ELF/mips-64.s
@@ -26,14 +26,14 @@ v2:
# SYM: SYMBOL TABLE:
-# SYM: 00030000 l .data 00000004 v1
-# SYM: 00030008 g .data 00000008 v2
+# SYM: 00020000 l .data 00000004 v1
+# SYM: 00020008 g .data 00000008 v2
# CHECK: Relocations [
# CHECK-NEXT: Section (7) .rela.dyn {
-# CHECK-NEXT: 0x30010 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE - 0x30000
+# CHECK-NEXT: 0x20010 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE - 0x20000
# ^-- v1
-# CHECK-NEXT: 0x30008 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE v2 0x8
+# CHECK-NEXT: 0x20008 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE v2 0x8
# CHECK-NEXT: }
# CHECK-NEXT: ]
@@ -52,8 +52,8 @@ v2:
# CHECK-NEXT: Entry {
# CHECK-NEXT: Address:
# CHECK-NEXT: Access:
-# CHECK-NEXT: Initial: 0x30008
-# CHECK-NEXT: Value: 0x30008
+# CHECK-NEXT: Initial: 0x20008
+# CHECK-NEXT: Value: 0x20008
# CHECK-NEXT: Type: Object
# CHECK-NEXT: Section: .data
# CHECK-NEXT: Name: v2
diff --git a/test/ELF/mips-dynamic.s b/test/ELF/mips-dynamic.s
index 3cb5c63a49f2..15afb028c1f1 100644
--- a/test/ELF/mips-dynamic.s
+++ b/test/ELF/mips-dynamic.s
@@ -24,25 +24,25 @@
# EXE-NEXT: Flags [
# EXE-NEXT: SHF_ALLOC
# EXE-NEXT: ]
-# EXE: Name: .got
+# EXE: Name: .rld_map
# EXE-NEXT: Type: SHT_PROGBITS
-# EXE-NEXT: Flags [ (0x10000003)
+# EXE-NEXT: Flags [
# EXE-NEXT: SHF_ALLOC
-# EXE-NEXT: SHF_MIPS_GPREL
# EXE-NEXT: SHF_WRITE
# EXE-NEXT: ]
-# EXE-NEXT: Address: [[GOTADDR:0x[0-9a-f]+]]
+# EXE-NEXT: Address: [[RLDMAPADDR:0x[0-9a-f]+]]
# EXE-NEXT: Offset:
-# EXE-NEXT: Size: 8
-# EXE: Name: .rld_map
+# EXE-NEXT: Size: 4
+# EXE: Name: .got
# EXE-NEXT: Type: SHT_PROGBITS
-# EXE-NEXT: Flags [
+# EXE-NEXT: Flags [ (0x10000003)
# EXE-NEXT: SHF_ALLOC
+# EXE-NEXT: SHF_MIPS_GPREL
# EXE-NEXT: SHF_WRITE
# EXE-NEXT: ]
-# EXE-NEXT: Address: [[RLDMAPADDR:0x[0-9a-f]+]]
+# EXE-NEXT: Address: [[GOTADDR:0x[0-9a-f]+]]
# EXE-NEXT: Offset:
-# EXE-NEXT: Size: 4
+# EXE-NEXT: Size: 8
# EXE: ]
# EXE: DynamicSection [
# EXE-NEXT: Tag Type Name/Value
diff --git a/test/ELF/mips-got-and-copy.s b/test/ELF/mips-got-and-copy.s
index f42b39c6d51d..70bb8d388d86 100644
--- a/test/ELF/mips-got-and-copy.s
+++ b/test/ELF/mips-got-and-copy.s
@@ -19,22 +19,22 @@
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK-NEXT: Primary GOT {
-# CHECK-NEXT: Canonical gp value: 0x37FF0
+# CHECK-NEXT: Canonical gp value: 0x47FF0
# CHECK-NEXT: Reserved entries [
# CHECK: ]
# CHECK-NEXT: Local entries [
# CHECK-NEXT: Entry {
-# CHECK-NEXT: Address: 0x30008
+# CHECK-NEXT: Address: 0x40008
# CHECK-NEXT: Access: -32744
-# CHECK-NEXT: Initial: 0x40010
+# CHECK-NEXT: Initial: 0x50000
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK-NEXT: Global entries [
# CHECK-NEXT: Entry {
-# CHECK-NEXT: Address: 0x3000C
+# CHECK-NEXT: Address: 0x4000C
# CHECK-NEXT: Access: -32740
-# CHECK-NEXT: Initial: 0x40014
-# CHECK-NEXT: Value: 0x40014
+# CHECK-NEXT: Initial: 0x50004
+# CHECK-NEXT: Value: 0x50004
# CHECK-NEXT: Type: Object (0x1)
# CHECK-NEXT: Section: .bss (0xD)
# CHECK-NEXT: Name: data1@
diff --git a/test/ELF/mips-got-extsym.s b/test/ELF/mips-got-extsym.s
index 1cf99aeed49b..f9d809c10097 100644
--- a/test/ELF/mips-got-extsym.s
+++ b/test/ELF/mips-got-extsym.s
@@ -30,7 +30,7 @@
# CHECK: Local entries [
# CHECK-NEXT: Entry {
-# CHECK-NEXT: Address: 0x30008
+# CHECK-NEXT: Address: 0x40008
# CHECK-NEXT: Access: -32744
# CHECK-NEXT: Initial: 0x20008
# ^-- bar
@@ -38,7 +38,7 @@
# CHECK-NEXT: ]
# CHECK-NEXT: Global entries [
# CHECK-NEXT: Entry {
-# CHECK-NEXT: Address: 0x3000C
+# CHECK-NEXT: Address: 0x4000C
# CHECK-NEXT: Access: -32740
# CHECK-NEXT: Initial: 0x0
# CHECK-NEXT: Value: 0x0
diff --git a/test/ELF/mips-got-hilo.s b/test/ELF/mips-got-hilo.s
index 7e6945fd2b62..26a198115168 100644
--- a/test/ELF/mips-got-hilo.s
+++ b/test/ELF/mips-got-hilo.s
@@ -20,22 +20,22 @@
# GOT-NEXT: ]
# GOT: Primary GOT {
-# GOT-NEXT: Canonical gp value: 0x27FF0
+# GOT-NEXT: Canonical gp value: 0x37FF0
# GOT: Local entries [
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x20008
+# GOT-NEXT: Address: 0x30008
# GOT-NEXT: Access: -32744
-# GOT-NEXT: Initial: 0x30000
+# GOT-NEXT: Initial: 0x20000
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x2000C
+# GOT-NEXT: Address: 0x3000C
# GOT-NEXT: Access: -32740
-# GOT-NEXT: Initial: 0x30004
+# GOT-NEXT: Initial: 0x20004
# GOT-NEXT: }
# GOT-NEXT: ]
# GOT-NEXT: Global entries [
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x20010
+# GOT-NEXT: Address: 0x30010
# GOT-NEXT: Access: -32736
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Value: 0x0
diff --git a/test/ELF/mips-got-redundant.s b/test/ELF/mips-got-redundant.s
index 115a49f357dd..e734aa5b4524 100644
--- a/test/ELF/mips-got-redundant.s
+++ b/test/ELF/mips-got-redundant.s
@@ -8,27 +8,27 @@
# CHECK: Local entries [
# CHECK-NEXT: Entry {
-# CHECK-NEXT: Address: 0x20008
+# CHECK-NEXT: Address: 0x40008
# CHECK-NEXT: Access: -32744
-# CHECK-NEXT: Initial: 0x30000
+# CHECK-NEXT: Initial: 0x20000
# ^-- loc1
# CHECK-NEXT: }
# CHECK-NEXT: Entry {
-# CHECK-NEXT: Address: 0x2000C
+# CHECK-NEXT: Address: 0x4000C
# CHECK-NEXT: Access: -32740
-# CHECK-NEXT: Initial: 0x40000
+# CHECK-NEXT: Initial: 0x30000
# ^-- loc2, loc3, loc4
# CHECK-NEXT: }
# CHECK-NEXT: Entry {
-# CHECK-NEXT: Address: 0x20010
+# CHECK-NEXT: Address: 0x40010
# CHECK-NEXT: Access: -32736
-# CHECK-NEXT: Initial: 0x50000
+# CHECK-NEXT: Initial: 0x40000
# ^-- redundant
# CHECK-NEXT: }
# CHECK-NEXT: Entry {
-# CHECK-NEXT: Address: 0x20014
+# CHECK-NEXT: Address: 0x40014
# CHECK-NEXT: Access: -32732
-# CHECK-NEXT: Initial: 0x40008
+# CHECK-NEXT: Initial: 0x30008
# ^-- glb1
# CHECK-NEXT: }
# CHECK-NEXT: ]
diff --git a/test/ELF/mips-got-relocs.s b/test/ELF/mips-got-relocs.s
index 19c0db49a440..bb4efd039fdc 100644
--- a/test/ELF/mips-got-relocs.s
+++ b/test/ELF/mips-got-relocs.s
@@ -45,22 +45,22 @@ v1:
.word 0
# EXE_SYM: Sections:
-# EXE_SYM: .got 0000000c 0000000000030000 DATA
+# EXE_SYM: .got 0000000c 0000000000040000 DATA
# EXE_SYM: SYMBOL TABLE:
-# EXE_SYM: 00037ff0 *ABS* 00000000 .hidden _gp
+# EXE_SYM: 00047ff0 *ABS* 00000000 .hidden _gp
# ^-- .got + GP offset (0x7ff0)
-# EXE_SYM: 00040000 g .data 00000004 v1
+# EXE_SYM: 00030000 g .data 00000004 v1
# EXE_GOT_BE: Contents of section .got:
-# EXE_GOT_BE: 30000 00000000 80000000 00040000
-# ^ ^ ^-- v1 (0x40000)
+# EXE_GOT_BE: 40000 00000000 80000000 00030000
+# ^ ^ ^-- v1 (0x30000)
# | +-- Module pointer (0x80000000)
# +-- Lazy resolver (0x0)
# EXE_GOT_EL: Contents of section .got:
-# EXE_GOT_EL: 30000 00000000 00000080 00000400
-# ^ ^ ^-- v1 (0x40000)
+# EXE_GOT_EL: 40000 00000000 00000080 00000300
+# ^ ^ ^-- v1 (0x30000)
# | +-- Module pointer (0x80000000)
# +-- Lazy resolver (0x0)
@@ -69,21 +69,21 @@ v1:
# EXE_DIS_EL: 20000: 18 80 02 3c lui $2, 32792
# DSO_SYM: Sections:
-# DSO_SYM: .got 0000000c 0000000000020000 DATA
+# DSO_SYM: .got 0000000c 0000000000030000 DATA
# DSO_SYM: SYMBOL TABLE:
-# DSO_SYM: 00027ff0 *ABS* 00000000 .hidden _gp
+# DSO_SYM: 00037ff0 *ABS* 00000000 .hidden _gp
# ^-- .got + GP offset (0x7ff0)
-# DSO_SYM: 00030000 g .data 00000004 v1
+# DSO_SYM: 00020000 g .data 00000004 v1
# DSO_GOT_BE: Contents of section .got:
-# DSO_GOT_BE: 20000 00000000 80000000 00030000
-# ^ ^ ^-- v1 (0x30000)
+# DSO_GOT_BE: 30000 00000000 80000000 00020000
+# ^ ^ ^-- v1 (0x20000)
# | +-- Module pointer (0x80000000)
# +-- Lazy resolver (0x0)
# DSO_GOT_EL: Contents of section .got:
-# DSO_GOT_EL: 20000 00000000 00000080 00000300
-# ^ ^ ^-- v1 (0x30000)
+# DSO_GOT_EL: 30000 00000000 00000080 00000200
+# ^ ^ ^-- v1 (0x20000)
# | +-- Module pointer (0x80000000)
# +-- Lazy resolver (0x0)
diff --git a/test/ELF/mips-got-weak.s b/test/ELF/mips-got-weak.s
index a77924692a10..f1faf7c3d2d7 100644
--- a/test/ELF/mips-got-weak.s
+++ b/test/ELF/mips-got-weak.s
@@ -15,7 +15,7 @@
# NOSYM: Symbol {
# NOSYM: Name: foo
-# NOSYM-NEXT: Value: 0x30000
+# NOSYM-NEXT: Value: 0x20000
# NOSYM-NEXT: Size: 0
# NOSYM-NEXT: Binding: Weak
# NOSYM-NEXT: Type: None
@@ -33,7 +33,7 @@
# NOSYM-NEXT: }
# NOSYM-NEXT: Symbol {
# NOSYM-NEXT: Name: sym
-# NOSYM-NEXT: Value: 0x30004
+# NOSYM-NEXT: Value: 0x20004
# NOSYM-NEXT: Size: 0
# NOSYM-NEXT: Binding: Global
# NOSYM-NEXT: Type: None
@@ -47,16 +47,16 @@
# NOSYM-NEXT: 0x70000013 MIPS_GOTSYM 0x1
# NOSYM: Primary GOT {
-# NOSYM-NEXT: Canonical gp value: 0x27FF0
+# NOSYM-NEXT: Canonical gp value: 0x37FF0
# NOSYM-NEXT: Reserved entries [
# NOSYM-NEXT: Entry {
-# NOSYM-NEXT: Address: 0x20000
+# NOSYM-NEXT: Address: 0x30000
# NOSYM-NEXT: Access: -32752
# NOSYM-NEXT: Initial: 0x0
# NOSYM-NEXT: Purpose: Lazy resolver
# NOSYM-NEXT: }
# NOSYM-NEXT: Entry {
-# NOSYM-NEXT: Address: 0x20004
+# NOSYM-NEXT: Address: 0x30004
# NOSYM-NEXT: Access: -32748
# NOSYM-NEXT: Initial: 0x80000000
# NOSYM-NEXT: Purpose: Module pointer (GNU extension)
@@ -66,16 +66,16 @@
# NOSYM-NEXT: ]
# NOSYM-NEXT: Global entries [
# NOSYM-NEXT: Entry {
-# NOSYM-NEXT: Address: 0x20008
+# NOSYM-NEXT: Address: 0x30008
# NOSYM-NEXT: Access: -32744
-# NOSYM-NEXT: Initial: 0x30000
-# NOSYM-NEXT: Value: 0x30000
+# NOSYM-NEXT: Initial: 0x20000
+# NOSYM-NEXT: Value: 0x20000
# NOSYM-NEXT: Type: None
# NOSYM-NEXT: Section: .data
# NOSYM-NEXT: Name: foo
# NOSYM-NEXT: }
# NOSYM-NEXT: Entry {
-# NOSYM-NEXT: Address: 0x2000C
+# NOSYM-NEXT: Address: 0x3000C
# NOSYM-NEXT: Access: -32740
# NOSYM-NEXT: Initial: 0x0
# NOSYM-NEXT: Value: 0x0
@@ -84,10 +84,10 @@
# NOSYM-NEXT: Name: bar
# NOSYM-NEXT: }
# NOSYM-NEXT: Entry {
-# NOSYM-NEXT: Address: 0x20010
+# NOSYM-NEXT: Address: 0x30010
# NOSYM-NEXT: Access: -32736
-# NOSYM-NEXT: Initial: 0x30004
-# NOSYM-NEXT: Value: 0x30004
+# NOSYM-NEXT: Initial: 0x20004
+# NOSYM-NEXT: Value: 0x20004
# NOSYM-NEXT: Type: None
# NOSYM-NEXT: Section: .data
# NOSYM-NEXT: Name: sym
@@ -115,16 +115,16 @@
# SYM-NEXT: 0x70000013 MIPS_GOTSYM 0x3
# SYM: Primary GOT {
-# SYM-NEXT: Canonical gp value: 0x27FF0
+# SYM-NEXT: Canonical gp value: 0x37FF0
# SYM-NEXT: Reserved entries [
# SYM-NEXT: Entry {
-# SYM-NEXT: Address: 0x20000
+# SYM-NEXT: Address: 0x30000
# SYM-NEXT: Access: -32752
# SYM-NEXT: Initial: 0x0
# SYM-NEXT: Purpose: Lazy resolver
# SYM-NEXT: }
# SYM-NEXT: Entry {
-# SYM-NEXT: Address: 0x20004
+# SYM-NEXT: Address: 0x30004
# SYM-NEXT: Access: -32748
# SYM-NEXT: Initial: 0x80000000
# SYM-NEXT: Purpose: Module pointer (GNU extension)
@@ -132,19 +132,19 @@
# SYM-NEXT: ]
# SYM-NEXT: Local entries [
# SYM-NEXT: Entry {
-# SYM-NEXT: Address: 0x20008
+# SYM-NEXT: Address: 0x30008
# SYM-NEXT: Access: -32744
-# SYM-NEXT: Initial: 0x30000
+# SYM-NEXT: Initial: 0x20000
# SYM-NEXT: }
# SYM-NEXT: Entry {
-# SYM-NEXT: Address: 0x2000C
+# SYM-NEXT: Address: 0x3000C
# SYM-NEXT: Access: -32740
-# SYM-NEXT: Initial: 0x30004
+# SYM-NEXT: Initial: 0x20004
# SYM-NEXT: }
# SYM-NEXT: ]
# SYM-NEXT: Global entries [
# SYM-NEXT: Entry {
-# SYM-NEXT: Address: 0x20010
+# SYM-NEXT: Address: 0x30010
# SYM-NEXT: Access: -32736
# SYM-NEXT: Initial: 0x0
# SYM-NEXT: Value: 0x0
diff --git a/test/ELF/mips-got16.s b/test/ELF/mips-got16.s
index c4c14e46607c..b7e04ad93b3f 100644
--- a/test/ELF/mips-got16.s
+++ b/test/ELF/mips-got16.s
@@ -22,23 +22,23 @@
# CHECK-NEXT: 10028: 8f 88 80 34 lw $8, -32716($gp)
#
# CHECK: SYMBOL TABLE:
-# CHECK: 00051008 .data 00000000 .hidden bar
+# CHECK: 00041008 .data 00000000 .hidden bar
# CHECK: 00000000 *UND* 00000000 foo
# GOT: Relocations [
# GOT-NEXT: ]
# GOT: Primary GOT {
-# GOT-NEXT: Canonical gp value: 0x27FF0
+# GOT-NEXT: Canonical gp value: 0x57FF0
# GOT-NEXT: Reserved entries [
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x20000
+# GOT-NEXT: Address: 0x50000
# GOT-NEXT: Access: -32752
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Purpose: Lazy resolver
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x20004
+# GOT-NEXT: Address: 0x50004
# GOT-NEXT: Access: -32748
# GOT-NEXT: Initial: 0x80000000
# GOT-NEXT: Purpose: Module pointer (GNU extension)
@@ -46,52 +46,52 @@
# GOT-NEXT: ]
# GOT-NEXT: Local entries [
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x20008
+# GOT-NEXT: Address: 0x50008
# GOT-NEXT: Access: -32744
# GOT-NEXT: Initial: 0x10000
# ^-- (0x1002c + 0x8000) & ~0xffff
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x2000C
+# GOT-NEXT: Address: 0x5000C
# GOT-NEXT: Access: -32740
# GOT-NEXT: Initial: 0x20000
# ^-- redundant unused entry
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x20010
+# GOT-NEXT: Address: 0x50010
# GOT-NEXT: Access: -32736
-# GOT-NEXT: Initial: 0x30000
+# GOT-NEXT: Initial: 0x20000
# ^-- redundant unused entry
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x20014
+# GOT-NEXT: Address: 0x50014
# GOT-NEXT: Access: -32732
-# GOT-NEXT: Initial: 0x40000
-# ^-- (0x39000 + 0x8000) & ~0xffff
+# GOT-NEXT: Initial: 0x30000
+# ^-- (0x29000 + 0x8000) & ~0xffff
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x20018
+# GOT-NEXT: Address: 0x50018
# GOT-NEXT: Access: -32728
-# GOT-NEXT: Initial: 0x50000
-# ^-- (0x39000 + 0x10004 + 0x8000) & ~0xffff
-# ^-- (0x39000 + 0x18004 + 0x8000) & ~0xffff
+# GOT-NEXT: Initial: 0x40000
+# ^-- (0x29000 + 0x10004 + 0x8000) & ~0xffff
+# ^-- (0x29000 + 0x18004 + 0x8000) & ~0xffff
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x2001C
+# GOT-NEXT: Address: 0x5001C
# GOT-NEXT: Access: -32724
-# GOT-NEXT: Initial: 0x60000
+# GOT-NEXT: Initial: 0x50000
# ^-- redundant unused entry
# GOT-NEXT: }
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x20020
+# GOT-NEXT: Address: 0x50020
# GOT-NEXT: Access: -32720
-# GOT-NEXT: Initial: 0x51008
+# GOT-NEXT: Initial: 0x41008
# ^-- 'bar' address
# GOT-NEXT: }
# GOT-NEXT: ]
# GOT-NEXT: Global entries [
# GOT-NEXT: Entry {
-# GOT-NEXT: Address: 0x20024
+# GOT-NEXT: Address: 0x50024
# GOT-NEXT: Access: -32716
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Value: 0x0
diff --git a/test/ELF/mips-gp-ext.s b/test/ELF/mips-gp-ext.s
index 212fd0fd21e4..21879986d514 100644
--- a/test/ELF/mips-gp-ext.s
+++ b/test/ELF/mips-gp-ext.s
@@ -1,17 +1,11 @@
# Check that the linker use a value of _gp symbol defined
# in a linker script to calculate GOT relocations.
-# FIXME: This test is xfailed because there is currently a bug
-# that causes symbols defined by linker scripts to be put in the
-# wrong sections. In particular, `_gp = . + 0x100` ends up in
-# `.text` when it should be in `*ABS*`.
-# XFAIL: *
-
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
# RUN: echo "SECTIONS { \
# RUN: .text : { *(.text) } \
-# RUN: _gp = . + 0x100; \
+# RUN: _gp = ABSOLUTE(.) + 0x100; \
# RUN: .got : { *(.got) } }" > %t.rel.script
# RUN: ld.lld -shared -o %t.rel.so --script %t.rel.script %t.o
# RUN: llvm-objdump -s -t %t.rel.so | FileCheck --check-prefix=REL %s
@@ -26,10 +20,10 @@
# REQUIRES: mips
# REL: Contents of section .text:
-# REL-NEXT: 0000 3c080000 2108010c 8f82ffe4
+# REL-NEXT: 0000 3c080000 2108010c 8f82fff0
# ^-- %hi(_gp_disp)
# ^-- %lo(_gp_disp)
-# ^-- 8 - (0x10c - 0xe8)
+# ^-- 8 - (0x10c - 0xf4)
# G - (GP - .got)
# REL: Contents of section .reginfo:
@@ -38,7 +32,7 @@
# ^-- _gp
# REL: Contents of section .data:
-# REL-NEXT: 0100 fffffef4
+# REL-NEXT: 00f0 fffffef4
# ^-- 0-0x10c
# REL: 00000000 .text 00000000 foo
@@ -46,10 +40,10 @@
# REL: 0000010c *ABS* 00000000 .hidden _gp
# ABS: Contents of section .text:
-# ABS-NEXT: 0000 3c080000 21080200 8f82fef0
+# ABS-NEXT: 0000 3c080000 21080200 8f82fefc
# ^-- %hi(_gp_disp)
# ^-- %lo(_gp_disp)
-# ^-- 8 - (0x200 - 0xe8)
+# ^-- 8 - (0x200 - 0xf4)
# G - (GP - .got)
# ABS: Contents of section .reginfo:
@@ -58,7 +52,7 @@
# ^-- _gp
# ABS: Contents of section .data:
-# ABS-NEXT: 0100 fffffe00
+# ABS-NEXT: 00f0 fffffe00
# ^-- 0-0x200
# ABS: 00000000 .text 00000000 foo
diff --git a/test/ELF/mips-gp-lowest.s b/test/ELF/mips-gp-lowest.s
index b3d30aa35903..86c44b0e94e6 100644
--- a/test/ELF/mips-gp-lowest.s
+++ b/test/ELF/mips-gp-lowest.s
@@ -36,7 +36,7 @@ foo:
# CHECK-NEXT: SHF_MIPS_GPREL
# CHECK-NEXT: SHF_WRITE
# CHECK-NEXT: ]
-# CHECK-NEXT: Address: 0xE4
+# CHECK-NEXT: Address: 0xF0
# CHECK: }
# CHECK: Name: _gp (5)
diff --git a/test/ELF/mips-hilo-gp-disp.s b/test/ELF/mips-hilo-gp-disp.s
index 16eab06e7b88..0edc29210914 100644
--- a/test/ELF/mips-hilo-gp-disp.s
+++ b/test/ELF/mips-hilo-gp-disp.s
@@ -22,34 +22,34 @@ bar:
# EXE: Disassembly of section .text:
# EXE-NEXT: __start:
-# EXE-NEXT: 20000: 3c 08 00 01 lui $8, 1
-# ^-- %hi(0x37ff0-0x20000)
+# EXE-NEXT: 20000: 3c 08 00 02 lui $8, 2
+# ^-- %hi(0x47ff0-0x20000)
# EXE-NEXT: 20004: 21 08 7f f0 addi $8, $8, 32752
-# ^-- %lo(0x37ff0-0x20004+4)
+# ^-- %lo(0x47ff0-0x20004+4)
# EXE: bar:
-# EXE-NEXT: 2000c: 3c 08 00 01 lui $8, 1
-# ^-- %hi(0x37ff0-0x2000c)
+# EXE-NEXT: 2000c: 3c 08 00 02 lui $8, 2
+# ^-- %hi(0x47ff0-0x2000c)
# EXE-NEXT: 20010: 21 08 7f e4 addi $8, $8, 32740
-# ^-- %lo(0x37ff0-0x20010+4)
+# ^-- %lo(0x47ff0-0x20010+4)
# EXE: SYMBOL TABLE:
# EXE: 0002000c .text 00000000 bar
-# EXE: 00037ff0 *ABS* 00000000 .hidden _gp
+# EXE: 00047ff0 *ABS* 00000000 .hidden _gp
# EXE: 00020000 .text 00000000 __start
# SO: Disassembly of section .text:
# SO-NEXT: __start:
-# SO-NEXT: 10000: 3c 08 00 01 lui $8, 1
-# ^-- %hi(0x27ff0-0x10000)
+# SO-NEXT: 10000: 3c 08 00 02 lui $8, 2
+# ^-- %hi(0x37ff0-0x10000)
# SO-NEXT: 10004: 21 08 7f f0 addi $8, $8, 32752
-# ^-- %lo(0x27ff0-0x10004+4)
+# ^-- %lo(0x37ff0-0x10004+4)
# SO: bar:
-# SO-NEXT: 1000c: 3c 08 00 01 lui $8, 1
-# ^-- %hi(0x27ff0-0x1000c)
+# SO-NEXT: 1000c: 3c 08 00 02 lui $8, 2
+# ^-- %hi(0x37ff0-0x1000c)
# SO-NEXT: 10010: 21 08 7f e4 addi $8, $8, 32740
-# ^-- %lo(0x27ff0-0x10010+4)
+# ^-- %lo(0x37ff0-0x10010+4)
# SO: SYMBOL TABLE:
# SO: 0001000c .text 00000000 bar
-# SO: 00027ff0 *ABS* 00000000 .hidden _gp
+# SO: 00037ff0 *ABS* 00000000 .hidden _gp
# SO: 00010000 .text 00000000 __start
diff --git a/test/ELF/mips-hilo.s b/test/ELF/mips-hilo.s
index 4f1452831ae6..d5de9422c427 100644
--- a/test/ELF/mips-hilo.s
+++ b/test/ELF/mips-hilo.s
@@ -34,20 +34,20 @@ g1:
# CHECK-NEXT: __start:
# CHECK-NEXT: 20000: 3c 08 00 02 lui $8, 2
# ^-- %hi(__start+4)
-# CHECK-NEXT: 20004: 3c 09 00 04 lui $9, 4
+# CHECK-NEXT: 20004: 3c 09 00 03 lui $9, 3
# ^-- %hi(g1+8)
# CHECK-NEXT: 20008: 21 08 00 04 addi $8, $8, 4
# ^-- %lo(__start+4)
# CHECK-NEXT: 2000c: 21 08 00 0c addi $8, $8, 12
# ^-- %lo(g1+8)
-# CHECK-NEXT: 20010: 3c 08 00 05 lui $8, 5
+# CHECK-NEXT: 20010: 3c 08 00 04 lui $8, 4
# ^-- %hi(l1+0x10000-4)
-# CHECK-NEXT: 20014: 3c 09 00 06 lui $9, 6
+# CHECK-NEXT: 20014: 3c 09 00 05 lui $9, 5
# ^-- %hi(l1+0x20000-4)
# CHECK-NEXT: 20018: 21 08 ff fc addi $8, $8, -4
# ^-- %lo(l1-4)
# CHECK: SYMBOL TABLE:
-# CHECK: 0040000 l .data 00000004 l1
+# CHECK: 0030000 l .data 00000004 l1
# CHECK: 0020000 .text 00000000 __start
-# CHECK: 0040004 g .data 00000004 g1
+# CHECK: 0030004 g .data 00000004 g1
diff --git a/test/ELF/mips-options.s b/test/ELF/mips-options.s
index f48ecad81d26..34bf48898116 100644
--- a/test/ELF/mips-options.s
+++ b/test/ELF/mips-options.s
@@ -17,11 +17,11 @@ __start:
lui $gp, %hi(%neg(%gp_rel(g1)))
# CHECK: Name: _gp
-# CHECK-NEXT: Value: 0x100008250
+# CHECK-NEXT: Value: 0x100008258
# CHECK: MIPS Options {
# CHECK-NEXT: ODK_REGINFO {
-# CHECK-NEXT: GP: 0x100008250
+# CHECK-NEXT: GP: 0x100008258
# CHECK-NEXT: General Mask: 0x10000001
# CHECK-NEXT: Co-Proc Mask0: 0x0
# CHECK-NEXT: Co-Proc Mask1: 0x0
diff --git a/test/ELF/mips-pc-relocs.s b/test/ELF/mips-pc-relocs.s
index 209d7d2971f5..e0f39e7ed7c4 100644
--- a/test/ELF/mips-pc-relocs.s
+++ b/test/ELF/mips-pc-relocs.s
@@ -38,8 +38,8 @@ __start:
# ^-- %lo(0x20020-0x20014)
# CHECK: Contents of section .data:
-# CHECK-NEXT: 40000 fffe0028 00000000 00000000 00000000
-# ^-- 0x20020 + 8 - 0x40000
+# CHECK-NEXT: 30000 ffff0028 00000000 00000000 00000000
+# ^-- 0x20020 + 8 - 0x30000
# CHECK: 00020000 .text 00000000 __start
# CHECK: 00020020 .text 00000000 _foo
diff --git a/test/ELF/mips-plt-r6.s b/test/ELF/mips-plt-r6.s
index 8685d6158f78..ccf233cc73cd 100644
--- a/test/ELF/mips-plt-r6.s
+++ b/test/ELF/mips-plt-r6.s
@@ -18,7 +18,7 @@
#
# CHECK-NEXT: Disassembly of section .plt:
# CHECK-NEXT: .plt:
-# CHECK-NEXT: 20010: 3c 1c 00 04 aui $zero, $gp, 4
+# CHECK-NEXT: 20010: 3c 1c 00 03 aui $zero, $gp, 3
# CHECK-NEXT: 20014: 8f 99 00 04 lw $25, 4($gp)
# CHECK-NEXT: 20018: 27 9c 00 04 addiu $gp, $gp, 4
# CHECK-NEXT: 2001c: 03 1c c0 23 subu $24, $24, $gp
@@ -27,7 +27,7 @@
# CHECK-NEXT: 20028: 03 20 f8 09 jalr $25
# CHECK-NEXT: 2002c: 27 18 ff fe addiu $24, $24, -2
-# CHECK-NEXT: 20030: 3c 0f 00 04 aui $zero, $15, 4
+# CHECK-NEXT: 20030: 3c 0f 00 03 aui $zero, $15, 3
# CHECK-NEXT: 20034: 8d f9 00 0c lw $25, 12($15)
# CHECK-NEXT: 20038: 03 20 00 09 jr $25
# CHECK-NEXT: 2003c: 25 f8 00 0c addiu $24, $15, 12
diff --git a/test/ELF/mips-tls-64.s b/test/ELF/mips-tls-64.s
index 808fa4cbd1d7..39459cf2efac 100644
--- a/test/ELF/mips-tls-64.s
+++ b/test/ELF/mips-tls-64.s
@@ -23,26 +23,26 @@
# DIS-NEXT: 20010: 24 62 80 58 addiu $2, $3, -32680
# DIS: Contents of section .got:
-# DIS-NEXT: 30008 00000000 00000000 80000000 00000000
-# DIS-NEXT: 30018 00000000 00000000 00000000 00000000
-# DIS-NEXT: 30028 00000000 00000000 00000000 00000001
-# DIS-NEXT: 30038 00000000 00000000 00000000 00000001
-# DIS-NEXT: 30048 ffffffff ffff8004 ffffffff ffff9004
+# DIS-NEXT: 40008 00000000 00000000 80000000 00000000
+# DIS-NEXT: 40018 00000000 00000000 00000000 00000000
+# DIS-NEXT: 40028 00000000 00000000 00000000 00000001
+# DIS-NEXT: 40038 00000000 00000000 00000000 00000001
+# DIS-NEXT: 40048 ffffffff ffff8004 ffffffff ffff9004
-# DIS: 0000000000030000 l .tdata 00000000 .tdata
-# DIS: 0000000000030000 l .tdata 00000000 loc
+# DIS: 0000000000040000 l .tdata 00000000 .tdata
+# DIS: 0000000000040000 l .tdata 00000000 loc
# DIS: 0000000000000004 g .tdata 00000000 bar
# DIS: 0000000000000000 g *UND* 00000000 foo
# CHECK: Relocations [
# CHECK-NEXT: Section (7) .rela.dyn {
-# CHECK-NEXT: 0x30018 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
-# CHECK-NEXT: 0x30020 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
-# CHECK-NEXT: 0x30028 R_MIPS_TLS_TPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
+# CHECK-NEXT: 0x40018 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
+# CHECK-NEXT: 0x40020 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
+# CHECK-NEXT: 0x40028 R_MIPS_TLS_TPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK-NEXT: Primary GOT {
-# CHECK-NEXT: Canonical gp value: 0x37FF8
+# CHECK-NEXT: Canonical gp value: 0x47FF8
# CHECK-NEXT: Reserved entries [
# CHECK: ]
# CHECK-NEXT: Local entries [
diff --git a/test/ELF/mips-tls-static-64.s b/test/ELF/mips-tls-static-64.s
index e7baf67bb295..6f88e86a3f44 100644
--- a/test/ELF/mips-tls-static-64.s
+++ b/test/ELF/mips-tls-static-64.s
@@ -8,8 +8,8 @@
# REQUIRES: mips
# CHECK: Contents of section .data:
-# CHECK-NEXT: 40000 00020004 ffffffff ffff8004 ffffffff
-# CHECK-NEXT: 40010 ffff9004
+# CHECK-NEXT: 30000 00020004 ffffffff ffff8004 ffffffff
+# CHECK-NEXT: 30010 ffff9004
#
# CHECK: SYMBOL TABLE:
# CHECK: 0000000000020004 .text 00000000 __tls_get_addr
diff --git a/test/ELF/mips-tls-static.s b/test/ELF/mips-tls-static.s
index 6f0fa559ae0d..c8571a2658e2 100644
--- a/test/ELF/mips-tls-static.s
+++ b/test/ELF/mips-tls-static.s
@@ -7,11 +7,11 @@
# REQUIRES: mips
-# CHECK: Contents of section .got:
-# CHECK-NEXT: 30008 00000000 80000000 00000001 ffff8000
-# CHECK-NEXT: 30018 00000001 00000000 ffff9000
# CHECK: Contents of section .data:
-# CHECK-NEXT: 40000 0002000c ffff8004 ffff9004
+# CHECK-NEXT: 30000 0002000c ffff8004 ffff9004
+# CHECK: Contents of section .got:
+# CHECK-NEXT: 40008 00000000 80000000 00000001 ffff8000
+# CHECK-NEXT: 40018 00000001 00000000 ffff9000
#
# CHECK: SYMBOL TABLE:
# CHECK: 0002000c .text 00000000 __tls_get_addr
diff --git a/test/ELF/mips-tls.s b/test/ELF/mips-tls.s
index fa02324fd850..7bca4773c995 100644
--- a/test/ELF/mips-tls.s
+++ b/test/ELF/mips-tls.s
@@ -23,24 +23,24 @@
# DIS-NEXT: 20010: 24 62 80 34 addiu $2, $3, -32716
# DIS: Contents of section .got:
-# DIS-NEXT: 30008 00000000 80000000 00000000 00000000
-# DIS-NEXT: 30018 00000000 00000001 00000000 00000001
-# DIS-NEXT: 30028 ffff8004 ffff9004
+# DIS-NEXT: 40008 00000000 80000000 00000000 00000000
+# DIS-NEXT: 40018 00000000 00000001 00000000 00000001
+# DIS-NEXT: 40028 ffff8004 ffff9004
-# DIS: 00030000 l .tdata 00000000 .tdata
-# DIS: 00030000 l .tdata 00000000 loc
+# DIS: 00040000 l .tdata 00000000 .tdata
+# DIS: 00040000 l .tdata 00000000 loc
# DIS: 00000004 g .tdata 00000000 bar
# DIS: 00000000 g *UND* 00000000 foo
# CHECK: Relocations [
# CHECK-NEXT: Section (7) .rel.dyn {
-# CHECK-NEXT: 0x30010 R_MIPS_TLS_DTPMOD32 foo 0x0
-# CHECK-NEXT: 0x30014 R_MIPS_TLS_DTPREL32 foo 0x0
-# CHECK-NEXT: 0x30018 R_MIPS_TLS_TPREL32 foo 0x0
+# CHECK-NEXT: 0x40010 R_MIPS_TLS_DTPMOD32 foo 0x0
+# CHECK-NEXT: 0x40014 R_MIPS_TLS_DTPREL32 foo 0x0
+# CHECK-NEXT: 0x40018 R_MIPS_TLS_TPREL32 foo 0x0
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK-NEXT: Primary GOT {
-# CHECK-NEXT: Canonical gp value: 0x37FF8
+# CHECK-NEXT: Canonical gp value: 0x47FF8
# CHECK-NEXT: Reserved entries [
# CHECK: ]
# CHECK-NEXT: Local entries [
diff --git a/test/ELF/mips-xgot-order.s b/test/ELF/mips-xgot-order.s
index d249715bafa5..b235c0c6b09c 100644
--- a/test/ELF/mips-xgot-order.s
+++ b/test/ELF/mips-xgot-order.s
@@ -20,15 +20,15 @@
# CHECK-NEXT: 20018: 20 42 00 00 addi $2, $2, 0
# CHECK: Contents of section .got:
-# CHECK-NEXT: 30000 00000000 80000000 00040000 00050000
+# CHECK-NEXT: 40000 00000000 80000000 00030000 00040000
# ^ %hi(loc)
# ^ redundant entry
-# CHECK-NEXT: 30010 00020010 00020000 00040000
+# CHECK-NEXT: 40010 00020010 00020000 00030000
# ^ %got(bar)
# ^ %got_hi/lo(start)
# ^ %got_hi/lo(loc)
-# CHECK: 00040000 .data 00000000 loc
+# CHECK: 00030000 .data 00000000 loc
# CHECK: 00020000 .text 00000000 __start
# CHECK: 00020010 .text 00000000 bar
diff --git a/test/ELF/plt-aarch64.s b/test/ELF/plt-aarch64.s
index 9bc6f54743aa..372186b4b1f4 100644
--- a/test/ELF/plt-aarch64.s
+++ b/test/ELF/plt-aarch64.s
@@ -31,7 +31,7 @@
// CHECKDSO-NEXT: SHF_ALLOC
// CHECKDSO-NEXT: SHF_WRITE
// CHECKDSO-NEXT: ]
-// CHECKDSO-NEXT: Address: 0x30000
+// CHECKDSO-NEXT: Address: 0x20000
// CHECKDSO-NEXT: Offset:
// CHECKDSO-NEXT: Size: 48
// CHECKDSO-NEXT: Link:
@@ -41,23 +41,23 @@
// CHECKDSO: Relocations [
// CHECKDSO-NEXT: Section ({{.*}}) .rela.plt {
-// &(.got.plt[3]) = 0x30000 + 3 * 8 = 0x30018
-// CHECKDSO-NEXT: 0x30018 R_AARCH64_JUMP_SLOT foo
+// &(.got.plt[3]) = 0x20000 + 3 * 8 = 0x30018
+// CHECKDSO-NEXT: 0x20018 R_AARCH64_JUMP_SLOT foo
-// &(.got.plt[4]) = 0x30000 + 4 * 8 = 0x30020
-// CHECKDSO-NEXT: 0x30020 R_AARCH64_JUMP_SLOT bar
+// &(.got.plt[4]) = 0x20000 + 4 * 8 = 0x30020
+// CHECKDSO-NEXT: 0x20020 R_AARCH64_JUMP_SLOT bar
-// &(.got.plt[5]) = 0x30000 + 5 * 8 = 0x30028
-// CHECKDSO-NEXT: 0x30028 R_AARCH64_JUMP_SLOT weak
+// &(.got.plt[5]) = 0x20000 + 5 * 8 = 0x30028
+// CHECKDSO-NEXT: 0x20028 R_AARCH64_JUMP_SLOT weak
// CHECKDSO-NEXT: }
// CHECKDSO-NEXT: ]
// DUMPDSO: Contents of section .got.plt:
// .got.plt[0..2] = 0 (reserved)
// .got.plt[3..5] = .plt = 0x10010
-// DUMPDSO-NEXT: 30000 00000000 00000000 00000000 00000000 ................
-// DUMPDSO-NEXT: 30010 00000000 00000000 10000100 00000000 ................
-// DUMPDSO-NEXT: 30020 10000100 00000000 10000100 00000000 ................
+// DUMPDSO-NEXT: 20000 00000000 00000000 00000000 00000000 ................
+// DUMPDSO-NEXT: 20010 00000000 00000000 10000100 00000000 ................
+// DUMPDSO-NEXT: 20020 10000100 00000000 10000100 00000000 ................
// DISASMDSO: _start:
// 0x10030 - 0x10000 = 0x30 = 48
@@ -74,8 +74,8 @@
// DISASMDSO-NEXT: .plt:
// DISASMDSO-NEXT: 10010: f0 7b bf a9 stp x16, x30, [sp, #-16]!
// &(.got.plt[2]) = 0x3000 + 2 * 8 = 0x3010
-// Page(0x30010) - Page(0x10014) = 0x30000 - 0x10000 = 0x20000 = 131072
-// DISASMDSO-NEXT: 10014: 10 01 00 90 adrp x16, #131072
+// Page(0x20010) - Page(0x10014) = 0x20000 - 0x10000 = 0x10000 = 65536
+// DISASMDSO-NEXT: 10014: 90 00 00 90 adrp x16, #65536
// 0x3010 & 0xFFF = 0x10 = 16
// DISASMDSO-NEXT: 10018: 11 0a 40 f9 ldr x17, [x16, #16]
// DISASMDSO-NEXT: 1001c: 10 42 00 91 add x16, x16, #16
@@ -85,24 +85,24 @@
// DISASMDSO-NEXT: 1002c: 1f 20 03 d5 nop
// foo@plt
-// Page(0x30018) - Page(0x10030) = 0x30000 - 0x10000 = 0x20000 = 131072
-// DISASMDSO-NEXT: 10030: 10 01 00 90 adrp x16, #131072
+// Page(0x30018) - Page(0x10030) = 0x20000 - 0x10000 = 0x10000 = 65536
+// DISASMDSO-NEXT: 10030: 90 00 00 90 adrp x16, #65536
// 0x3018 & 0xFFF = 0x18 = 24
// DISASMDSO-NEXT: 10034: 11 0e 40 f9 ldr x17, [x16, #24]
// DISASMDSO-NEXT: 10038: 10 62 00 91 add x16, x16, #24
// DISASMDSO-NEXT: 1003c: 20 02 1f d6 br x17
// bar@plt
-// Page(0x30020) - Page(0x10040) = 0x30000 - 0x10000 = 0x20000 = 131072
-// DISASMDSO-NEXT: 10040: 10 01 00 90 adrp x16, #131072
+// Page(0x30020) - Page(0x10040) = 0x20000 - 0x10000 = 0x10000 = 65536
+// DISASMDSO-NEXT: 10040: 90 00 00 90 adrp x16, #65536
// 0x3020 & 0xFFF = 0x20 = 32
// DISASMDSO-NEXT: 10044: 11 12 40 f9 ldr x17, [x16, #32]
// DISASMDSO-NEXT: 10048: 10 82 00 91 add x16, x16, #32
// DISASMDSO-NEXT: 1004c: 20 02 1f d6 br x17
// weak@plt
-// Page(0x30028) - Page(0x10050) = 0x30000 - 0x10000 = 0x20000 = 131072
-// DISASMDSO-NEXT: 10050: 10 01 00 90 adrp x16, #131072
+// Page(0x30028) - Page(0x10050) = 0x20000 - 0x10000 = 0x10000 = 65536
+// DISASMDSO-NEXT: 10050: 90 00 00 90 adrp x16, #65536
// 0x3028 & 0xFFF = 0x28 = 40
// DISASMDSO-NEXT: 10054: 11 16 40 f9 ldr x17, [x16, #40]
// DISASMDSO-NEXT: 10058: 10 a2 00 91 add x16, x16, #40
@@ -127,7 +127,7 @@
// CHECKEXE-NEXT: SHF_ALLOC
// CHECKEXE-NEXT: SHF_WRITE
// CHECKEXE-NEXT: ]
-// CHECKEXE-NEXT: Address: 0x40000
+// CHECKEXE-NEXT: Address: 0x30000
// CHECKEXE-NEXT: Offset:
// CHECKEXE-NEXT: Size: 40
// CHECKEXE-NEXT: Link:
@@ -137,20 +137,20 @@
// CHECKEXE: Relocations [
// CHECKEXE-NEXT: Section ({{.*}}) .rela.plt {
-// &(.got.plt[3]) = 0x13000 + 3 * 8 = 0x13018
-// CHECKEXE-NEXT: 0x40018 R_AARCH64_JUMP_SLOT bar 0x0
+// &(.got.plt[3]) = 0x30000 + 3 * 8 = 0x30018
+// CHECKEXE-NEXT: 0x30018 R_AARCH64_JUMP_SLOT bar 0x0
-// &(.got.plt[4]) = 0x13000 + 4 * 8 = 0x13020
-// CHECKEXE-NEXT: 0x40020 R_AARCH64_JUMP_SLOT weak 0x0
+// &(.got.plt[4]) = 0x30000 + 4 * 8 = 0x30020
+// CHECKEXE-NEXT: 0x30020 R_AARCH64_JUMP_SLOT weak 0x0
// CHECKEXE-NEXT: }
// CHECKEXE-NEXT: ]
// DUMPEXE: Contents of section .got.plt:
// .got.plt[0..2] = 0 (reserved)
// .got.plt[3..4] = .plt = 0x40010
-// DUMPEXE-NEXT: 40000 00000000 00000000 00000000 00000000 ................
-// DUMPEXE-NEXT: 40010 00000000 00000000 10000200 00000000 ................
-// DUMPEXE-NEXT: 40020 10000200 00000000 ........
+// DUMPEXE-NEXT: 30000 00000000 00000000 00000000 00000000 ................
+// DUMPEXE-NEXT: 30010 00000000 00000000 10000200 00000000 ................
+// DUMPEXE-NEXT: 30020 10000200 00000000 ........
// DISASMEXE: _start:
// 0x2000c - 0x20000 = 0xc = 12
@@ -167,8 +167,8 @@
// DISASMEXE-NEXT: .plt:
// DISASMEXE-NEXT: 20010: f0 7b bf a9 stp x16, x30, [sp, #-16]!
// &(.got.plt[2]) = 0x300B0 + 2 * 8 = 0x300C0
-// Page(0x40010) - Page(0x20014) = 0x40000 - 0x20000 = 0x20000 = 131072
-// DISASMEXE-NEXT: 20014: 10 01 00 90 adrp x16, #131072
+// Page(0x30010) - Page(0x20014) = 0x30000 - 0x20000 = 0x10000 = 65536
+// DISASMEXE-NEXT: 20014: 90 00 00 90 adrp x16, #65536
// 0x120c0 & 0xFFF = 0xC0 = 192
// DISASMEXE-NEXT: 20018: 11 0a 40 f9 ldr x17, [x16, #16]
// DISASMEXE-NEXT: 2001c: 10 42 00 91 add x16, x16, #16
@@ -178,15 +178,15 @@
// DISASMEXE-NEXT: 2002c: 1f 20 03 d5 nop
// bar@plt
-// Page(0x40018) - Page(0x20030) = 0x40000 - 0x20000 = 0x20000 = 131072
-// DISASMEXE-NEXT: 20030: 10 01 00 90 adrp x16, #131072
+// Page(0x40018) - Page(0x20030) = 0x30000 - 0x20000 = 0x10000 = 65536
+// DISASMEXE-NEXT: 20030: 90 00 00 90 adrp x16, #65536
// DISASMEXE-NEXT: 20034: 11 0e 40 f9 ldr x17, [x16, #24]
// DISASMEXE-NEXT: 20038: 10 62 00 91 add x16, x16, #24
// DISASMEXE-NEXT: 2003c: 20 02 1f d6 br x17
// weak@plt
-// Page(0x40020) - Page(0x20040) = 0x40000 - 0x20000 = 0x20000 = 131072
-// DISASMEXE-NEXT: 20040: 10 01 00 90 adrp x16, #131072
+// Page(0x40020) - Page(0x20040) = 0x30000 - 0x20000 = 0x10000 = 65536
+// DISASMEXE-NEXT: 20040: 90 00 00 90 adrp x16, #65536
// DISASMEXE-NEXT: 20044: 11 12 40 f9 ldr x17, [x16, #32]
// DISASMEXE-NEXT: 20048: 10 82 00 91 add x16, x16, #32
// DISASMEXE-NEXT: 2004c: 20 02 1f d6 br x17
diff --git a/test/ELF/plt-i686.s b/test/ELF/plt-i686.s
index bf07fede7989..e169bd4d70f5 100644
--- a/test/ELF/plt-i686.s
+++ b/test/ELF/plt-i686.s
@@ -30,20 +30,20 @@
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x13000
-// CHECK-NEXT: Offset: 0x3000
+// CHECK-NEXT: Address: 0x12000
+// CHECK-NEXT: Offset: 0x2000
// CHECK-NEXT: Size: 20
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
// CHECK-NEXT: AddressAlignment: 4
// CHECK-NEXT: EntrySize: 0
-// 0x13000 + got.plt.reserved(12) = 0x1300C
-// 0x13000 + got.plt.reserved(12) + 4 = 0x13010
+// 0x12000 + got.plt.reserved(12) = 0x1200C
+// 0x12000 + got.plt.reserved(12) + 4 = 0x12010
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rel.plt {
-// CHECK-NEXT: 0x1300C R_386_JUMP_SLOT bar 0x0
-// CHECK-NEXT: 0x13010 R_386_JUMP_SLOT zed 0x0
+// CHECK-NEXT: 0x1200C R_386_JUMP_SLOT bar 0x0
+// CHECK-NEXT: 0x12010 R_386_JUMP_SLOT zed 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
@@ -73,16 +73,16 @@
// 77840 = 0x13010 = .got.plt (0x13000) + got.plt.reserved(12) + 4
// DISASM: Disassembly of section .plt:
// DISASM-NEXT: .plt:
-// DISASM-NEXT: 11020: ff 35 04 30 01 00 pushl 77828
-// DISASM-NEXT: 11026: ff 25 08 30 01 00 jmpl *77832
+// DISASM-NEXT: 11020: ff 35 04 20 01 00 pushl 73732
+// DISASM-NEXT: 11026: ff 25 08 20 01 00 jmpl *73736
// DISASM-NEXT: 1102c: 90 nop
// DISASM-NEXT: 1102d: 90 nop
// DISASM-NEXT: 1102e: 90 nop
// DISASM-NEXT: 1102f: 90 nop
-// DISASM-NEXT: 11030: ff 25 0c 30 01 00 jmpl *77836
+// DISASM-NEXT: 11030: ff 25 0c 20 01 00 jmpl *73740
// DISASM-NEXT: 11036: 68 00 00 00 00 pushl $0
// DISASM-NEXT: 1103b: e9 e0 ff ff ff jmp -32 <.plt>
-// DISASM-NEXT: 11040: ff 25 10 30 01 00 jmpl *77840
+// DISASM-NEXT: 11040: ff 25 10 20 01 00 jmpl *73744
// DISASM-NEXT: 11046: 68 08 00 00 00 pushl $8
// DISASM-NEXT: 1104b: e9 d0 ff ff ff jmp -48 <.plt>
@@ -106,8 +106,8 @@
// CHECKSHARED-NEXT: SHF_ALLOC
// CHECKSHARED-NEXT: SHF_WRITE
// CHECKSHARED-NEXT: ]
-// CHECKSHARED-NEXT: Address: 0x3000
-// CHECKSHARED-NEXT: Offset: 0x3000
+// CHECKSHARED-NEXT: Address: 0x2000
+// CHECKSHARED-NEXT: Offset: 0x2000
// CHECKSHARED-NEXT: Size: 20
// CHECKSHARED-NEXT: Link: 0
// CHECKSHARED-NEXT: Info: 0
@@ -115,12 +115,12 @@
// CHECKSHARED-NEXT: EntrySize: 0
// CHECKSHARED-NEXT: }
-// 0x3000 + got.plt.reserved(12) = 0x300C
-// 0x3000 + got.plt.reserved(12) + 4 = 0x3010
+// 0x2000 + got.plt.reserved(12) = 0x200C
+// 0x2000 + got.plt.reserved(12) + 4 = 0x2010
// CHECKSHARED: Relocations [
// CHECKSHARED-NEXT: Section ({{.*}}) .rel.plt {
-// CHECKSHARED-NEXT: 0x300C R_386_JUMP_SLOT bar 0x0
-// CHECKSHARED-NEXT: 0x3010 R_386_JUMP_SLOT zed 0x0
+// CHECKSHARED-NEXT: 0x200C R_386_JUMP_SLOT bar 0x0
+// CHECKSHARED-NEXT: 0x2010 R_386_JUMP_SLOT zed 0x0
// CHECKSHARED-NEXT: }
// CHECKSHARED-NEXT: ]
@@ -156,10 +156,10 @@
// DISASMPIE-NEXT: 102d: 90 nop
// DISASMPIE-NEXT: 102e: 90 nop
// DISASMPIE-NEXT: 102f: 90 nop
-// DISASMPIE-NEXT: 1030: ff a3 0c 30 00 00 jmpl *12300(%ebx)
+// DISASMPIE-NEXT: 1030: ff a3 0c 20 00 00 jmpl *8204(%ebx)
// DISASMPIE-NEXT: 1036: 68 00 00 00 00 pushl $0
// DISASMPIE-NEXT: 103b: e9 e0 ff ff ff jmp -32 <.plt>
-// DISASMPIE-NEXT: 1040: ff a3 10 30 00 00 jmpl *12304(%ebx)
+// DISASMPIE-NEXT: 1040: ff a3 10 20 00 00 jmpl *8208(%ebx)
// DISASMPIE-NEXT: 1046: 68 08 00 00 00 pushl $8
// DISASMPIE-NEXT: 104b: e9 d0 ff ff ff jmp -48 <.plt>
diff --git a/test/ELF/plt.s b/test/ELF/plt.s
index 0153e82786ae..4ab81aaaed91 100644
--- a/test/ELF/plt.s
+++ b/test/ELF/plt.s
@@ -25,9 +25,9 @@
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.plt {
-// CHECK-NEXT: 0x3018 R_X86_64_JUMP_SLOT bar 0x0
-// CHECK-NEXT: 0x3020 R_X86_64_JUMP_SLOT zed 0x0
-// CHECK-NEXT: 0x3028 R_X86_64_JUMP_SLOT _start 0x0
+// CHECK-NEXT: 0x2018 R_X86_64_JUMP_SLOT bar 0x0
+// CHECK-NEXT: 0x2020 R_X86_64_JUMP_SLOT zed 0x0
+// CHECK-NEXT: 0x2028 R_X86_64_JUMP_SLOT _start 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
@@ -46,8 +46,8 @@
// CHECK2: Relocations [
// CHECK2-NEXT: Section ({{.*}}) .rela.plt {
-// CHECK2-NEXT: 0x203018 R_X86_64_JUMP_SLOT bar 0x0
-// CHECK2-NEXT: 0x203020 R_X86_64_JUMP_SLOT zed 0x0
+// CHECK2-NEXT: 0x202018 R_X86_64_JUMP_SLOT bar 0x0
+// CHECK2-NEXT: 0x202020 R_X86_64_JUMP_SLOT zed 0x0
// CHECK2-NEXT: }
// CHECK2-NEXT: ]
@@ -65,22 +65,22 @@
// DISASM-NEXT: 100a: e9 {{.*}} jmp 49
// DISASM-NEXT: 100f: e9 {{.*}} jmp 60
-// 0x3018 - 0x1036 = 8162
-// 0x3020 - 0x1046 = 4234
-// 0x3028 - 0x1056 = 4226
+// 0x2018 - 0x1036 = 4066
+// 0x2020 - 0x1046 = 4058
+// 0x2028 - 0x1056 = 4050
// DISASM: Disassembly of section .plt:
// DISASM-NEXT: .plt:
-// DISASM-NEXT: 1020: ff 35 e2 1f 00 00 pushq 8162(%rip)
-// DISASM-NEXT: 1026: ff 25 e4 1f 00 00 jmpq *8164(%rip)
+// DISASM-NEXT: 1020: ff 35 e2 0f 00 00 pushq 4066(%rip)
+// DISASM-NEXT: 1026: ff 25 e4 0f 00 00 jmpq *4068(%rip)
// DISASM-NEXT: 102c: 0f 1f 40 00 nopl (%rax)
-// DISASM-NEXT: 1030: ff 25 e2 1f 00 00 jmpq *8162(%rip)
+// DISASM-NEXT: 1030: ff 25 e2 0f 00 00 jmpq *4066(%rip)
// DISASM-NEXT: 1036: 68 00 00 00 00 pushq $0
// DISASM-NEXT: 103b: e9 e0 ff ff ff jmp -32 <.plt>
-// DISASM-NEXT: 1040: ff 25 da 1f 00 00 jmpq *8154(%rip)
+// DISASM-NEXT: 1040: ff 25 da 0f 00 00 jmpq *4058(%rip)
// DISASM-NEXT: 1046: 68 01 00 00 00 pushq $1
// DISASM-NEXT: 104b: e9 d0 ff ff ff jmp -48 <.plt>
-// DISASM-NEXT: 1050: ff 25 d2 1f 00 00 jmpq *8146(%rip)
+// DISASM-NEXT: 1050: ff 25 d2 0f 00 00 jmpq *4050(%rip)
// DISASM-NEXT: 1056: 68 02 00 00 00 pushq $2
// DISASM-NEXT: 105b: e9 c0 ff ff ff jmp -64 <.plt>
@@ -95,18 +95,18 @@
// DISASM2-NEXT: 20100a: e9 {{.*}} jmp 49
// DISASM2-NEXT: 20100f: e9 {{.*}} jmp -20
-// 0x203018 - 0x201036 = 4242
-// 0x203020 - 0x201046 = 4234
+// 0x202018 - 0x201036 = 4066
+// 0x202020 - 0x201046 = 4058
// DISASM2: Disassembly of section .plt:
// DISASM2-NEXT: .plt:
-// DISASM2-NEXT: 201020: ff 35 e2 1f 00 00 pushq 8162(%rip)
-// DISASM2-NEXT: 201026: ff 25 e4 1f 00 00 jmpq *8164(%rip)
+// DISASM2-NEXT: 201020: ff 35 e2 0f 00 00 pushq 4066(%rip)
+// DISASM2-NEXT: 201026: ff 25 e4 0f 00 00 jmpq *4068(%rip)
// DISASM2-NEXT: 20102c: 0f 1f 40 00 nopl (%rax)
-// DISASM2-NEXT: 201030: ff 25 e2 1f 00 00 jmpq *8162(%rip)
+// DISASM2-NEXT: 201030: ff 25 e2 0f 00 00 jmpq *4066(%rip)
// DISASM2-NEXT: 201036: 68 00 00 00 00 pushq $0
// DISASM2-NEXT: 20103b: e9 e0 ff ff ff jmp -32 <.plt>
-// DISASM2-NEXT: 201040: ff 25 da 1f 00 00 jmpq *8154(%rip)
+// DISASM2-NEXT: 201040: ff 25 da 0f 00 00 jmpq *4058(%rip)
// DISASM2-NEXT: 201046: 68 01 00 00 00 pushq $1
// DISASM2-NEXT: 20104b: e9 d0 ff ff ff jmp -48 <.plt>
// DISASM2-NOT: 2010C0
diff --git a/test/ELF/ppc64-relocs.s b/test/ELF/ppc64-relocs.s
index 28902aed26df..cb6177dfe305 100644
--- a/test/ELF/ppc64-relocs.s
+++ b/test/ELF/ppc64-relocs.s
@@ -43,7 +43,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_TOC16_HI:
# CHECK: .FR_PPC64_TOC16_HI:
-# CHECK: 10010014: 3c 22 ff ff addis 1, 2, -1
+# CHECK: 10010014: 3c 22 ff fe addis 1, 2, -2
.section .R_PPC64_TOC16_HA,"ax",@progbits
.globl .FR_PPC64_TOC16_HA
@@ -52,7 +52,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_TOC16_HA:
# CHECK: .FR_PPC64_TOC16_HA:
-# CHECK: 10010018: 3c 22 00 00 addis 1, 2, 0
+# CHECK: 10010018: 3c 22 ff ff addis 1, 2, -1
.section .R_PPC64_REL24,"ax",@progbits
.globl .FR_PPC64_REL24
diff --git a/test/ELF/ppc64-shared-rel-toc.s b/test/ELF/ppc64-shared-rel-toc.s
index f5cd45936683..445011bf8e26 100644
--- a/test/ELF/ppc64-shared-rel-toc.s
+++ b/test/ELF/ppc64-shared-rel-toc.s
@@ -19,9 +19,9 @@ foo: # @foo
.Lfunc_begin0:
blr
-// CHECK: 0x30000 R_PPC64_RELATIVE - 0x10000
-// CHECK: 0x30008 R_PPC64_RELATIVE - 0x8000
+// CHECK: 0x20000 R_PPC64_RELATIVE - 0x10000
+// CHECK: 0x20008 R_PPC64_RELATIVE - 0x8000
// CHECK: Name: foo
-// CHECK-NEXT: Value: 0x30000
+// CHECK-NEXT: Value: 0x20000
diff --git a/test/ELF/ppc64-toc-restore.s b/test/ELF/ppc64-toc-restore.s
index dbfeaece7db4..0c3d30b2d31a 100644
--- a/test/ELF/ppc64-toc-restore.s
+++ b/test/ELF/ppc64-toc-restore.s
@@ -53,7 +53,7 @@ last:
// CHECK: Disassembly of section .plt:
// CHECK: .plt:
// CHECK: 10010020: f8 41 00 28 std 2, 40(1)
-// CHECK: 10010024: 3d 62 10 03 addis 11, 2, 4099
+// CHECK: 10010024: 3d 62 10 02 addis 11, 2, 4098
// CHECK: 10010028: e9 8b 80 18 ld 12, -32744(11)
// CHECK: 1001002c: e9 6c 00 00 ld 11, 0(12)
// CHECK: 10010030: 7d 69 03 a6 mtctr 11
diff --git a/test/ELF/rel-offset.s b/test/ELF/rel-offset.s
index 6f35bcebc4b0..8044e61c3cb3 100644
--- a/test/ELF/rel-offset.s
+++ b/test/ELF/rel-offset.s
@@ -10,6 +10,6 @@
.quad foo
// CHECK: Section ({{.*}}) .rela.dyn {
-// CHECK-NEXT: 0x2000 R_X86_64_64 foo 0x0
-// CHECK-NEXT: 0x2008 R_X86_64_64 foo 0x0
+// CHECK-NEXT: 0x1000 R_X86_64_64 foo 0x0
+// CHECK-NEXT: 0x1008 R_X86_64_64 foo 0x0
// CHECK-NEXT: }
diff --git a/test/ELF/relative-dynamic-reloc-pie.s b/test/ELF/relative-dynamic-reloc-pie.s
index d9967af52eb6..25b3e0ac2333 100644
--- a/test/ELF/relative-dynamic-reloc-pie.s
+++ b/test/ELF/relative-dynamic-reloc-pie.s
@@ -5,9 +5,9 @@
## Test that we create R_X86_64_RELATIVE relocations with -pie.
# CHECK: Relocations [
# CHECK-NEXT: Section ({{.*}}) .rela.dyn {
-# CHECK-NEXT: 0x3000 R_X86_64_RELATIVE - 0x3000
-# CHECK-NEXT: 0x3008 R_X86_64_RELATIVE - 0x3008
-# CHECK-NEXT: 0x3010 R_X86_64_RELATIVE - 0x3009
+# CHECK-NEXT: 0x2000 R_X86_64_RELATIVE - 0x2000
+# CHECK-NEXT: 0x2008 R_X86_64_RELATIVE - 0x2008
+# CHECK-NEXT: 0x2010 R_X86_64_RELATIVE - 0x2009
# CHECK-NEXT: }
# CHECK-NEXT: ]
diff --git a/test/ELF/relative-dynamic-reloc-ppc64.s b/test/ELF/relative-dynamic-reloc-ppc64.s
index 1df974b087c9..65d0e8e83984 100644
--- a/test/ELF/relative-dynamic-reloc-ppc64.s
+++ b/test/ELF/relative-dynamic-reloc-ppc64.s
@@ -10,10 +10,10 @@
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
// CHECK-NEXT: 0x[[FOO_ADDR:.*]] R_PPC64_RELATIVE - 0x[[FOO_ADDR]]
// CHECK-NEXT: 0x[[BAR_ADDR:.*]] R_PPC64_RELATIVE - 0x[[BAR_ADDR]]
-// CHECK-NEXT: 0x20010 R_PPC64_RELATIVE - 0x20009
+// CHECK-NEXT: 0x10010 R_PPC64_RELATIVE - 0x10009
// CHECK-NEXT: 0x{{.*}} R_PPC64_RELATIVE - 0x[[ZED_ADDR:.*]]
// CHECK-NEXT: 0x{{.*}} R_PPC64_RELATIVE - 0x[[FOO_ADDR]]
-// CHECK-NEXT: 0x20028 R_PPC64_ADDR64 external 0x0
+// CHECK-NEXT: 0x10028 R_PPC64_ADDR64 external 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
diff --git a/test/ELF/relative-dynamic-reloc.s b/test/ELF/relative-dynamic-reloc.s
index 947c86d89024..39382124e889 100644
--- a/test/ELF/relative-dynamic-reloc.s
+++ b/test/ELF/relative-dynamic-reloc.s
@@ -9,10 +9,10 @@
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
// CHECK-NEXT: 0x[[FOO_ADDR:.*]] R_X86_64_RELATIVE - 0x[[FOO_ADDR]]
// CHECK-NEXT: 0x[[BAR_ADDR:.*]] R_X86_64_RELATIVE - 0x[[BAR_ADDR]]
-// CHECK-NEXT: 0x2010 R_X86_64_RELATIVE - 0x2009
+// CHECK-NEXT: 0x1010 R_X86_64_RELATIVE - 0x1009
// CHECK-NEXT: 0x{{.*}} R_X86_64_RELATIVE - 0x[[ZED_ADDR:.*]]
// CHECK-NEXT: 0x{{.*}} R_X86_64_RELATIVE - 0x[[FOO_ADDR]]
-// CHECK-NEXT: 0x2028 R_X86_64_64 external 0x0
+// CHECK-NEXT: 0x1028 R_X86_64_64 external 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
diff --git a/test/ELF/relocation-copy-flags.s b/test/ELF/relocation-copy-flags.s
index 069866865c27..4d97e3d95d24 100644
--- a/test/ELF/relocation-copy-flags.s
+++ b/test/ELF/relocation-copy-flags.s
@@ -30,7 +30,7 @@ _start:
// CHECK-NEXT: AddressAlignment: 4
// CHECK-NEXT: EntrySize: 0
// CHECK-NEXT: SectionData (
-// CHECK-NEXT: 0000: 10302000
+// CHECK-NEXT: 0000: 00402000
// CHECK-NEXT: )
// CHECK: Name: bar
@@ -39,8 +39,8 @@ _start:
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x203000
-// CHECK-NEXT: Offset: 0x3000
+// CHECK-NEXT: Address: 0x202000
+// CHECK-NEXT: Offset: 0x2000
// CHECK-NEXT: Size: 8
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
@@ -55,7 +55,7 @@ _start:
// CHECK-NEXT: Flags [
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x0
-// CHECK-NEXT: Offset: 0x3008
+// CHECK-NEXT: Offset: 0x30B0
// CHECK-NEXT: Size: 8
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
@@ -67,7 +67,7 @@ _start:
// CHECK: Relocations [
// CHECK-NEXT: Section (4) .rela.dyn {
-// CHECK-NEXT: 0x203010 R_X86_64_COPY x 0x0
-// CHECK-NEXT: 0x203000 R_X86_64_64 z 0x0
+// CHECK-NEXT: 0x204000 R_X86_64_COPY x 0x0
+// CHECK-NEXT: 0x202000 R_X86_64_64 z 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
diff --git a/test/ELF/relocation-copy-relro.s b/test/ELF/relocation-copy-relro.s
new file mode 100644
index 000000000000..1684c409e349
--- /dev/null
+++ b/test/ELF/relocation-copy-relro.s
@@ -0,0 +1,32 @@
+// REQUIRES: x86
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/relocation-copy-relro.s -o %t2.o
+// RUN: ld.lld -shared %t2.o -o %t.so
+// RUN: ld.lld %t.o %t.so -o %t3
+// RUN: llvm-readobj -program-headers -s -r %t3 | FileCheck %s
+
+// CHECK: Name: .bss.rel.ro (48)
+// CHECK-NEXT: Type: SHT_NOBITS (0x8)
+// CHECK-NEXT: Flags [ (0x3)
+// CHECK-NEXT: SHF_ALLOC (0x2)
+// CHECK-NEXT: SHF_WRITE (0x1)
+// CHECK-NEXT: ]
+// CHECK-NEXT: Address: 0x2020B0
+// CHECK-NEXT: Offset: 0x20B0
+// CHECK-NEXT: Size: 8
+
+// CHECK: 0x2020B0 R_X86_64_COPY a 0x0
+// CHECK: 0x2020B4 R_X86_64_COPY b 0x0
+
+// CHECK: Type: PT_GNU_RELRO (0x6474E552)
+// CHECK-NEXT: Offset: 0x2000
+// CHECK-NEXT: VirtualAddress: 0x202000
+// CHECK-NEXT: PhysicalAddress: 0x202000
+// CHECK-NEXT: FileSize: 176
+// CHECK-NEXT: MemSize: 4096
+
+.text
+.global _start
+_start:
+movl $1, a
+movl $2, b
diff --git a/test/ELF/relocation-i686.s b/test/ELF/relocation-i686.s
index 262f697184bb..4bb55d9684b0 100644
--- a/test/ELF/relocation-i686.s
+++ b/test/ELF/relocation-i686.s
@@ -49,13 +49,13 @@ movl bar@GOT, %eax
// ADDR-NEXT: Offset: 0x1040
// ADDR-NEXT: Size: 32
-// ADDR: Name: .got
+// ADDR: Name: .got (
// ADDR-NEXT: Type: SHT_PROGBITS
// ADDR-NEXT: Flags [
// ADDR-NEXT: SHF_ALLOC
// ADDR-NEXT: SHF_WRITE
// ADDR-NEXT: ]
-// ADDR-NEXT: Address: 0x12078
+// ADDR-NEXT: Address: 0x13078
// ADDR-NEXT: Offset:
// ADDR-NEXT: Size: 8
@@ -67,7 +67,7 @@ R_386_GOTPC:
// CHECK: Disassembly of section .R_386_GOTPC:
// CHECK-NEXT: R_386_GOTPC:
-// CHECK-NEXT: 11014: {{.*}} movl $4204, %eax
+// CHECK-NEXT: 11014: {{.*}} movl $8300, %eax
.section .dynamic_reloc, "ax",@progbits
call bar
diff --git a/test/ELF/relocation-non-alloc.s b/test/ELF/relocation-non-alloc.s
index 43f6f5ff1e4b..1ad15a4e5787 100644
--- a/test/ELF/relocation-non-alloc.s
+++ b/test/ELF/relocation-non-alloc.s
@@ -10,8 +10,8 @@
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x2000
-// CHECK-NEXT: Offset: 0x2000
+// CHECK-NEXT: Address: 0x1000
+// CHECK-NEXT: Offset: 0x1000
// CHECK-NEXT: Size: 16
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
@@ -33,14 +33,14 @@
// CHECK-NEXT: AddressAlignment: 1
// CHECK-NEXT: EntrySize: 0
// CHECK-NEXT: SectionData (
-// CHECK-NEXT: 0000: 00200000 00000000 00200000 00000000
-// CHECK-NEXT: 0010: 00200000 00000000 00200000 00000000
+// CHECK-NEXT: 0000: 00100000 00000000 00100000 00000000
+// CHECK-NEXT: 0010: 00100000 00000000 00100000 00000000
// CHECK-NEXT: )
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.}}) .rela.dyn {
-// CHECK-NEXT: 0x2000 R_X86_64_RELATIVE - 0x2000
-// CHECK-NEXT: 0x2008 R_X86_64_64 zed 0x0
+// CHECK-NEXT: 0x1000 R_X86_64_RELATIVE - 0x1000
+// CHECK-NEXT: 0x1008 R_X86_64_64 zed 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
diff --git a/test/ELF/relocation-none-i686.test b/test/ELF/relocation-none-i686.test
new file mode 100644
index 000000000000..d8eed8f7a129
--- /dev/null
+++ b/test/ELF/relocation-none-i686.test
@@ -0,0 +1,23 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: ld.lld %t.o -o %t.out
+
+# Test that we can handle R_386_NONE.
+
+!ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_386
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ - Name: .rel.text
+ Type: SHT_RELA
+ Link: .symtab
+ Info: .text
+ Relocations:
+ - Offset: 0x0000000000000000
+ Symbol: ''
+ Type: R_386_NONE
diff --git a/test/ELF/relocation.s b/test/ELF/relocation.s
index 452d1bedba5a..77c766960f46 100644
--- a/test/ELF/relocation.s
+++ b/test/ELF/relocation.s
@@ -16,35 +16,35 @@
// SEC-NEXT: Offset: 0x1030
// SEC-NEXT: Size: 48
-// SEC: Name: .got
+// SEC: Name: .got.plt
// SEC-NEXT: Type: SHT_PROGBITS
// SEC-NEXT: Flags [
// SEC-NEXT: SHF_ALLOC
// SEC-NEXT: SHF_WRITE
// SEC-NEXT: ]
-// SEC-NEXT: Address: 0x2020F0
-// SEC-NEXT: Offset:
-// SEC-NEXT: Size: 8
+// SEC-NEXT: Address: 0x202000
+// SEC-NEXT: Offset: 0x2000
+// SEC-NEXT: Size: 40
// SEC-NEXT: Link: 0
// SEC-NEXT: Info: 0
// SEC-NEXT: AddressAlignment: 8
// SEC-NEXT: EntrySize: 0
-// SEC-NEXT: }
+// SEC-NEXT: }
-// SEC: Name: .got.plt
+// SEC: Name: .got
// SEC-NEXT: Type: SHT_PROGBITS
// SEC-NEXT: Flags [
// SEC-NEXT: SHF_ALLOC
// SEC-NEXT: SHF_WRITE
// SEC-NEXT: ]
-// SEC-NEXT: Address: 0x203000
-// SEC-NEXT: Offset: 0x3000
-// SEC-NEXT: Size: 40
+// SEC-NEXT: Address: 0x2030F0
+// SEC-NEXT: Offset:
+// SEC-NEXT: Size: 8
// SEC-NEXT: Link: 0
// SEC-NEXT: Info: 0
// SEC-NEXT: AddressAlignment: 8
// SEC-NEXT: EntrySize: 0
-// SEC-NEXT: }
+// SEC-NEXT: }
.section .text,"ax",@progbits,unique,1
.global _start
@@ -123,7 +123,7 @@ R_X86_64_GOTPCREL:
// 0x2020F8 - 0x2001D8 = 7952
// 7952 = 0x101f0000 in little endian
// CHECK: Contents of section .R_X86_64_GOTPCREL
-// CHECK-NEXT: 2001d0 201f0000
+// CHECK-NEXT: 2001d0 202f0000
.section .R_X86_64_GOT32,"a",@progbits
.global R_X86_64_GOT32
diff --git a/test/ELF/section-layout.s b/test/ELF/section-layout.s
index 20480919956c..f63066e0d926 100644
--- a/test/ELF/section-layout.s
+++ b/test/ELF/section-layout.s
@@ -34,11 +34,13 @@ _start:
// CHECK: Name: c
// CHECK: Name: d
+// Writable sections appear before TLS and other relro sections.
+// CHECK: Name: i
+
// TLS sections are only sorted on NOBITS.
// CHECK: Name: e
// CHECK: Name: g
-// CHECK: Name: i
// CHECK: Name: j
// CHECK: Name: k
// CHECK: Name: l
diff --git a/test/ELF/section-name.s b/test/ELF/section-name.s
index 06d741b2ea77..4ff974768335 100644
--- a/test/ELF/section-name.s
+++ b/test/ELF/section-name.s
@@ -45,12 +45,12 @@ _start:
// CHECK: 1 .rodata 00000002
// CHECK: 2 .gcc_except_table 00000001
// CHECK: 3 .text 00000002
-// CHECK: 4 .tdata 00000001
-// CHECK: 5 .tbss 00000001
-// CHECK: 6 .data.rel.ro 00000004
-// CHECK: 7 .data 00000002
-// CHECK: 8 .foo.a 00000001
-// CHECK: 9 .foo 00000001
+// CHECK: 4 .data 00000002
+// CHECK: 5 .foo.a 00000001
+// CHECK: 6 .foo 00000001
+// CHECK: 7 .tdata 00000001
+// CHECK: 8 .tbss 00000001
+// CHECK: 9 .data.rel.ro 00000004
// CHECK: 10 .bss 00000002
// CHECK: 11 .comment 00000008
// CHECK: 12 .symtab 00000060
diff --git a/test/ELF/sort-norosegment.s b/test/ELF/sort-norosegment.s
index 3026bb2dbf3c..c5a759a08a77 100644
--- a/test/ELF/sort-norosegment.s
+++ b/test/ELF/sort-norosegment.s
@@ -8,8 +8,8 @@
# CHECK-NEXT: .dynsym {{.*}} A
# CHECK-NEXT: .hash {{.*}} A
# CHECK-NEXT: .dynstr {{.*}} A
-# CHECK-NEXT: .dynamic {{.*}} WA
# CHECK-NEXT: foo {{.*}} WA
+# CHECK-NEXT: .dynamic {{.*}} WA
.section foo, "aw"
.byte 0
diff --git a/test/ELF/startstop.s b/test/ELF/startstop.s
index 326196dafa68..250fb2cb3f5c 100644
--- a/test/ELF/startstop.s
+++ b/test/ELF/startstop.s
@@ -22,10 +22,10 @@
// SYMBOL: Relocations [
// SYMBOL-NEXT: Section ({{.*}}) .rela.dyn {
-// SYMBOL-NEXT: 0x3010 R_X86_64_64 __stop_zed1 0x0
-// SYMBOL-NEXT: 0x3018 R_X86_64_64 __stop_zed1 0x1
-// SYMBOL-NEXT: 0x3000 R_X86_64_64 __stop_zed2 0x0
-// SYMBOL-NEXT: 0x3008 R_X86_64_64 __stop_zed2 0x1
+// SYMBOL-NEXT: 0x2010 R_X86_64_64 __stop_zed1 0x0
+// SYMBOL-NEXT: 0x2018 R_X86_64_64 __stop_zed1 0x1
+// SYMBOL-NEXT: 0x2000 R_X86_64_64 __stop_zed2 0x0
+// SYMBOL-NEXT: 0x2008 R_X86_64_64 __stop_zed2 0x1
// SYMBOL-NEXT: }
// SYMBOL-NEXT: ]
@@ -51,13 +51,13 @@
// SYMBOL: Symbol {
// SYMBOL: Name: __stop_zed1
-// SYMBOL: Value: 0x3010
+// SYMBOL: Value: 0x2010
// STMBOL: Other: 0
// SYMBOL: Section: zed1
// SYMBOL: }
// SYMBOL: Symbol {
// SYMBOL: Name: __stop_zed2
-// SYMBOL: Value: 0x3020
+// SYMBOL: Value: 0x2020
// STMBOL: Other: 0
// SYMBOL: Section: zed2
// SYMBOL: }
diff --git a/test/ELF/synthetic-got.s b/test/ELF/synthetic-got.s
index c84d27827aef..8d82f3177f80 100644
--- a/test/ELF/synthetic-got.s
+++ b/test/ELF/synthetic-got.s
@@ -7,13 +7,13 @@
# RUN: | FileCheck %s --check-prefix=GOTDATA
# GOT: Sections:
-# GOT: 9 .got 00000008 00000000000001b0 DATA
-# GOT-NEXT: 10 .got.plt 00000020 00000000000001b8 DATA
-# GOTDATA: Contents of section .got:
-# GOTDATA-NEXT: 01b0 00000000 00000000
-# GOTDATA-NEXT: Contents of section .got.plt:
-# GOTDATA-NEXT: 01b8 e0000000 00000000 00000000 00000000
-# GOTDATA-NEXT: 01c8 00000000 00000000 d6000000 00000000
+# GOT: 8 .got.plt 00000020 00000000000000e0 DATA
+# GOT: 10 .got 00000008 00000000000001d0 DATA
+# GOTDATA: Contents of section .got.plt:
+# GOTDATA-NEXT: 00e0 00010000 00000000 00000000 00000000
+# GOTDATA-NEXT: 00f0 00000000 00000000 d6000000 00000000
+# GOTDATA-NEXT: Contents of section .got:
+# GOTDATA-NEXT: 01d0 00000000 00000000
# RUN: echo "SECTIONS { .mygot : { *(.got) *(.got.plt) } }" > %t1.script
# RUN: ld.lld -shared %t.o -o %t1.out --script %t1.script
@@ -21,12 +21,12 @@
# RUN: llvm-objdump -s -section=.mygot %t1.out | FileCheck %s --check-prefix=MYGOTDATA
# MYGOT: Sections:
-# MYGOT: 9 .mygot 00000028 00000000000001b0 DATA
+# MYGOT: 8 .mygot 00000028 00000000000000e0 DATA
# MYGOT-NOT: .got
# MYGOT-NOT: .got.plt
-# MYGOTDATA: 01b0 00000000 00000000 e0000000 00000000
-# MYGOTDATA-NEXT: 01c0 00000000 00000000 00000000 00000000
-# MYGOTDATA-NEXT: 01d0 d6000000 00000000
+# MYGOTDATA: 00e0 00000000 00000000 08010000 00000000
+# MYGOTDATA-NEXT: 00f0 00000000 00000000 00000000 00000000
+# MYGOTDATA-NEXT: 0100 d6000000 00000000
mov bar@gotpcrel(%rip), %rax
call foo@plt
diff --git a/test/ELF/tls-dynamic-i686.s b/test/ELF/tls-dynamic-i686.s
index 4db6278ca21b..6732483e9e1d 100644
--- a/test/ELF/tls-dynamic-i686.s
+++ b/test/ELF/tls-dynamic-i686.s
@@ -50,15 +50,14 @@ addl tls0@gotntpoff(%ebx),%eax
movl %gs:0,%eax
addl tls1@gotntpoff(%ebx),%eax
-// CHECK: Index: 10
-// CHECK-NEXT: Name: .got
+// CHECK: Name: .got (
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x2068
-// CHECK-NEXT: Offset: 0x2068
+// CHECK-NEXT: Address: 0x3068
+// CHECK-NEXT: Offset: 0x3068
// CHECK-NEXT: Size: 32
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
@@ -67,13 +66,13 @@ addl tls1@gotntpoff(%ebx),%eax
// CHECK: Relocations [
// CHECK: Section ({{.+}}) .rel.dyn {
-// CHECK-NEXT: 0x2078 R_386_TLS_DTPMOD32 - 0x0
-// CHECK-NEXT: 0x2068 R_386_TLS_DTPMOD32 tls0 0x0
-// CHECK-NEXT: 0x206C R_386_TLS_DTPOFF32 tls0 0x0
-// CHECK-NEXT: 0x2080 R_386_TLS_TPOFF tls0 0x0
-// CHECK-NEXT: 0x2070 R_386_TLS_DTPMOD32 tls1 0x0
-// CHECK-NEXT: 0x2074 R_386_TLS_DTPOFF32 tls1 0x0
-// CHECK-NEXT: 0x2084 R_386_TLS_TPOFF tls1 0x0
+// CHECK-NEXT: 0x3078 R_386_TLS_DTPMOD32 - 0x0
+// CHECK-NEXT: 0x3068 R_386_TLS_DTPMOD32 tls0 0x0
+// CHECK-NEXT: 0x306C R_386_TLS_DTPOFF32 tls0 0x0
+// CHECK-NEXT: 0x3080 R_386_TLS_TPOFF tls0 0x0
+// CHECK-NEXT: 0x3070 R_386_TLS_DTPMOD32 tls1 0x0
+// CHECK-NEXT: 0x3074 R_386_TLS_DTPOFF32 tls1 0x0
+// CHECK-NEXT: 0x3084 R_386_TLS_TPOFF tls1 0x0
// CHECK-NEXT: }
// DIS: Disassembly of section .text:
diff --git a/test/ELF/tls-dynamic.s b/test/ELF/tls-dynamic.s
index b627977e3c6f..05473d4b5b18 100644
--- a/test/ELF/tls-dynamic.s
+++ b/test/ELF/tls-dynamic.s
@@ -42,22 +42,22 @@ c:
// Get the address of the got, and check that it has 4 entries.
// CHECK: Sections [
-// CHECK: Name: .got
+// CHECK: Name: .got (
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x20D0
+// CHECK-NEXT: Address: 0x30D0
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: 40
// CHECK: Relocations [
// CHECK: Section ({{.+}}) .rela.dyn {
-// CHECK-NEXT: 0x20D0 R_X86_64_DTPMOD64 - 0x0
-// CHECK-NEXT: 0x20E0 R_X86_64_DTPMOD64 c 0x0
-// CHECK-NEXT: 0x20E8 R_X86_64_DTPOFF64 c 0x0
-// CHECK-NEXT: 0x20F0 R_X86_64_TPOFF64 c 0x0
+// CHECK-NEXT: 0x30D0 R_X86_64_DTPMOD64 - 0x0
+// CHECK-NEXT: 0x30E0 R_X86_64_DTPMOD64 c 0x0
+// CHECK-NEXT: 0x30E8 R_X86_64_DTPOFF64 c 0x0
+// CHECK-NEXT: 0x30F0 R_X86_64_TPOFF64 c 0x0
// CHECK-NEXT: }
// 4297 = (0x20D0 + -4) - (0x1000 + 3) // PC relative offset to got entry.
@@ -67,9 +67,9 @@ c:
// DIS: Disassembly of section .text:
// DIS-NEXT: .text:
-// DIS-NEXT: 1000: {{.+}} leaq 4297(%rip), %rdi
+// DIS-NEXT: 1000: {{.+}} leaq 8393(%rip), %rdi
// DIS-NEXT: 1007: {{.+}} callq
-// DIS-NEXT: 100c: {{.+}} leaq 4285(%rip), %rdi
+// DIS-NEXT: 100c: {{.+}} leaq 8381(%rip), %rdi
// DIS-NEXT: 1013: {{.+}} callq
// DIS-NEXT: 1018: {{.+}} leaq (%rax), %rcx
// DIS-NEXT: 101f: {{.+}} leaq 4(%rax), %rcx
@@ -77,10 +77,10 @@ c:
// DIS-NEXT: 1028: 00 00
// DIS-NEXT: 102a: 00 00
// DIS-NEXT: 102c: 00 00
-// DIS-NEXT: 102e: {{.+}} leaq 4267(%rip), %rdi
+// DIS-NEXT: 102e: {{.+}} leaq 8363(%rip), %rdi
// DIS-NEXT: 1035: {{.+}} callq
// DIS-NEXT: 103b: {{.+}} leaq (%rax), %rcx
-// DIS-NEXT: 1042: {{.+}} movq 4263(%rip), %rax
+// DIS-NEXT: 1042: {{.+}} movq 8359(%rip), %rax
// DIS-NEXT: 1049: {{.+}} movq %fs:(%rax), %rax
// DIS-NEXT: 104d: {{.+}} movabsq $0, %rax
// DIS-NEXT: 1057: {{.+}} movabsq $4, %rax
diff --git a/test/ELF/tls-offset.s b/test/ELF/tls-offset.s
index 1734f7fb9e9c..ad921af8eff6 100644
--- a/test/ELF/tls-offset.s
+++ b/test/ELF/tls-offset.s
@@ -15,7 +15,7 @@ _start:
.align 16
.zero 16
- .data
+ .section .data.rel.ro,"aw",@progbits
.long 1
@@ -45,7 +45,7 @@ _start:
// CHECK-NEXT: Offset: 0x2004
// CHECK-NEXT: Size: 16
-// CHECK: Name: .data
+// CHECK: Name: .data.rel.ro
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
diff --git a/test/ELF/undef-with-plt-addr.s b/test/ELF/undef-with-plt-addr.s
index e30cd90d380f..2e2fc20be3f6 100644
--- a/test/ELF/undef-with-plt-addr.s
+++ b/test/ELF/undef-with-plt-addr.s
@@ -22,10 +22,10 @@ movabsq $set_data, %rax
// CHECK-NEXT: Address: 0x201010
// CHECK: Section ({{.*}}) .rela.dyn {
-// CHECK-NEXT: 0x203000 R_X86_64_64 foo 0x0
+// CHECK-NEXT: 0x202000 R_X86_64_64 foo 0x0
// CHECK-NEXT: }
// CHECK-NEXT: Section ({{.*}}) .rela.plt {
-// CHECK-NEXT: 0x203020 R_X86_64_JUMP_SLOT set_data 0x0
+// CHECK-NEXT: 0x202020 R_X86_64_JUMP_SLOT set_data 0x0
// CHECK-NEXT: }
// CHECK: Name: foo
diff --git a/test/ELF/undefined-versioned-symbol.s b/test/ELF/undefined-versioned-symbol.s
index 4e0957f25500..afa0ab9919e5 100644
--- a/test/ELF/undefined-versioned-symbol.s
+++ b/test/ELF/undefined-versioned-symbol.s
@@ -15,19 +15,19 @@
// CHECK: Section ({{.*}}) .rela.dyn {
// CHECK-NEXT: Relocation {
-// CHECK-NEXT: Offset: 0x2000
+// CHECK-NEXT: Offset: 0x1000
// CHECK-NEXT: Type: R_X86_64_64 (1)
// CHECK-NEXT: Symbol: basename (1)
// CHECK-NEXT: Addend: 0x0
// CHECK-NEXT: }
// CHECK-NEXT: Relocation {
-// CHECK-NEXT: Offset: 0x2008
+// CHECK-NEXT: Offset: 0x1008
// CHECK-NEXT: Type: R_X86_64_64 (1)
// CHECK-NEXT: Symbol: basename (2)
// CHECK-NEXT: Addend: 0x0
// CHECK-NEXT: }
// CHECK-NEXT: Relocation {
-// CHECK-NEXT: Offset: 0x2010
+// CHECK-NEXT: Offset: 0x1010
// CHECK-NEXT: Type: R_X86_64_64 (1)
// CHECK-NEXT: Symbol: basename (3)
// CHECK-NEXT: Addend: 0x0
diff --git a/test/ELF/unknown-reloc.s b/test/ELF/unknown-reloc.s
new file mode 100644
index 000000000000..b674a3bbc657
--- /dev/null
+++ b/test/ELF/unknown-reloc.s
@@ -0,0 +1,14 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux-gnu %s -o %t1.o
+# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux-gnu %S/Inputs/unknown-reloc.s -o %t2.o
+# RUN: not ld.lld %t1.o %t2.o -o %t.out 2>&1 | FileCheck %s
+
+# CHECK: do not know how to handle relocation 'R_386_PC8' (23)
+# CHECK: do not know how to handle relocation 'R_386_8' (22)
+
+.text
+.global foo
+foo:
+
+.byte und-foo
+.byte foo
diff --git a/test/ELF/version-script-anonymous-local.s b/test/ELF/version-script-anonymous-local.s
new file mode 100644
index 000000000000..3716b7ac99c1
--- /dev/null
+++ b/test/ELF/version-script-anonymous-local.s
@@ -0,0 +1,61 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+
+# RUN: echo "{ global: foo; local: bar; };" > %t.script
+# RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so
+# RUN: llvm-readobj -dyn-symbols -t %t.so | FileCheck %s
+
+# CHECK: Symbols [
+# CHECK: Name: bar
+# CHECK-NEXT: Value:
+# CHECK-NEXT: Size:
+# CHECK-NEXT: Binding: Local
+
+# CHECK: Name: foo
+# CHECK-NEXT: Value:
+# CHECK-NEXT: Size:
+# CHECK-NEXT: Binding: Global
+
+# CHECK: Name: zed
+# CHECK-NEXT: Value:
+# CHECK-NEXT: Size:
+# CHECK-NEXT: Binding: Global
+
+
+# CHECK: DynamicSymbols [
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name:
+# CHECK-NEXT: Value:
+# CHECK-NEXT: Size:
+# CHECK-NEXT: Binding:
+# CHECK-NEXT: Type:
+# CHECK-NEXT: Other:
+# CHECK-NEXT: Section:
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: foo
+# CHECK-NEXT: Value:
+# CHECK-NEXT: Size:
+# CHECK-NEXT: Binding: Global
+# CHECK-NEXT: Type:
+# CHECK-NEXT: Other:
+# CHECK-NEXT: Section:
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: zed
+# CHECK-NEXT: Value:
+# CHECK-NEXT: Size:
+# CHECK-NEXT: Binding: Global
+# CHECK-NEXT: Type:
+# CHECK-NEXT: Other:
+# CHECK-NEXT: Section:
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+
+
+.global foo
+foo:
+.global bar
+bar:
+.global zed
+zed:
diff --git a/test/ELF/x86-64-tls-gd-local.s b/test/ELF/x86-64-tls-gd-local.s
index 843b891be56b..ec6115dc2f75 100644
--- a/test/ELF/x86-64-tls-gd-local.s
+++ b/test/ELF/x86-64-tls-gd-local.s
@@ -28,14 +28,14 @@ bar:
.zero 4
-// CHECK: Name: .got
+// CHECK: Name: .got (
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC (0x2)
// CHECK-NEXT: SHF_WRITE (0x1)
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x20D0
-// CHECK-NEXT: Offset: 0x20D0
+// CHECK-NEXT: Address: 0x30D0
+// CHECK-NEXT: Offset: 0x30D0
// CHECK-NEXT: Size: 32
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
@@ -47,6 +47,6 @@ bar:
// CHECK-NEXT: )
// CHECK: Section ({{.*}}) .rela.dyn {
-// CHECK-NEXT: 0x20D0 R_X86_64_DTPMOD64 - 0x0
-// CHECK-NEXT: 0x20E0 R_X86_64_DTPMOD64 - 0x0
+// CHECK-NEXT: 0x30D0 R_X86_64_DTPMOD64 - 0x0
+// CHECK-NEXT: 0x30E0 R_X86_64_DTPMOD64 - 0x0
// CHECK-NEXT: }