summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/include/lld/Core/Reader.h8
-rw-r--r--lld/lib/Core/Reader.cpp5
-rw-r--r--lld/lib/Driver/DarwinLdDriver.cpp7
-rw-r--r--lld/lib/Driver/Driver.cpp6
-rw-r--r--lld/lib/ReaderWriter/ELF/ELFReader.h8
-rw-r--r--lld/lib/ReaderWriter/FileArchive.cpp17
-rw-r--r--lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp6
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp19
-rw-r--r--lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp8
-rw-r--r--lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp10
-rw-r--r--lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp20
-rw-r--r--lld/test/core/Inputs/archive-basic.objtxt21
-rw-r--r--lld/test/core/Inputs/archive-chain.objtxt24
-rw-r--r--lld/test/core/Inputs/archive-chain2.objtxt21
-rw-r--r--lld/test/core/Inputs/archive-tentdef-search.objtxt11
-rw-r--r--lld/test/core/Inputs/associates.objtxt8
-rw-r--r--lld/test/core/Inputs/auto-hide-coalesce.objtxt20
-rw-r--r--lld/test/core/Inputs/code-model-attributes.objtxt4
-rw-r--r--lld/test/core/Inputs/code-model-attributes2.objtxt4
-rw-r--r--lld/test/core/Inputs/code-model-attributes3.objtxt4
-rw-r--r--lld/test/core/Inputs/code-model-attributes4.objtxt4
-rw-r--r--lld/test/core/Inputs/code-model-attributes5.objtxt4
-rw-r--r--lld/test/core/Inputs/constants-coalesce.objtxt9
-rw-r--r--lld/test/core/Inputs/constants-coalesce2.objtxt10
-rw-r--r--lld/test/core/Inputs/cstring-coalesce.objtxt6
-rw-r--r--lld/test/core/Inputs/cstring-coalesce2.objtxt6
-rw-r--r--lld/test/core/Inputs/custom-section-coalesce.objtxt15
-rw-r--r--lld/test/core/Inputs/custom-section-coalesce2.objtxt13
-rw-r--r--lld/test/core/Inputs/dead-strip-attributes.objtxt4
-rw-r--r--lld/test/core/Inputs/dead-strip-attributes2.objtxt4
-rw-r--r--lld/test/core/Inputs/dead-strip-basic.objtxt9
-rw-r--r--lld/test/core/Inputs/dead-strip-basic2.objtxt8
-rw-r--r--lld/test/core/Inputs/dead-strip-globals.objtxt9
-rw-r--r--lld/test/core/Inputs/dead-strip-globals2.objtxt8
-rw-r--r--lld/test/core/Inputs/error-duplicate-absolutes.objtxt5
-rw-r--r--lld/test/core/Inputs/gnulinkonce-rearrange-resolve.objtxt26
-rw-r--r--lld/test/core/Inputs/gnulinkonce-remaining-undef.objtxt34
-rw-r--r--lld/test/core/Inputs/gnulinkonce-remaining-undef2.objtxt4
-rw-r--r--lld/test/core/Inputs/gnulinkonce-resolve.objtxt25
-rw-r--r--lld/test/core/Inputs/gnulinkonce-simple.objtxt4
-rw-r--r--lld/test/core/Inputs/inline-coalesce.objtxt6
-rw-r--r--lld/test/core/Inputs/inline-coalesce2.objtxt6
-rw-r--r--lld/test/core/Inputs/multiple-def-error.objtxt5
-rw-r--r--lld/test/core/Inputs/sectiongroup-deadstrip.objtxt3
-rw-r--r--lld/test/core/Inputs/sectiongroup-gnulinkonce-error.objtxt26
-rw-r--r--lld/test/core/Inputs/sectiongroup-rearrange-resolve.objtxt25
-rw-r--r--lld/test/core/Inputs/sectiongroup-remaining-undef.objtxt34
-rw-r--r--lld/test/core/Inputs/sectiongroup-remaining-undef2.objtxt4
-rw-r--r--lld/test/core/Inputs/sectiongroup-resolve.objtxt26
-rw-r--r--lld/test/core/Inputs/sectiongroup-simple.objtxt4
-rw-r--r--lld/test/core/Inputs/shared-library-coalesce.objtxt28
-rw-r--r--lld/test/core/Inputs/tent-merge.objtxt6
-rw-r--r--lld/test/core/Inputs/undef-coalesce-error.objtxt8
-rw-r--r--lld/test/core/Inputs/undef-coalesce-error2.objtxt8
-rw-r--r--lld/test/core/Inputs/undef-coalesce.objtxt8
-rw-r--r--lld/test/core/Inputs/undef-coalesce2.objtxt8
-rw-r--r--lld/test/core/Inputs/undef-fallback.objtxt7
-rw-r--r--lld/test/core/Inputs/undef-weak-coalesce.objtxt20
-rw-r--r--lld/test/core/Inputs/weak-coalesce.objtxt5
-rw-r--r--lld/test/core/Inputs/weak-coalesce2.objtxt6
-rw-r--r--lld/test/core/archive-basic.objtxt23
-rw-r--r--lld/test/core/archive-chain.objtxt49
-rw-r--r--lld/test/core/archive-tentdef-search.objtxt16
-rw-r--r--lld/test/core/associates.objtxt11
-rw-r--r--lld/test/core/auto-hide-coalesce.objtxt23
-rw-r--r--lld/test/core/code-model-attributes.objtxt27
-rw-r--r--lld/test/core/constants-coalesce.objtxt22
-rw-r--r--lld/test/core/cstring-coalesce.objtxt12
-rw-r--r--lld/test/core/custom-section-coalesce.objtxt32
-rw-r--r--lld/test/core/dead-strip-attributes.objtxt11
-rw-r--r--lld/test/core/dead-strip-basic.objtxt21
-rw-r--r--lld/test/core/dead-strip-globals.objtxt21
-rw-r--r--lld/test/core/error-duplicate-absolutes.objtxt7
-rw-r--r--lld/test/core/gnulinkonce-rearrange-resolve.objtxt28
-rw-r--r--lld/test/core/gnulinkonce-remaining-undef.objtxt41
-rw-r--r--lld/test/core/gnulinkonce-resolve.objtxt28
-rw-r--r--lld/test/core/gnulinkonce-simple.objtxt6
-rw-r--r--lld/test/core/inline-coalesce.objtxt14
-rw-r--r--lld/test/core/multiple-def-error.objtxt7
-rw-r--r--lld/test/core/sectiongroup-deadstrip.objtxt6
-rw-r--r--lld/test/core/sectiongroup-gnulinkonce-error.objtxt28
-rw-r--r--lld/test/core/sectiongroup-rearrange-resolve.objtxt28
-rw-r--r--lld/test/core/sectiongroup-remaining-undef.objtxt40
-rw-r--r--lld/test/core/sectiongroup-resolve.objtxt26
-rw-r--r--lld/test/core/sectiongroup-simple.objtxt4
-rw-r--r--lld/test/core/shared-library-coalesce.objtxt31
-rw-r--r--lld/test/core/tent-merge.objtxt8
-rw-r--r--lld/test/core/undef-coalesce-error.objtxt20
-rw-r--r--lld/test/core/undef-coalesce.objtxt18
-rw-r--r--lld/test/core/undef-fallback.objtxt10
-rw-r--r--lld/test/core/undef-weak-coalesce.objtxt22
-rw-r--r--lld/test/core/weak-coalesce.objtxt18
-rw-r--r--lld/test/darwin/Inputs/native-and-mach-o.objtxt17
-rw-r--r--lld/test/darwin/Inputs/native-and-mach-o2.objtxt19
-rw-r--r--lld/test/darwin/native-and-mach-o.objtxt44
-rw-r--r--lld/test/elf/Inputs/allowduplicates.objtxt12
-rw-r--r--lld/test/elf/allowduplicates.objtxt18
-rw-r--r--lld/test/lit.cfg5
-rw-r--r--lld/test/mach-o/Inputs/PIE.yaml6
-rw-r--r--lld/test/mach-o/Inputs/arm-interworking.yaml83
-rw-r--r--lld/test/mach-o/Inputs/arm-shims.yaml60
-rw-r--r--lld/test/mach-o/Inputs/cstring-sections.yaml25
-rw-r--r--lld/test/mach-o/Inputs/got-order.yaml53
-rw-r--r--lld/test/mach-o/Inputs/got-order2.yaml11
-rw-r--r--lld/test/mach-o/Inputs/hello-world-arm64.yaml8
-rw-r--r--lld/test/mach-o/Inputs/hello-world-armv6.yaml7
-rw-r--r--lld/test/mach-o/Inputs/hello-world-armv7.yaml7
-rw-r--r--lld/test/mach-o/Inputs/hello-world-x86.yaml7
-rw-r--r--lld/test/mach-o/Inputs/hello-world-x86_64.yaml8
-rw-r--r--lld/test/mach-o/Inputs/interposing-section.yaml6
-rw-r--r--lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml8
-rw-r--r--lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml8
-rw-r--r--lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml8
-rw-r--r--lld/test/mach-o/Inputs/linker-as-ld.yaml6
-rw-r--r--lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml21
-rw-r--r--lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml18
-rw-r--r--lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml19
-rw-r--r--lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml13
-rw-r--r--lld/test/mach-o/Inputs/use-simple-dylib.yaml58
-rw-r--r--lld/test/mach-o/Inputs/write-final-sections.yaml20
-rw-r--r--lld/test/mach-o/Inputs/wrong-arch-error.yaml24
-rw-r--r--lld/test/mach-o/PIE.yaml16
-rw-r--r--lld/test/mach-o/arm-interworking.yaml86
-rw-r--r--lld/test/mach-o/arm-shims.yaml65
-rw-r--r--lld/test/mach-o/cstring-sections.yaml26
-rw-r--r--lld/test/mach-o/got-order.yaml69
-rw-r--r--lld/test/mach-o/hello-world-arm64.yaml12
-rw-r--r--lld/test/mach-o/hello-world-armv6.yaml10
-rw-r--r--lld/test/mach-o/hello-world-armv7.yaml11
-rw-r--r--lld/test/mach-o/hello-world-x86.yaml11
-rw-r--r--lld/test/mach-o/hello-world-x86_64.yaml15
-rw-r--r--lld/test/mach-o/interposing-section.yaml11
-rw-r--r--lld/test/mach-o/lazy-bind-x86_64.yaml31
-rw-r--r--lld/test/mach-o/linker-as-ld.yaml11
-rw-r--r--lld/test/mach-o/re-exported-dylib-ordinal.yaml67
-rw-r--r--lld/test/mach-o/unwind-info-simple-arm64.yaml17
-rw-r--r--lld/test/mach-o/use-simple-dylib.yaml62
-rw-r--r--lld/test/mach-o/write-final-sections.yaml25
-rw-r--r--lld/test/mach-o/wrong-arch-error.yaml25
139 files changed, 1251 insertions, 1257 deletions
diff --git a/lld/include/lld/Core/Reader.h b/lld/include/lld/Core/Reader.h
index d4af3ab4eda..0b6cf652fe7 100644
--- a/lld/include/lld/Core/Reader.h
+++ b/lld/include/lld/Core/Reader.h
@@ -51,9 +51,9 @@ public:
/// \brief Parse a supplied buffer (already filled with the contents of a
/// file) and create a File object.
/// The resulting File object takes ownership of the MemoryBuffer.
- virtual std::error_code
- loadFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,
- std::vector<std::unique_ptr<File>> &result) const = 0;
+ virtual std::error_code loadFile(std::unique_ptr<MemoryBuffer> mb,
+ const class Registry &,
+ std::unique_ptr<File> &result) const = 0;
};
@@ -91,7 +91,7 @@ public:
/// Walk the list of registered Readers and find one that can parse the
/// supplied file and parse it.
std::error_code loadFile(std::unique_ptr<MemoryBuffer> mb,
- std::vector<std::unique_ptr<File>> &result) const;
+ std::unique_ptr<File> &result) const;
/// Walk the list of registered kind tables to convert a Reference Kind
/// name to a value.
diff --git a/lld/lib/Core/Reader.cpp b/lld/lib/Core/Reader.cpp
index bd7df2c4489..c97193dcf07 100644
--- a/lld/lib/Core/Reader.cpp
+++ b/lld/lib/Core/Reader.cpp
@@ -28,9 +28,8 @@ void Registry::add(std::unique_ptr<YamlIOTaggedDocumentHandler> handler) {
_yamlHandlers.push_back(std::move(handler));
}
-std::error_code
-Registry::loadFile(std::unique_ptr<MemoryBuffer> mb,
- std::vector<std::unique_ptr<File>> &result) const {
+std::error_code Registry::loadFile(std::unique_ptr<MemoryBuffer> mb,
+ std::unique_ptr<File> &result) const {
// Get file magic.
StringRef content(mb->getBufferStart(), mb->getBufferSize());
llvm::sys::fs::file_magic fileType = llvm::sys::fs::identify_magic(content);
diff --git a/lld/lib/Driver/DarwinLdDriver.cpp b/lld/lib/Driver/DarwinLdDriver.cpp
index 992f8adc8c0..ea4600096fb 100644
--- a/lld/lib/Driver/DarwinLdDriver.cpp
+++ b/lld/lib/Driver/DarwinLdDriver.cpp
@@ -80,9 +80,12 @@ loadFile(MachOLinkingContext &ctx, StringRef path,
ErrorOr<std::unique_ptr<MemoryBuffer>> mbOrErr = ctx.getMemoryBuffer(path);
if (std::error_code ec = mbOrErr.getError())
return makeErrorFile(path, ec);
- std::vector<std::unique_ptr<File>> files;
- if (std::error_code ec = ctx.registry().loadFile(std::move(mbOrErr.get()), files))
+ std::unique_ptr<File> file;
+ if (std::error_code ec =
+ ctx.registry().loadFile(std::move(mbOrErr.get()), file))
return makeErrorFile(path, ec);
+ std::vector<std::unique_ptr<File>> files;
+ files.push_back(std::move(file));
for (std::unique_ptr<File> &pf : files) {
// If file is a dylib, inform LinkingContext about it.
if (SharedLibraryFile *shl = dyn_cast<SharedLibraryFile>(pf.get())) {
diff --git a/lld/lib/Driver/Driver.cpp b/lld/lib/Driver/Driver.cpp
index 233ecd49058..1314d91514c 100644
--- a/lld/lib/Driver/Driver.cpp
+++ b/lld/lib/Driver/Driver.cpp
@@ -54,9 +54,11 @@ FileVector loadFile(LinkingContext &ctx, StringRef path, bool wholeArchive) {
= MemoryBuffer::getFileOrSTDIN(path);
if (std::error_code ec = mb.getError())
return makeErrorFile(path, ec);
- std::vector<std::unique_ptr<File>> files;
- if (std::error_code ec = ctx.registry().loadFile(std::move(mb.get()), files))
+ std::unique_ptr<File> file;
+ if (std::error_code ec = ctx.registry().loadFile(std::move(mb.get()), file))
return makeErrorFile(path, ec);
+ std::vector<std::unique_ptr<File>> files;
+ files.push_back(std::move(file));
if (wholeArchive)
return parseMemberFiles(files);
return files;
diff --git a/lld/lib/ReaderWriter/ELF/ELFReader.h b/lld/lib/ReaderWriter/ELF/ELFReader.h
index 723109f1dc6..76f3823fb6a 100644
--- a/lld/lib/ReaderWriter/ELF/ELFReader.h
+++ b/lld/lib/ReaderWriter/ELF/ELFReader.h
@@ -28,12 +28,12 @@ public:
return FileT::canParse(magic);
}
- std::error_code
- loadFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,
- std::vector<std::unique_ptr<File>> &result) const override {
+ std::error_code loadFile(std::unique_ptr<MemoryBuffer> mb,
+ const class Registry &,
+ std::unique_ptr<File> &result) const override {
if (std::error_code ec = FileT::isCompatible(*mb, _ctx))
return ec;
- result.push_back(llvm::make_unique<FileT>(std::move(mb), _ctx));
+ result = llvm::make_unique<FileT>(std::move(mb), _ctx);
return std::error_code();
}
diff --git a/lld/lib/ReaderWriter/FileArchive.cpp b/lld/lib/ReaderWriter/FileArchive.cpp
index 9e3e3175438..23a2cb5f2a7 100644
--- a/lld/lib/ReaderWriter/FileArchive.cpp
+++ b/lld/lib/ReaderWriter/FileArchive.cpp
@@ -173,9 +173,11 @@ private:
std::unique_ptr<MemoryBuffer> memberMB(MemoryBuffer::getMemBuffer(
mb.getBuffer(), mb.getBufferIdentifier(), false));
- std::vector<std::unique_ptr<File>> files;
- if (std::error_code ec = _registry.loadFile(std::move(memberMB), files))
+ std::unique_ptr<File> file;
+ if (std::error_code ec = _registry.loadFile(std::move(memberMB), file))
return ec;
+ std::vector<std::unique_ptr<File>> files;
+ files.push_back(std::move(file));
assert(files.size() == 1);
result = std::move(files[0]);
if (std::error_code ec = result->parse())
@@ -265,13 +267,12 @@ public:
return magic == llvm::sys::fs::file_magic::archive;
}
- std::error_code
- loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry &reg,
- std::vector<std::unique_ptr<File>> &result) const override {
+ std::error_code loadFile(std::unique_ptr<MemoryBuffer> mb,
+ const Registry &reg,
+ std::unique_ptr<File> &result) const override {
StringRef path = mb->getBufferIdentifier();
- std::unique_ptr<FileArchive> file(
- new FileArchive(std::move(mb), reg, path, _logLoading));
- result.push_back(std::move(file));
+ result =
+ llvm::make_unique<FileArchive>(std::move(mb), reg, path, _logLoading);
return std::error_code();
}
diff --git a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
index 9b5837cd45f..aff6c87c894 100644
--- a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
@@ -623,9 +623,11 @@ MachODylibFile* MachOLinkingContext::loadIndirectDylib(StringRef path) {
if (mbOrErr.getError())
return nullptr;
- std::vector<std::unique_ptr<File>> files;
- if (registry().loadFile(std::move(mbOrErr.get()), files))
+ std::unique_ptr<File> file;
+ if (registry().loadFile(std::move(mbOrErr.get()), file))
return nullptr;
+ std::vector<std::unique_ptr<File>> files;
+ files.push_back(std::move(file));
assert(files.size() == 1 && "expected one file in dylib");
files[0]->parse();
MachODylibFile* result = reinterpret_cast<MachODylibFile*>(files[0].get());
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
index b05f4316609..45757eeef1c 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
@@ -30,6 +30,7 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Object/MachO.h"
#include "llvm/Support/Casting.h"
@@ -521,11 +522,10 @@ public:
mb.getBufferSize() > 32);
}
- std::error_code
- loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry &registry,
- std::vector<std::unique_ptr<File>> &result) const override {
- auto *file = new MachOFile(std::move(mb), &_ctx);
- result.push_back(std::unique_ptr<MachOFile>(file));
+ std::error_code loadFile(std::unique_ptr<MemoryBuffer> mb,
+ const Registry &registry,
+ std::unique_ptr<File> &result) const override {
+ result = llvm::make_unique<MachOFile>(std::move(mb), &_ctx);
return std::error_code();
}
@@ -547,11 +547,10 @@ public:
}
}
- std::error_code
- loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry &registry,
- std::vector<std::unique_ptr<File>> &result) const override {
- auto *file = new MachODylibFile(std::move(mb), &_ctx);
- result.push_back(std::unique_ptr<MachODylibFile>(file));
+ std::error_code loadFile(std::unique_ptr<MemoryBuffer> mb,
+ const Registry &registry,
+ std::unique_ptr<File> &result) const override {
+ result = llvm::make_unique<MachODylibFile>(std::move(mb), &_ctx);
return std::error_code();
}
diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
index f7c9c7e8ea5..aa053bc9e28 100644
--- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
@@ -1052,12 +1052,10 @@ public:
return magic == llvm::sys::fs::file_magic::coff_object;
}
- std::error_code
- loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry &,
- std::vector<std::unique_ptr<File>> &result) const override {
+ std::error_code loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry &,
+ std::unique_ptr<File> &result) const override {
// Parse the memory buffer as PECOFF file.
- auto *file = new FileCOFF(std::move(mb), _ctx);
- result.push_back(std::unique_ptr<File>(file));
+ result = llvm::make_unique<FileCOFF>(std::move(mb), _ctx);
return std::error_code();
}
diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
index 76e37345a27..75d58071c48 100644
--- a/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
@@ -367,11 +367,11 @@ public:
return magic == llvm::sys::fs::file_magic::coff_import_library;
}
- std::error_code
- loadFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,
- std::vector<std::unique_ptr<File> > &result) const override {
- auto *file = new FileImportLibrary(std::move(mb), _ctx.getMachineType());
- result.push_back(std::unique_ptr<File>(file));
+ std::error_code loadFile(std::unique_ptr<MemoryBuffer> mb,
+ const class Registry &,
+ std::unique_ptr<File> &result) const override {
+ result = llvm::make_unique<FileImportLibrary>(std::move(mb),
+ _ctx.getMachineType());
return std::error_code();
}
diff --git a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
index eccb099415d..d6863f342e3 100644
--- a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
+++ b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
@@ -1294,9 +1294,9 @@ public:
return ext.equals(".objtxt") || ext.equals(".yaml");
}
- std::error_code
- loadFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,
- std::vector<std::unique_ptr<File>> &result) const override {
+ std::error_code loadFile(std::unique_ptr<MemoryBuffer> mb,
+ const class Registry &,
+ std::unique_ptr<File> &result) const override {
// Create YAML Input Reader.
YamlContext yamlContext;
yamlContext._registry = &_registry;
@@ -1306,19 +1306,19 @@ public:
// Fill vector with File objects created by parsing yaml.
std::vector<const lld::File *> createdFiles;
yin >> createdFiles;
+ assert(createdFiles.size() == 1);
// Error out now if there were parsing errors.
if (yin.error())
return make_error_code(lld::YamlReaderError::illegal_value);
std::shared_ptr<MemoryBuffer> smb(mb.release());
- for (const File *file : createdFiles) {
- // Note: loadFile() should return vector of *const* File
- File *f = const_cast<File *>(file);
- f->setLastError(std::error_code());
- f->setSharedMemoryBuffer(smb);
- result.emplace_back(f);
- }
+ const File *file = createdFiles[0];
+ // Note: loadFile() should return vector of *const* File
+ File *f = const_cast<File *>(file);
+ f->setLastError(std::error_code());
+ f->setSharedMemoryBuffer(smb);
+ result = std::unique_ptr<File>(f);
return make_error_code(lld::YamlReaderError::success);
}
diff --git a/lld/test/core/Inputs/archive-basic.objtxt b/lld/test/core/Inputs/archive-basic.objtxt
new file mode 100644
index 00000000000..ecfdacd0b6d
--- /dev/null
+++ b/lld/test/core/Inputs/archive-basic.objtxt
@@ -0,0 +1,21 @@
+--- !archive
+members:
+ - name: bar.o
+ content: !native
+ defined-atoms:
+ - name: bar
+ scope: global
+ type: code
+
+ - name: bar2
+ type: code
+
+ - name: baz.o
+ content: !native
+ defined-atoms:
+ - name: baz
+ scope: global
+ type: code
+
+ - name: baz2
+ type: code
diff --git a/lld/test/core/Inputs/archive-chain.objtxt b/lld/test/core/Inputs/archive-chain.objtxt
new file mode 100644
index 00000000000..d3cc17137c1
--- /dev/null
+++ b/lld/test/core/Inputs/archive-chain.objtxt
@@ -0,0 +1,24 @@
+--- !archive
+members:
+ - name: bar1.o
+ content: !native
+ defined-atoms:
+ - name: bar1
+ scope: global
+ type: code
+
+ - name: bar1b
+ type: code
+
+ undefined-atoms:
+ - name: baz1
+
+ - name: bar2.o
+ content: !native
+ defined-atoms:
+ - name: bar2
+ scope: global
+ type: code
+
+ - name: bar2b
+ type: code
diff --git a/lld/test/core/Inputs/archive-chain2.objtxt b/lld/test/core/Inputs/archive-chain2.objtxt
new file mode 100644
index 00000000000..aed6b1b959e
--- /dev/null
+++ b/lld/test/core/Inputs/archive-chain2.objtxt
@@ -0,0 +1,21 @@
+--- !archive
+members:
+ - name: baz1.o
+ content: !native
+ defined-atoms:
+ - name: baz1
+ scope: global
+ type: code
+
+ - name: baz1b
+ type: code
+
+ - name: baz2.o
+ content: !native
+ defined-atoms:
+ - name: baz2
+ scope: global
+ type: code
+
+ - name: baz2b
+ type: code
diff --git a/lld/test/core/Inputs/archive-tentdef-search.objtxt b/lld/test/core/Inputs/archive-tentdef-search.objtxt
new file mode 100644
index 00000000000..70219aac7a6
--- /dev/null
+++ b/lld/test/core/Inputs/archive-tentdef-search.objtxt
@@ -0,0 +1,11 @@
+--- !archive
+members:
+ - name: bar.o
+ content: !native
+ defined-atoms:
+ - name: bar
+ scope: global
+ type: data
+
+ - name: bar2
+ type: data
diff --git a/lld/test/core/Inputs/associates.objtxt b/lld/test/core/Inputs/associates.objtxt
new file mode 100644
index 00000000000..29d028c27ed
--- /dev/null
+++ b/lld/test/core/Inputs/associates.objtxt
@@ -0,0 +1,8 @@
+defined-atoms:
+ - name: f1
+ merge: as-weak
+ scope: global
+ references:
+ - kind: associate
+ target: f2
+ - name: f2
diff --git a/lld/test/core/Inputs/auto-hide-coalesce.objtxt b/lld/test/core/Inputs/auto-hide-coalesce.objtxt
new file mode 100644
index 00000000000..d82d0f41c4f
--- /dev/null
+++ b/lld/test/core/Inputs/auto-hide-coalesce.objtxt
@@ -0,0 +1,20 @@
+defined-atoms:
+ - name: _inlineFunc1
+ scope: global
+ type: code
+ merge: as-weak
+
+ - name: _inlineFunc2
+ scope: global
+ type: code
+ merge: as-addressed-weak
+
+ - name: _inlineFunc3
+ scope: global
+ type: code
+ merge: as-weak
+
+ - name: _inlineFunc4
+ scope: global
+ type: code
+ merge: as-addressed-weak
diff --git a/lld/test/core/Inputs/code-model-attributes.objtxt b/lld/test/core/Inputs/code-model-attributes.objtxt
new file mode 100644
index 00000000000..7c01a0d57f3
--- /dev/null
+++ b/lld/test/core/Inputs/code-model-attributes.objtxt
@@ -0,0 +1,4 @@
+---
+defined-atoms:
+ - name: _none
+ code-model: none
diff --git a/lld/test/core/Inputs/code-model-attributes2.objtxt b/lld/test/core/Inputs/code-model-attributes2.objtxt
new file mode 100644
index 00000000000..92df88c7b0e
--- /dev/null
+++ b/lld/test/core/Inputs/code-model-attributes2.objtxt
@@ -0,0 +1,4 @@
+---
+defined-atoms:
+ - name: _mips_pic
+ code-model: mips-pic
diff --git a/lld/test/core/Inputs/code-model-attributes3.objtxt b/lld/test/core/Inputs/code-model-attributes3.objtxt
new file mode 100644
index 00000000000..8f2ced14f10
--- /dev/null
+++ b/lld/test/core/Inputs/code-model-attributes3.objtxt
@@ -0,0 +1,4 @@
+---
+defined-atoms:
+ - name: _mips_micro
+ code-model: mips-micro
diff --git a/lld/test/core/Inputs/code-model-attributes4.objtxt b/lld/test/core/Inputs/code-model-attributes4.objtxt
new file mode 100644
index 00000000000..160c9a00c3d
--- /dev/null
+++ b/lld/test/core/Inputs/code-model-attributes4.objtxt
@@ -0,0 +1,4 @@
+---
+defined-atoms:
+ - name: _mips_micro_pic
+ code-model: mips-micro-pic
diff --git a/lld/test/core/Inputs/code-model-attributes5.objtxt b/lld/test/core/Inputs/code-model-attributes5.objtxt
new file mode 100644
index 00000000000..99bdb54e09b
--- /dev/null
+++ b/lld/test/core/Inputs/code-model-attributes5.objtxt
@@ -0,0 +1,4 @@
+---
+defined-atoms:
+ - name: _mips_16
+ code-model: mips-16
diff --git a/lld/test/core/Inputs/constants-coalesce.objtxt b/lld/test/core/Inputs/constants-coalesce.objtxt
new file mode 100644
index 00000000000..ea3436f9ee2
--- /dev/null
+++ b/lld/test/core/Inputs/constants-coalesce.objtxt
@@ -0,0 +1,9 @@
+---
+defined-atoms:
+ - ref-name: L1
+ type: constant
+ content: [ 01, 02 ]
+ - ref-name: L2
+ type: constant
+ merge: by-content
+ content: [ 01, 02, 03, 04 ]
diff --git a/lld/test/core/Inputs/constants-coalesce2.objtxt b/lld/test/core/Inputs/constants-coalesce2.objtxt
new file mode 100644
index 00000000000..c8f10f414f8
--- /dev/null
+++ b/lld/test/core/Inputs/constants-coalesce2.objtxt
@@ -0,0 +1,10 @@
+---
+defined-atoms:
+ - ref-name: L2
+ type: constant
+ merge: by-content
+ content: [ 01, 23, 45, 67, 89, AB, CD, EF ]
+ - ref-name: L3
+ type: constant
+ merge: by-content
+ content: [ 01, 02, 03 ]
diff --git a/lld/test/core/Inputs/cstring-coalesce.objtxt b/lld/test/core/Inputs/cstring-coalesce.objtxt
new file mode 100644
index 00000000000..d2e6327cf20
--- /dev/null
+++ b/lld/test/core/Inputs/cstring-coalesce.objtxt
@@ -0,0 +1,6 @@
+---
+defined-atoms:
+ - ref-name: L2
+ type: c-string
+ merge: by-content
+ content: [ 68, 65, 6c, 6c, 6f, 00 ]
diff --git a/lld/test/core/Inputs/cstring-coalesce2.objtxt b/lld/test/core/Inputs/cstring-coalesce2.objtxt
new file mode 100644
index 00000000000..76dedf7cf3b
--- /dev/null
+++ b/lld/test/core/Inputs/cstring-coalesce2.objtxt
@@ -0,0 +1,6 @@
+---
+defined-atoms:
+ - ref-name: L2
+ type: c-string
+ merge: by-content
+ content: [ 74, 68, 65, 72, 65, 00 ]
diff --git a/lld/test/core/Inputs/custom-section-coalesce.objtxt b/lld/test/core/Inputs/custom-section-coalesce.objtxt
new file mode 100644
index 00000000000..de3efe339aa
--- /dev/null
+++ b/lld/test/core/Inputs/custom-section-coalesce.objtxt
@@ -0,0 +1,15 @@
+---
+defined-atoms:
+ - ref-name: L1
+ type: constant
+ merge: by-content
+ content: [ 01, 02, 03, 04 ]
+ section-choice: custom-required
+ section-name: .mysection
+
+ - ref-name: L2
+ type: constant
+ merge: by-content
+ content: [ 01, 02, 03, 04 ]
+ section-choice: custom-required
+ section-name: .mysection2
diff --git a/lld/test/core/Inputs/custom-section-coalesce2.objtxt b/lld/test/core/Inputs/custom-section-coalesce2.objtxt
new file mode 100644
index 00000000000..3e8356f0c7e
--- /dev/null
+++ b/lld/test/core/Inputs/custom-section-coalesce2.objtxt
@@ -0,0 +1,13 @@
+---
+defined-atoms:
+ - ref-name: L1
+ type: constant
+ merge: by-content
+ content: [ 05, 06, 07, 08 ]
+ section-choice: custom-required
+ section-name: .mysection
+
+ - ref-name: L2
+ type: constant
+ merge: by-content
+ content: [ 01, 02, 03, 04 ]
diff --git a/lld/test/core/Inputs/dead-strip-attributes.objtxt b/lld/test/core/Inputs/dead-strip-attributes.objtxt
new file mode 100644
index 00000000000..06a71485dcd
--- /dev/null
+++ b/lld/test/core/Inputs/dead-strip-attributes.objtxt
@@ -0,0 +1,4 @@
+---
+defined-atoms:
+ - name: _foo2
+ dead-strip: never
diff --git a/lld/test/core/Inputs/dead-strip-attributes2.objtxt b/lld/test/core/Inputs/dead-strip-attributes2.objtxt
new file mode 100644
index 00000000000..3dd55c46cd9
--- /dev/null
+++ b/lld/test/core/Inputs/dead-strip-attributes2.objtxt
@@ -0,0 +1,4 @@
+---
+defined-atoms:
+ - name: _foo3
+ dead-strip: always
diff --git a/lld/test/core/Inputs/dead-strip-basic.objtxt b/lld/test/core/Inputs/dead-strip-basic.objtxt
new file mode 100644
index 00000000000..05cb81bbcf9
--- /dev/null
+++ b/lld/test/core/Inputs/dead-strip-basic.objtxt
@@ -0,0 +1,9 @@
+---
+defined-atoms:
+ - name: mydead2
+ scope: global
+ type: data
+
+ - name: bar
+ scope: global
+ type: data
diff --git a/lld/test/core/Inputs/dead-strip-basic2.objtxt b/lld/test/core/Inputs/dead-strip-basic2.objtxt
new file mode 100644
index 00000000000..6b0b01aef64
--- /dev/null
+++ b/lld/test/core/Inputs/dead-strip-basic2.objtxt
@@ -0,0 +1,8 @@
+---
+defined-atoms:
+ - name: baz
+ scope: global
+ type: code
+
+ - name: mydead3
+ type: code
diff --git a/lld/test/core/Inputs/dead-strip-globals.objtxt b/lld/test/core/Inputs/dead-strip-globals.objtxt
new file mode 100644
index 00000000000..fbf2ba6d1da
--- /dev/null
+++ b/lld/test/core/Inputs/dead-strip-globals.objtxt
@@ -0,0 +1,9 @@
+---
+defined-atoms:
+ - name: myglobal2
+ scope: global
+ type: data
+
+ - name: bar
+ scope: hidden
+ type: data
diff --git a/lld/test/core/Inputs/dead-strip-globals2.objtxt b/lld/test/core/Inputs/dead-strip-globals2.objtxt
new file mode 100644
index 00000000000..a314bbe5ae4
--- /dev/null
+++ b/lld/test/core/Inputs/dead-strip-globals2.objtxt
@@ -0,0 +1,8 @@
+---
+defined-atoms:
+ - name: baz
+ scope: hidden
+ type: code
+
+ - name: mydead
+ type: code
diff --git a/lld/test/core/Inputs/error-duplicate-absolutes.objtxt b/lld/test/core/Inputs/error-duplicate-absolutes.objtxt
new file mode 100644
index 00000000000..2b99aa37848
--- /dev/null
+++ b/lld/test/core/Inputs/error-duplicate-absolutes.objtxt
@@ -0,0 +1,5 @@
+---
+absolute-atoms:
+ - name: absatom
+ value: 0
+ scope: global
diff --git a/lld/test/core/Inputs/gnulinkonce-rearrange-resolve.objtxt b/lld/test/core/Inputs/gnulinkonce-rearrange-resolve.objtxt
new file mode 100644
index 00000000000..e1fa42a24a5
--- /dev/null
+++ b/lld/test/core/Inputs/gnulinkonce-rearrange-resolve.objtxt
@@ -0,0 +1,26 @@
+---
+defined-atoms:
+ - name: g1
+ scope: global
+ type: gnu-linkonce
+ references:
+ - kind: group-child
+ target: f1
+ - kind: group-child
+ target: f2
+ - kind: group-child
+ target: g1
+ - kind: group-child
+ target: d1
+ - name: f1
+ scope: global
+ type: code
+ - name: f2
+ scope: global
+ type: code
+ - name: g1
+ scope: global
+ type: code
+ - name: d1
+ scope: global
+ type: data
diff --git a/lld/test/core/Inputs/gnulinkonce-remaining-undef.objtxt b/lld/test/core/Inputs/gnulinkonce-remaining-undef.objtxt
new file mode 100644
index 00000000000..02903a6b7bc
--- /dev/null
+++ b/lld/test/core/Inputs/gnulinkonce-remaining-undef.objtxt
@@ -0,0 +1,34 @@
+---
+defined-atoms:
+ - name: anotherfunction
+ scope: global
+ type: data
+ - name: f1
+ scope: global
+ type: code
+ - name: f2
+ scope: global
+ type: code
+ - name: f3
+ scope: global
+ type: code
+ - name: g1
+ scope: global
+ type: code
+ - name: d1
+ scope: global
+ type: data
+ - name: g1
+ scope: global
+ type: gnu-linkonce
+ references:
+ - kind: group-child
+ target: f1
+ - kind: group-child
+ target: f2
+ - kind: group-child
+ target: f3
+ - kind: group-child
+ target: g1
+ - kind: group-child
+ target: d1
diff --git a/lld/test/core/Inputs/gnulinkonce-remaining-undef2.objtxt b/lld/test/core/Inputs/gnulinkonce-remaining-undef2.objtxt
new file mode 100644
index 00000000000..4991476c621
--- /dev/null
+++ b/lld/test/core/Inputs/gnulinkonce-remaining-undef2.objtxt
@@ -0,0 +1,4 @@
+---
+undefined-atoms:
+ - name: f3
+ can-be-null: never
diff --git a/lld/test/core/Inputs/gnulinkonce-resolve.objtxt b/lld/test/core/Inputs/gnulinkonce-resolve.objtxt
new file mode 100644
index 00000000000..f4beb37fee2
--- /dev/null
+++ b/lld/test/core/Inputs/gnulinkonce-resolve.objtxt
@@ -0,0 +1,25 @@
+defined-atoms:
+ - name: f1
+ scope: global
+ type: code
+ - name: f2
+ scope: global
+ type: code
+ - name: g1
+ scope: global
+ type: code
+ - name: d1
+ scope: global
+ type: data
+ - name: g1
+ scope: global
+ type: gnu-linkonce
+ references:
+ - kind: group-child
+ target: f1
+ - kind: group-child
+ target: f2
+ - kind: group-child
+ target: g1
+ - kind: group-child
+ target: d1
diff --git a/lld/test/core/Inputs/gnulinkonce-simple.objtxt b/lld/test/core/Inputs/gnulinkonce-simple.objtxt
new file mode 100644
index 00000000000..807f0d35802
--- /dev/null
+++ b/lld/test/core/Inputs/gnulinkonce-simple.objtxt
@@ -0,0 +1,4 @@
+---
+undefined-atoms:
+ - name: f1
+ can-be-null: never
diff --git a/lld/test/core/Inputs/inline-coalesce.objtxt b/lld/test/core/Inputs/inline-coalesce.objtxt
new file mode 100644
index 00000000000..2eddee647c1
--- /dev/null
+++ b/lld/test/core/Inputs/inline-coalesce.objtxt
@@ -0,0 +1,6 @@
+---
+defined-atoms:
+ - name: _inlineFunc
+ scope: global
+ type: code
+ merge: as-weak
diff --git a/lld/test/core/Inputs/inline-coalesce2.objtxt b/lld/test/core/Inputs/inline-coalesce2.objtxt
new file mode 100644
index 00000000000..2eddee647c1
--- /dev/null
+++ b/lld/test/core/Inputs/inline-coalesce2.objtxt
@@ -0,0 +1,6 @@
+---
+defined-atoms:
+ - name: _inlineFunc
+ scope: global
+ type: code
+ merge: as-weak
diff --git a/lld/test/core/Inputs/multiple-def-error.objtxt b/lld/test/core/Inputs/multiple-def-error.objtxt
new file mode 100644
index 00000000000..8a1dcdb9c37
--- /dev/null
+++ b/lld/test/core/Inputs/multiple-def-error.objtxt
@@ -0,0 +1,5 @@
+---
+defined-atoms:
+ - name: _foo
+ scope: global
+ type: data
diff --git a/lld/test/core/Inputs/sectiongroup-deadstrip.objtxt b/lld/test/core/Inputs/sectiongroup-deadstrip.objtxt
new file mode 100644
index 00000000000..392f7ee9689
--- /dev/null
+++ b/lld/test/core/Inputs/sectiongroup-deadstrip.objtxt
@@ -0,0 +1,3 @@
+undefined-atoms:
+ - name: f1
+ can-be-null: never
diff --git a/lld/test/core/Inputs/sectiongroup-gnulinkonce-error.objtxt b/lld/test/core/Inputs/sectiongroup-gnulinkonce-error.objtxt
new file mode 100644
index 00000000000..a365d37b66b
--- /dev/null
+++ b/lld/test/core/Inputs/sectiongroup-gnulinkonce-error.objtxt
@@ -0,0 +1,26 @@
+---
+defined-atoms:
+ - name: f1
+ scope: global
+ type: code
+ - name: f2
+ scope: global
+ type: code
+ - name: g1
+ scope: global
+ type: code
+ - name: d1
+ scope: global
+ type: data
+ - name: g1
+ scope: global
+ type: gnu-linkonce
+ references:
+ - kind: group-child
+ target: f1
+ - kind: group-child
+ target: f2
+ - kind: group-child
+ target: g1
+ - kind: group-child
+ target: d1
diff --git a/lld/test/core/Inputs/sectiongroup-rearrange-resolve.objtxt b/lld/test/core/Inputs/sectiongroup-rearrange-resolve.objtxt
new file mode 100644
index 00000000000..bcefee646ef
--- /dev/null
+++ b/lld/test/core/Inputs/sectiongroup-rearrange-resolve.objtxt
@@ -0,0 +1,25 @@
+defined-atoms:
+ - name: g1
+ scope: global
+ type: group-comdat
+ references:
+ - kind: group-child
+ target: f1
+ - kind: group-child
+ target: f2
+ - kind: group-child
+ target: g1
+ - kind: group-child
+ target: d1
+ - name: f1
+ scope: global
+ type: code
+ - name: f2
+ scope: global
+ type: code
+ - name: g1
+ scope: global
+ type: code
+ - name: d1
+ scope: global
+ type: data
diff --git a/lld/test/core/Inputs/sectiongroup-remaining-undef.objtxt b/lld/test/core/Inputs/sectiongroup-remaining-undef.objtxt
new file mode 100644
index 00000000000..07c7af5dc67
--- /dev/null
+++ b/lld/test/core/Inputs/sectiongroup-remaining-undef.objtxt
@@ -0,0 +1,34 @@
+---
+defined-atoms:
+ - name: anotherfunction
+ scope: global
+ type: data
+ - name: f1
+ scope: global
+ type: code
+ - name: f2
+ scope: global
+ type: code
+ - name: f3
+ scope: global
+ type: code
+ - name: g1
+ scope: global
+ type: code
+ - name: d1
+ scope: global
+ type: data
+ - name: g1
+ scope: global
+ type: group-comdat
+ references:
+ - kind: group-child
+ target: f1
+ - kind: group-child
+ target: f2
+ - kind: group-child
+ target: f3
+ - kind: group-child
+ target: g1
+ - kind: group-child
+ target: d1
diff --git a/lld/test/core/Inputs/sectiongroup-remaining-undef2.objtxt b/lld/test/core/Inputs/sectiongroup-remaining-undef2.objtxt
new file mode 100644
index 00000000000..4991476c621
--- /dev/null
+++ b/lld/test/core/Inputs/sectiongroup-remaining-undef2.objtxt
@@ -0,0 +1,4 @@
+---
+undefined-atoms:
+ - name: f3
+ can-be-null: never
diff --git a/lld/test/core/Inputs/sectiongroup-resolve.objtxt b/lld/test/core/Inputs/sectiongroup-resolve.objtxt
new file mode 100644
index 00000000000..a047ad33fe9
--- /dev/null
+++ b/lld/test/core/Inputs/sectiongroup-resolve.objtxt
@@ -0,0 +1,26 @@
+---
+defined-atoms:
+ - name: f1
+ scope: global
+ type: code
+ - name: f2
+ scope: global
+ type: code
+ - name: g1
+ scope: global
+ type: code
+ - name: d1
+ scope: global
+ type: data
+ - name: g1
+ scope: global
+ type: group-comdat
+ references:
+ - kind: group-child
+ target: f1
+ - kind: group-child
+ target: f2
+ - kind: group-child
+ target: g1
+ - kind: group-child
+ target: d1
diff --git a/lld/test/core/Inputs/sectiongroup-simple.objtxt b/lld/test/core/Inputs/sectiongroup-simple.objtxt
new file mode 100644
index 00000000000..807f0d35802
--- /dev/null
+++ b/lld/test/core/Inputs/sectiongroup-simple.objtxt
@@ -0,0 +1,4 @@
+---
+undefined-atoms:
+ - name: f1
+ can-be-null: never
diff --git a/lld/test/core/Inputs/shared-library-coalesce.objtxt b/lld/test/core/Inputs/shared-library-coalesce.objtxt
new file mode 100644
index 00000000000..57cdfe662d4
--- /dev/null
+++ b/lld/test/core/Inputs/shared-library-coalesce.objtxt
@@ -0,0 +1,28 @@
+---
+shared-library-atoms:
+ - name: foo2
+ load-name: libc.so
+
+ - name: foo3
+ load-name: libc.so
+
+ - name: bar2
+ load-name: libc.so
+ can-be-null: at-runtime
+
+ - name: bar3
+ load-name: libc.so
+ can-be-null: at-runtime
+
+ - name: mismatchNull1
+ load-name: libc.so
+
+ - name: mismatchNull2
+ load-name: libc.so
+ can-be-null: at-runtime
+
+ - name: mismatchload1
+ load-name: libb.so
+
+ - name: mismatchload2
+ load-name: liba.so
diff --git a/lld/test/core/Inputs/tent-merge.objtxt b/lld/test/core/Inputs/tent-merge.objtxt
new file mode 100644
index 00000000000..90db8fd1f44
--- /dev/null
+++ b/lld/test/core/Inputs/tent-merge.objtxt
@@ -0,0 +1,6 @@
+---
+defined-atoms:
+ - name: _foo
+ scope: global
+ type: data
+ content: [ 00, 00, 00, 00 ]
diff --git a/lld/test/core/Inputs/undef-coalesce-error.objtxt b/lld/test/core/Inputs/undef-coalesce-error.objtxt
new file mode 100644
index 00000000000..f493f00bdf1
--- /dev/null
+++ b/lld/test/core/Inputs/undef-coalesce-error.objtxt
@@ -0,0 +1,8 @@
+---
+defined-atoms:
+ - name: bar
+ type: code
+
+undefined-atoms:
+ - name: malloc
+ - name: myfunc
diff --git a/lld/test/core/Inputs/undef-coalesce-error2.objtxt b/lld/test/core/Inputs/undef-coalesce-error2.objtxt
new file mode 100644
index 00000000000..88d736fc211
--- /dev/null
+++ b/lld/test/core/Inputs/undef-coalesce-error2.objtxt
@@ -0,0 +1,8 @@
+---
+defined-atoms:
+ - name: myfunc
+ scope: global
+ type: code
+
+undefined-atoms:
+ - name: free
diff --git a/lld/test/core/Inputs/undef-coalesce.objtxt b/lld/test/core/Inputs/undef-coalesce.objtxt
new file mode 100644
index 00000000000..f493f00bdf1
--- /dev/null
+++ b/lld/test/core/Inputs/undef-coalesce.objtxt
@@ -0,0 +1,8 @@
+---
+defined-atoms:
+ - name: bar
+ type: code
+
+undefined-atoms:
+ - name: malloc
+ - name: myfunc
diff --git a/lld/test/core/Inputs/undef-coalesce2.objtxt b/lld/test/core/Inputs/undef-coalesce2.objtxt
new file mode 100644
index 00000000000..88d736fc211
--- /dev/null
+++ b/lld/test/core/Inputs/undef-coalesce2.objtxt
@@ -0,0 +1,8 @@
+---
+defined-atoms:
+ - name: myfunc
+ scope: global
+ type: code
+
+undefined-atoms:
+ - name: free
diff --git a/lld/test/core/Inputs/undef-fallback.objtxt b/lld/test/core/Inputs/undef-fallback.objtxt
new file mode 100644
index 00000000000..c392731805c
--- /dev/null
+++ b/lld/test/core/Inputs/undef-fallback.objtxt
@@ -0,0 +1,7 @@
+defined-atoms:
+ - name: fallback1
+
+undefined-atoms:
+ - name: def1
+ fallback:
+ name: fallback3
diff --git a/lld/test/core/Inputs/undef-weak-coalesce.objtxt b/lld/test/core/Inputs/undef-weak-coalesce.objtxt
new file mode 100644
index 00000000000..7a5e20fad09
--- /dev/null
+++ b/lld/test/core/Inputs/undef-weak-coalesce.objtxt
@@ -0,0 +1,20 @@
+---
+undefined-atoms:
+ - name: bar1
+ can-be-null: never
+ - name: bar2
+ can-be-null: at-runtime
+ - name: bar3
+ can-be-null: at-buildtime
+ - name: bar4
+ can-be-null: at-runtime
+ - name: bar5
+ can-be-null: at-buildtime
+ - name: bar6
+ can-be-null: never
+ - name: bar7
+ can-be-null: at-buildtime
+ - name: bar8
+ can-be-null: never
+ - name: bar9
+ can-be-null: at-runtime
diff --git a/lld/test/core/Inputs/weak-coalesce.objtxt b/lld/test/core/Inputs/weak-coalesce.objtxt
new file mode 100644
index 00000000000..8a1dcdb9c37
--- /dev/null
+++ b/lld/test/core/Inputs/weak-coalesce.objtxt
@@ -0,0 +1,5 @@
+---
+defined-atoms:
+ - name: _foo
+ scope: global
+ type: data
diff --git a/lld/test/core/Inputs/weak-coalesce2.objtxt b/lld/test/core/Inputs/weak-coalesce2.objtxt
new file mode 100644
index 00000000000..1039b309f8a
--- /dev/null
+++ b/lld/test/core/Inputs/weak-coalesce2.objtxt
@@ -0,0 +1,6 @@
+---
+defined-atoms:
+ - name: _foo
+ merge: as-weak
+ scope: global
+ type: data
diff --git a/lld/test/core/archive-basic.objtxt b/lld/test/core/archive-basic.objtxt
index ec825c1a7e5..205e0a5034e 100644
--- a/lld/test/core/archive-basic.objtxt
+++ b/lld/test/core/archive-basic.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/archive-basic.objtxt | FileCheck %s
#
# Tests archives in YAML. Tests that an undefined in a regular file will load
@@ -13,27 +13,6 @@ defined-atoms:
undefined-atoms:
- name: bar
---- !archive
-members:
- - name: bar.o
- content: !native
- defined-atoms:
- - name: bar
- scope: global
- type: code
-
- - name: bar2
- type: code
-
- - name: baz.o
- content: !native
- defined-atoms:
- - name: baz
- scope: global
- type: code
-
- - name: baz2
- type: code
...
# CHECK: name: foo
diff --git a/lld/test/core/archive-chain.objtxt b/lld/test/core/archive-chain.objtxt
index 0f80985ec11..35417f0bdb6 100644
--- a/lld/test/core/archive-chain.objtxt
+++ b/lld/test/core/archive-chain.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/archive-chain.objtxt %p/Inputs/archive-chain2.objtxt | FileCheck %s
#
# Tests that an undefine in one archive can force a load from another archive.
@@ -11,53 +11,6 @@ defined-atoms:
undefined-atoms:
- name: bar1
-
---- !archive
-members:
- - name: bar1.o
- content: !native
- defined-atoms:
- - name: bar1
- scope: global
- type: code
-
- - name: bar1b
- type: code
-
- undefined-atoms:
- - name: baz1
-
- - name: bar2.o
- content: !native
- defined-atoms:
- - name: bar2
- scope: global
- type: code
-
- - name: bar2b
- type: code
-
---- !archive
-members:
- - name: baz1.o
- content: !native
- defined-atoms:
- - name: baz1
- scope: global
- type: code
-
- - name: baz1b
- type: code
-
- - name: baz2.o
- content: !native
- defined-atoms:
- - name: baz2
- scope: global
- type: code
-
- - name: baz2b
- type: code
...
# CHECK: name: foo
diff --git a/lld/test/core/archive-tentdef-search.objtxt b/lld/test/core/archive-tentdef-search.objtxt
index 3d26778e498..230ab0bfd0d 100644
--- a/lld/test/core/archive-tentdef-search.objtxt
+++ b/lld/test/core/archive-tentdef-search.objtxt
@@ -1,5 +1,5 @@
-# RUN: lld -core %s | FileCheck -check-prefix=CHK1 %s
-# RUN: lld -core --commons-search-archives %s | FileCheck -check-prefix=CHK2 %s
+# RUN: lld -core %s %p/Inputs/archive-tentdef-search.objtxt | FileCheck -check-prefix=CHK1 %s
+# RUN: lld -core --commons-search-archives %s %p/Inputs/archive-tentdef-search.objtxt | FileCheck -check-prefix=CHK2 %s
#
# Tests that -commons-search-archives cause core linker to look for overrides
@@ -16,18 +16,6 @@ defined-atoms:
scope: global
type: zero-fill
merge: as-tentative
-
---- !archive
-members:
- - name: bar.o
- content: !native
- defined-atoms:
- - name: bar
- scope: global
- type: data
-
- - name: bar2
- type: data
...
# CHK1: name: foo
diff --git a/lld/test/core/associates.objtxt b/lld/test/core/associates.objtxt
index bf780693ab7..5c711c97f9f 100644
--- a/lld/test/core/associates.objtxt
+++ b/lld/test/core/associates.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/associates.objtxt | FileCheck %s
---
defined-atoms:
@@ -9,15 +9,6 @@ defined-atoms:
- kind: associate
target: f2
- name: f2
----
-defined-atoms:
- - name: f1
- merge: as-weak
- scope: global
- references:
- - kind: associate
- target: f2
- - name: f2
...
# CHECK: defined-atoms:
diff --git a/lld/test/core/auto-hide-coalesce.objtxt b/lld/test/core/auto-hide-coalesce.objtxt
index ad82d5afc57..63c54951150 100644
--- a/lld/test/core/auto-hide-coalesce.objtxt
+++ b/lld/test/core/auto-hide-coalesce.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/auto-hide-coalesce.objtxt | FileCheck %s
#
# Tests auto-hide bit during coalescing
@@ -25,27 +25,6 @@ defined-atoms:
scope: global
type: code
merge: as-addressed-weak
----
-defined-atoms:
- - name: _inlineFunc1
- scope: global
- type: code
- merge: as-weak
-
- - name: _inlineFunc2
- scope: global
- type: code
- merge: as-addressed-weak
-
- - name: _inlineFunc3
- scope: global
- type: code
- merge: as-weak
-
- - name: _inlineFunc4
- scope: global
- type: code
- merge: as-addressed-weak
...
diff --git a/lld/test/core/code-model-attributes.objtxt b/lld/test/core/code-model-attributes.objtxt
index 8c30e868567..9bb4a01bd1a 100644
--- a/lld/test/core/code-model-attributes.objtxt
+++ b/lld/test/core/code-model-attributes.objtxt
@@ -1,5 +1,8 @@
-# RUN: lld -core %s | FileCheck %s
-
+# RUN: lld -core %s %p/Inputs/code-model-attributes.objtxt \
+# RUN: %p/Inputs/code-model-attributes2.objtxt \
+# RUN: %p/Inputs/code-model-attributes3.objtxt \
+# RUN: %p/Inputs/code-model-attributes4.objtxt \
+# RUN: %p/Inputs/code-model-attributes5.objtxt | FileCheck %s
#
# Test that code model attributes are preserved
#
@@ -7,26 +10,6 @@
---
defined-atoms:
- name: _def
----
-defined-atoms:
- - name: _none
- code-model: none
----
-defined-atoms:
- - name: _mips_pic
- code-model: mips-pic
----
-defined-atoms:
- - name: _mips_micro
- code-model: mips-micro
----
-defined-atoms:
- - name: _mips_micro_pic
- code-model: mips-micro-pic
----
-defined-atoms:
- - name: _mips_16
- code-model: mips-16
...
# CHECK: name: _def
diff --git a/lld/test/core/constants-coalesce.objtxt b/lld/test/core/constants-coalesce.objtxt
index a82f6800908..1a9f1013e6e 100644
--- a/lld/test/core/constants-coalesce.objtxt
+++ b/lld/test/core/constants-coalesce.objtxt
@@ -1,4 +1,5 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/constants-coalesce.objtxt \
+# RUN: %p/Inputs/constants-coalesce2.objtxt | FileCheck %s
#
# Test that duplicate merge-by-content anonymous constants are coalesced
@@ -20,25 +21,6 @@ defined-atoms:
- ref-name: L1
type: constant
content: [ 01, 02 ]
----
-defined-atoms:
- - ref-name: L1
- type: constant
- content: [ 01, 02 ]
- - ref-name: L2
- type: constant
- merge: by-content
- content: [ 01, 02, 03, 04 ]
----
-defined-atoms:
- - ref-name: L2
- type: constant
- merge: by-content
- content: [ 01, 23, 45, 67, 89, AB, CD, EF ]
- - ref-name: L3
- type: constant
- merge: by-content
- content: [ 01, 02, 03 ]
...
# CHECK-NOT: name:
diff --git a/lld/test/core/cstring-coalesce.objtxt b/lld/test/core/cstring-coalesce.objtxt
index 78986a08c64..4d32c00daf8 100644
--- a/lld/test/core/cstring-coalesce.objtxt
+++ b/lld/test/core/cstring-coalesce.objtxt
@@ -15,18 +15,6 @@ defined-atoms:
type: c-string
merge: by-content
content: [ 74, 68, 65, 72, 65, 00 ]
----
-defined-atoms:
- - ref-name: L2
- type: c-string
- merge: by-content
- content: [ 68, 65, 6c, 6c, 6f, 00 ]
----
-defined-atoms:
- - ref-name: L2
- type: c-string
- merge: by-content
- content: [ 74, 68, 65, 72, 65, 00 ]
...
# CHECK-NOT: name:
diff --git a/lld/test/core/custom-section-coalesce.objtxt b/lld/test/core/custom-section-coalesce.objtxt
index e9bada56938..fcf04845a7d 100644
--- a/lld/test/core/custom-section-coalesce.objtxt
+++ b/lld/test/core/custom-section-coalesce.objtxt
@@ -1,4 +1,5 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/custom-section-coalesce.objtxt \
+# RUN: %p/Inputs/custom-section-coalesce2.objtxt | FileCheck %s
#
# Test that custom sections are preserved when duplicate merge-by-content
@@ -25,35 +26,6 @@ defined-atoms:
type: constant
merge: by-content
content: [ 01, 02, 03, 04 ]
-
----
-defined-atoms:
- - ref-name: L1
- type: constant
- merge: by-content
- content: [ 01, 02, 03, 04 ]
- section-choice: custom-required
- section-name: .mysection
-
- - ref-name: L2
- type: constant
- merge: by-content
- content: [ 01, 02, 03, 04 ]
- section-choice: custom-required
- section-name: .mysection2
----
-defined-atoms:
- - ref-name: L1
- type: constant
- merge: by-content
- content: [ 05, 06, 07, 08 ]
- section-choice: custom-required
- section-name: .mysection
-
- - ref-name: L2
- type: constant
- merge: by-content
- content: [ 01, 02, 03, 04 ]
...
diff --git a/lld/test/core/dead-strip-attributes.objtxt b/lld/test/core/dead-strip-attributes.objtxt
index dcb35a21e26..2a1c97627d2 100644
--- a/lld/test/core/dead-strip-attributes.objtxt
+++ b/lld/test/core/dead-strip-attributes.objtxt
@@ -1,4 +1,5 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/dead-strip-attributes.objtxt \
+# RUN: %p/Inputs/dead-strip-attributes2.objtxt | FileCheck %s
#
# Test that dead strip attributes are preserved
@@ -8,14 +9,6 @@
defined-atoms:
- name: _foo1
dead-strip: normal
----
-defined-atoms:
- - name: _foo2
- dead-strip: never
----
-defined-atoms:
- - name: _foo3
- dead-strip: always
...
diff --git a/lld/test/core/dead-strip-basic.objtxt b/lld/test/core/dead-strip-basic.objtxt
index 64cd2291c76..1607ea9e5b8 100644
--- a/lld/test/core/dead-strip-basic.objtxt
+++ b/lld/test/core/dead-strip-basic.objtxt
@@ -1,5 +1,5 @@
-# RUN: lld -core --dead-strip %s | FileCheck -check-prefix=CHK1 %s
-# RUN: lld -core %s | FileCheck -check-prefix=CHK2 %s
+# RUN: lld -core --dead-strip %s %p/Inputs/dead-strip-basic.objtxt %p/Inputs/dead-strip-basic2.objtxt | FileCheck -check-prefix=CHK1 %s
+# RUN: lld -core %s %p/Inputs/dead-strip-basic.objtxt %p/Inputs/dead-strip-basic2.objtxt | FileCheck -check-prefix=CHK2 %s
#
# Test that -dead-strip removes unreachable code and data
@@ -25,23 +25,6 @@ undefined-atoms:
- name: bar
- name: baz
----
-defined-atoms:
- - name: mydead2
- scope: global
- type: data
-
- - name: bar
- scope: global
- type: data
----
-defined-atoms:
- - name: baz
- scope: global
- type: code
-
- - name: mydead3
- type: code
...
diff --git a/lld/test/core/dead-strip-globals.objtxt b/lld/test/core/dead-strip-globals.objtxt
index 8feb235d07c..e4b11b16f69 100644
--- a/lld/test/core/dead-strip-globals.objtxt
+++ b/lld/test/core/dead-strip-globals.objtxt
@@ -1,5 +1,5 @@
-# RUN: lld -core --dead-strip --keep-globals %s | FileCheck -check-prefix=CHK1 %s
-# RUN: lld -core --dead-strip %s | FileCheck -check-prefix=CHK2 %s
+# RUN: lld -core --dead-strip --keep-globals %s %p/Inputs/dead-strip-globals.objtxt %p/Inputs/dead-strip-globals2.objtxt | FileCheck -check-prefix=CHK1 %s
+# RUN: lld -core --dead-strip %s %p/Inputs/dead-strip-globals.objtxt %p/Inputs/dead-strip-globals2.objtxt | FileCheck -check-prefix=CHK2 %s
#
# Test that -keep-globals prevents -dead-strip from removing globals.
@@ -23,23 +23,6 @@ defined-atoms:
undefined-atoms:
- name: bar
- name: baz
----
-defined-atoms:
- - name: myglobal2
- scope: global
- type: data
-
- - name: bar
- scope: hidden
- type: data
----
-defined-atoms:
- - name: baz
- scope: hidden
- type: code
-
- - name: mydead
- type: code
...
diff --git a/lld/test/core/error-duplicate-absolutes.objtxt b/lld/test/core/error-duplicate-absolutes.objtxt
index 533297e59dc..513a2f49448 100644
--- a/lld/test/core/error-duplicate-absolutes.objtxt
+++ b/lld/test/core/error-duplicate-absolutes.objtxt
@@ -1,4 +1,4 @@
-# RUN: not lld -core %s 2> %t.err
+# RUN: not lld -core %s %p/Inputs/error-duplicate-absolutes.objtxt 2> %t.err
# RUN: FileCheck %s < %t.err
#
@@ -12,11 +12,6 @@ absolute-atoms:
scope: global
undefined-atoms:
- name: undefatom
----
-absolute-atoms:
- - name: absatom
- value: 0
- scope: global
...
diff --git a/lld/test/core/gnulinkonce-rearrange-resolve.objtxt b/lld/test/core/gnulinkonce-rearrange-resolve.objtxt
index 2a6386a6935..b3df078d231 100644
--- a/lld/test/core/gnulinkonce-rearrange-resolve.objtxt
+++ b/lld/test/core/gnulinkonce-rearrange-resolve.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/gnulinkonce-rearrange-resolve.objtxt | FileCheck %s
#
# Test that gnu linkonce sections are parsed and the first section selected for symbol
@@ -31,32 +31,6 @@ defined-atoms:
- name: d1
scope: global
type: data
----
-defined-atoms:
- - name: g1
- scope: global
- type: gnu-linkonce
- references:
- - kind: group-child
- target: f1
- - kind: group-child
- target: f2
- - kind: group-child
- target: g1
- - kind: group-child
- target: d1
- - name: f1
- scope: global
- type: code
- - name: f2
- scope: global
- type: code
- - name: g1
- scope: global
- type: code
- - name: d1
- scope: global
- type: data
...
# CHECK: defined-atoms:
diff --git a/lld/test/core/gnulinkonce-remaining-undef.objtxt b/lld/test/core/gnulinkonce-remaining-undef.objtxt
index 490608209ba..5fe0ab55b5c 100644
--- a/lld/test/core/gnulinkonce-remaining-undef.objtxt
+++ b/lld/test/core/gnulinkonce-remaining-undef.objtxt
@@ -1,4 +1,5 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/gnulinkonce-remaining-undef.objtxt \
+# RUN: %p/Inputs/gnulinkonce-remaining-undef2.objtxt | FileCheck %s
#
# Test that gnu linkonce sections are parsed and the first section selected for
@@ -33,44 +34,6 @@ defined-atoms:
target: g1
- kind: group-child
target: d1
----
-defined-atoms:
- - name: anotherfunction
- scope: global
- type: data
- - name: f1
- scope: global
- type: code
- - name: f2
- scope: global
- type: code
- - name: f3
- scope: global
- type: code
- - name: g1
- scope: global
- type: code
- - name: d1
- scope: global
- type: data
- - name: g1
- scope: global
- type: gnu-linkonce
- references:
- - kind: group-child
- target: f1
- - kind: group-child
- target: f2
- - kind: group-child
- target: f3
- - kind: group-child
- target: g1
- - kind: group-child
- target: d1
----
-undefined-atoms:
- - name: f3
- can-be-null: never
...
#CHECK: - name: anotherfunction
diff --git a/lld/test/core/gnulinkonce-resolve.objtxt b/lld/test/core/gnulinkonce-resolve.objtxt
index 817e9cfdd4e..e926c39bd0e 100644
--- a/lld/test/core/gnulinkonce-resolve.objtxt
+++ b/lld/test/core/gnulinkonce-resolve.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/gnulinkonce-resolve.objtxt | FileCheck %s
#
# Test that gnu linkonce sections are parsed and the first section selected for symbol
@@ -31,32 +31,6 @@ defined-atoms:
target: g1
- kind: group-child
target: d1
----
-defined-atoms:
- - name: f1
- scope: global
- type: code
- - name: f2
- scope: global
- type: code
- - name: g1
- scope: global
- type: code
- - name: d1
- scope: global
- type: data
- - name: g1
- scope: global
- type: gnu-linkonce
- references:
- - kind: group-child
- target: f1
- - kind: group-child
- target: f2
- - kind: group-child
- target: g1
- - kind: group-child
- target: d1
...
#CHECK: defined-atoms:
diff --git a/lld/test/core/gnulinkonce-simple.objtxt b/lld/test/core/gnulinkonce-simple.objtxt
index da325d48c36..0576e5f75d7 100644
--- a/lld/test/core/gnulinkonce-simple.objtxt
+++ b/lld/test/core/gnulinkonce-simple.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/gnulinkonce-simple.objtxt | FileCheck %s
#
# Test that gnu linkonce sections are parsed properly when there is a reference to a
@@ -37,10 +37,6 @@ defined-atoms:
- name: anotherfunction
scope: global
type: data
----
-undefined-atoms:
- - name: f1
- can-be-null: never
...
#CHECK: defined-atoms:
diff --git a/lld/test/core/inline-coalesce.objtxt b/lld/test/core/inline-coalesce.objtxt
index 6df9d0e7a49..5ddc9b2624b 100644
--- a/lld/test/core/inline-coalesce.objtxt
+++ b/lld/test/core/inline-coalesce.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/inline-coalesce.objtxt %p/Inputs/inline-coalesce2.objtxt | FileCheck %s
#
# Test that non-inlined inlined functions are silently coalesced
@@ -10,18 +10,6 @@ defined-atoms:
scope: global
type: code
merge: as-weak
----
-defined-atoms:
- - name: _inlineFunc
- scope: global
- type: code
- merge: as-weak
----
-defined-atoms:
- - name: _inlineFunc
- scope: global
- type: code
- merge: as-weak
...
diff --git a/lld/test/core/multiple-def-error.objtxt b/lld/test/core/multiple-def-error.objtxt
index 7c7732c15fd..5765814e53e 100644
--- a/lld/test/core/multiple-def-error.objtxt
+++ b/lld/test/core/multiple-def-error.objtxt
@@ -1,4 +1,4 @@
-# RUN: not lld -core %s 2>&1 | FileCheck %s
+# RUN: not lld -core %s %p/Inputs/multiple-def-error.objtxt 2>&1 | FileCheck %s
#
# Test that multiple definitions cause an error
@@ -11,9 +11,4 @@ defined-atoms:
- name: _foo
scope: global
type: data
----
-defined-atoms:
- - name: _foo
- scope: global
- type: data
...
diff --git a/lld/test/core/sectiongroup-deadstrip.objtxt b/lld/test/core/sectiongroup-deadstrip.objtxt
index 8606c52d62e..5055c6e06b6 100644
--- a/lld/test/core/sectiongroup-deadstrip.objtxt
+++ b/lld/test/core/sectiongroup-deadstrip.objtxt
@@ -1,6 +1,6 @@
# Test for section group members be preserved even if there is a
# reference to only one functions in the group.
-# RUN: lld -core --dead-strip %s | FileCheck %s
+# RUN: lld -core --dead-strip %s %p/Inputs/sectiongroup-deadstrip.objtxt | FileCheck %s
#
# Test that section groups are parsed properly when there is a reference to a
@@ -45,10 +45,6 @@ defined-atoms:
- name: anotherfunction
scope: global
type: data
----
-undefined-atoms:
- - name: f1
- can-be-null: never
...
#CHECK: defined-atoms:
diff --git a/lld/test/core/sectiongroup-gnulinkonce-error.objtxt b/lld/test/core/sectiongroup-gnulinkonce-error.objtxt
index 47598957f8d..1b861706783 100644
--- a/lld/test/core/sectiongroup-gnulinkonce-error.objtxt
+++ b/lld/test/core/sectiongroup-gnulinkonce-error.objtxt
@@ -1,4 +1,4 @@
-# RUN: not lld -core %s 2>&1 | FileCheck %s
+# RUN: not lld -core %s %p/Inputs/sectiongroup-gnulinkonce-error.objtxt 2>&1 | FileCheck %s
#
# Test that section groups/gnu linkonce sections are parsed and a merge error
@@ -31,32 +31,6 @@ defined-atoms:
target: g1
- kind: group-child
target: d1
----
-defined-atoms:
- - name: f1
- scope: global
- type: code
- - name: f2
- scope: global
- type: code
- - name: g1
- scope: global
- type: code
- - name: d1
- scope: global
- type: data
- - name: g1
- scope: global
- type: gnu-linkonce
- references:
- - kind: group-child
- target: f1
- - kind: group-child
- target: f2
- - kind: group-child
- target: g1
- - kind: group-child
- target: d1
...
#CHECK: SymbolTable: error while merging g1
diff --git a/lld/test/core/sectiongroup-rearrange-resolve.objtxt b/lld/test/core/sectiongroup-rearrange-resolve.objtxt
index 7f5d2603775..f191113718d 100644
--- a/lld/test/core/sectiongroup-rearrange-resolve.objtxt
+++ b/lld/test/core/sectiongroup-rearrange-resolve.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/sectiongroup-rearrange-resolve.objtxt | FileCheck %s
#
# Test that section groups are parsed and the first group selected for symbol
@@ -31,32 +31,6 @@ defined-atoms:
- name: d1
scope: global
type: data
----
-defined-atoms:
- - name: g1
- scope: global
- type: group-comdat
- references:
- - kind: group-child
- target: f1
- - kind: group-child
- target: f2
- - kind: group-child
- target: g1
- - kind: group-child
- target: d1
- - name: f1
- scope: global
- type: code
- - name: f2
- scope: global
- type: code
- - name: g1
- scope: global
- type: code
- - name: d1
- scope: global
- type: data
...
# CHECK: defined-atoms:
diff --git a/lld/test/core/sectiongroup-remaining-undef.objtxt b/lld/test/core/sectiongroup-remaining-undef.objtxt
index 7d889b8a493..0a292040a35 100644
--- a/lld/test/core/sectiongroup-remaining-undef.objtxt
+++ b/lld/test/core/sectiongroup-remaining-undef.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/sectiongroup-remaining-undef.objtxt %p/Inputs/sectiongroup-remaining-undef2.objtxt | FileCheck %s
#
# Test that section groups are parsed and the first group selected for symbol
@@ -33,44 +33,6 @@ defined-atoms:
target: g1
- kind: group-child
target: d1
----
-defined-atoms:
- - name: anotherfunction
- scope: global
- type: data
- - name: f1
- scope: global
- type: code
- - name: f2
- scope: global
- type: code
- - name: f3
- scope: global
- type: code
- - name: g1
- scope: global
- type: code
- - name: d1
- scope: global
- type: data
- - name: g1
- scope: global
- type: group-comdat
- references:
- - kind: group-child
- target: f1
- - kind: group-child
- target: f2
- - kind: group-child
- target: f3
- - kind: group-child
- target: g1
- - kind: group-child
- target: d1
----
-undefined-atoms:
- - name: f3
- can-be-null: never
...
#CHECK: - name: anotherfunction
diff --git a/lld/test/core/sectiongroup-resolve.objtxt b/lld/test/core/sectiongroup-resolve.objtxt
index 2d481b1818b..52197dbb4e9 100644
--- a/lld/test/core/sectiongroup-resolve.objtxt
+++ b/lld/test/core/sectiongroup-resolve.objtxt
@@ -31,32 +31,6 @@ defined-atoms:
target: g1
- kind: group-child
target: d1
----
-defined-atoms:
- - name: f1
- scope: global
- type: code
- - name: f2
- scope: global
- type: code
- - name: g1
- scope: global
- type: code
- - name: d1
- scope: global
- type: data
- - name: g1
- scope: global
- type: group-comdat
- references:
- - kind: group-child
- target: f1
- - kind: group-child
- target: f2
- - kind: group-child
- target: g1
- - kind: group-child
- target: d1
...
#CHECK: defined-atoms:
diff --git a/lld/test/core/sectiongroup-simple.objtxt b/lld/test/core/sectiongroup-simple.objtxt
index 9f0ff9581c1..d81b1a1b313 100644
--- a/lld/test/core/sectiongroup-simple.objtxt
+++ b/lld/test/core/sectiongroup-simple.objtxt
@@ -37,10 +37,6 @@ defined-atoms:
- name: anotherfunction
scope: global
type: data
----
-undefined-atoms:
- - name: f1
- can-be-null: never
...
#CHECK: defined-atoms:
diff --git a/lld/test/core/shared-library-coalesce.objtxt b/lld/test/core/shared-library-coalesce.objtxt
index 51ff93e87a8..1cd25d18f88 100644
--- a/lld/test/core/shared-library-coalesce.objtxt
+++ b/lld/test/core/shared-library-coalesce.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/shared-library-coalesce.objtxt | FileCheck %s
#
# Test that shared library symbols preserve their attributes and merge properly
@@ -33,35 +33,6 @@ shared-library-atoms:
- name: mismatchload2
load-name: libb.so
----
-shared-library-atoms:
- - name: foo2
- load-name: libc.so
-
- - name: foo3
- load-name: libc.so
-
- - name: bar2
- load-name: libc.so
- can-be-null: at-runtime
-
- - name: bar3
- load-name: libc.so
- can-be-null: at-runtime
-
- - name: mismatchNull1
- load-name: libc.so
-
- - name: mismatchNull2
- load-name: libc.so
- can-be-null: at-runtime
-
- - name: mismatchload1
- load-name: libb.so
-
- - name: mismatchload2
- load-name: liba.so
-
...
# CHECK: name: foo1
diff --git a/lld/test/core/tent-merge.objtxt b/lld/test/core/tent-merge.objtxt
index 8ad46d40ae1..8997be2833b 100644
--- a/lld/test/core/tent-merge.objtxt
+++ b/lld/test/core/tent-merge.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/tent-merge.objtxt | FileCheck %s
#
# Test that a tentative definition and a regular global are merged into
@@ -12,12 +12,6 @@ defined-atoms:
scope: global
type: zero-fill
size: 4
----
-defined-atoms:
- - name: _foo
- scope: global
- type: data
- content: [ 00, 00, 00, 00 ]
...
diff --git a/lld/test/core/undef-coalesce-error.objtxt b/lld/test/core/undef-coalesce-error.objtxt
index a0485befd28..f0ad8d8555a 100644
--- a/lld/test/core/undef-coalesce-error.objtxt
+++ b/lld/test/core/undef-coalesce-error.objtxt
@@ -1,6 +1,6 @@
-# RUN: not lld -core --undefines-are-errors %s 2> %t.err
+# RUN: not lld -core --undefines-are-errors %s %p/Inputs/undef-coalesce-error.objtxt %p/Inputs/undef-coalesce-error2.objtxt 2> %t.err
# RUN: FileCheck -check-prefix=CHECKERR %s < %t.err
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/undef-coalesce-error.objtxt %p/Inputs/undef-coalesce-error2.objtxt | FileCheck %s
#
# Test that -undefines-are-errors triggers and error
@@ -15,22 +15,6 @@ defined-atoms:
undefined-atoms:
- name: malloc
- name: free
----
-defined-atoms:
- - name: bar
- type: code
-
-undefined-atoms:
- - name: malloc
- - name: myfunc
----
-defined-atoms:
- - name: myfunc
- scope: global
- type: code
-
-undefined-atoms:
- - name: free
...
# CHECKERR: free
diff --git a/lld/test/core/undef-coalesce.objtxt b/lld/test/core/undef-coalesce.objtxt
index 822ed5acf19..b0ea2b92897 100644
--- a/lld/test/core/undef-coalesce.objtxt
+++ b/lld/test/core/undef-coalesce.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/undef-coalesce.objtxt %p/Inputs/undef-coalesce2.objtxt | FileCheck %s
#
# Test that undefined symbols are coalesced with other undefined symbols
@@ -13,22 +13,6 @@ defined-atoms:
undefined-atoms:
- name: malloc
- name: free
----
-defined-atoms:
- - name: bar
- type: code
-
-undefined-atoms:
- - name: malloc
- - name: myfunc
----
-defined-atoms:
- - name: myfunc
- scope: global
- type: code
-
-undefined-atoms:
- - name: free
...
# CHECK: defined-atoms:
diff --git a/lld/test/core/undef-fallback.objtxt b/lld/test/core/undef-fallback.objtxt
index 8abaa93c8e8..aef7b6d7c26 100644
--- a/lld/test/core/undef-fallback.objtxt
+++ b/lld/test/core/undef-fallback.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %p/undef-fallback.objtxt %p/Inputs/undef-fallback.objtxt | FileCheck %s
# Test that fallback atoms can be parsed by YAML reader and processed by the
# core linker.
@@ -15,14 +15,6 @@ undefined-atoms:
- name: undef2
fallback:
name: fallback2
----
-defined-atoms:
- - name: fallback1
-
-undefined-atoms:
- - name: def1
- fallback:
- name: fallback3
...
# CHECK: defined-atoms:
diff --git a/lld/test/core/undef-weak-coalesce.objtxt b/lld/test/core/undef-weak-coalesce.objtxt
index 97e0fd28500..d46a05cb95c 100644
--- a/lld/test/core/undef-weak-coalesce.objtxt
+++ b/lld/test/core/undef-weak-coalesce.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/undef-weak-coalesce.objtxt| FileCheck %s
#
# Test that undefined symbols preserve their attributes and merge properly
@@ -30,26 +30,6 @@ undefined-atoms:
can-be-null: at-runtime
- name: bar9
can-be-null: at-buildtime
----
-undefined-atoms:
- - name: bar1
- can-be-null: never
- - name: bar2
- can-be-null: at-runtime
- - name: bar3
- can-be-null: at-buildtime
- - name: bar4
- can-be-null: at-runtime
- - name: bar5
- can-be-null: at-buildtime
- - name: bar6
- can-be-null: never
- - name: bar7
- can-be-null: at-buildtime
- - name: bar8
- can-be-null: never
- - name: bar9
- can-be-null: at-runtime
...
# CHECK: - name: regular_func
diff --git a/lld/test/core/weak-coalesce.objtxt b/lld/test/core/weak-coalesce.objtxt
index 550c10cfa46..e92aedeb4f1 100644
--- a/lld/test/core/weak-coalesce.objtxt
+++ b/lld/test/core/weak-coalesce.objtxt
@@ -1,20 +1,6 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core %s %p/Inputs/weak-coalesce.objtxt \
+# RUN: %p/Inputs/weak-coalesce2.objtxt | FileCheck %s
-#
-# Test that weak definitions are coalesced away in favor of a regular definition
-#
-
----
-defined-atoms:
- - name: _foo
- merge: as-weak
- scope: global
- type: data
----
-defined-atoms:
- - name: _foo
- scope: global
- type: data
---
defined-atoms:
- name: _foo
diff --git a/lld/test/darwin/Inputs/native-and-mach-o.objtxt b/lld/test/darwin/Inputs/native-and-mach-o.objtxt
new file mode 100644
index 00000000000..58124eb8332
--- /dev/null
+++ b/lld/test/darwin/Inputs/native-and-mach-o.objtxt
@@ -0,0 +1,17 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_OBJECT
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS ]
+ address: 0
+ content: [ 0xC3 ]
+global-symbols:
+ - name: _foo
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ desc: [ ]
+ value: 0
diff --git a/lld/test/darwin/Inputs/native-and-mach-o2.objtxt b/lld/test/darwin/Inputs/native-and-mach-o2.objtxt
new file mode 100644
index 00000000000..344c9bc0b0d
--- /dev/null
+++ b/lld/test/darwin/Inputs/native-and-mach-o2.objtxt
@@ -0,0 +1,19 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+flags: [ ]
+install-name: /usr/lib/libSystem.B.dylib
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
+ address: 0x0000000000000000
+ content: [ 0x55 ]
+
+global-symbols:
+ - name: dyld_stub_binder
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000000
diff --git a/lld/test/darwin/native-and-mach-o.objtxt b/lld/test/darwin/native-and-mach-o.objtxt
index 20f2d0b9620..1dee76d6d8c 100644
--- a/lld/test/darwin/native-and-mach-o.objtxt
+++ b/lld/test/darwin/native-and-mach-o.objtxt
@@ -1,4 +1,6 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t && \
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/native-and-mach-o.objtxt \
+# RUN: %p/Inputs/native-and-mach-o2.objtxt -o %t && \
# RUN: llvm-nm %t | FileCheck %s
#
# Test a mix of atoms and mach-o both encoded in yaml
@@ -19,46 +21,6 @@ defined-atoms:
undefined-atoms:
- name: _foo
-
---- !mach-o
-arch: x86_64
-file-type: MH_OBJECT
-sections:
- - segment: __TEXT
- section: __text
- type: S_REGULAR
- attributes: [ S_ATTR_PURE_INSTRUCTIONS ]
- address: 0
- content: [ 0xC3 ]
-global-symbols:
- - name: _foo
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- desc: [ ]
- value: 0
-
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-flags: [ ]
-install-name: /usr/lib/libSystem.B.dylib
-sections:
- - segment: __TEXT
- section: __text
- type: S_REGULAR
- attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
- address: 0x0000000000000000
- content: [ 0x55 ]
-
-global-symbols:
- - name: dyld_stub_binder
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- value: 0x0000000000000000
-
-
...
# CHECK: {{[0-9a-f]+}} T _foo
diff --git a/lld/test/elf/Inputs/allowduplicates.objtxt b/lld/test/elf/Inputs/allowduplicates.objtxt
new file mode 100644
index 00000000000..9b8ba8902ab
--- /dev/null
+++ b/lld/test/elf/Inputs/allowduplicates.objtxt
@@ -0,0 +1,12 @@
+defined-atoms:
+ - name: .text
+ alignment: 16
+ section-choice: custom-required
+ section-name: .text
+ - name: main
+ scope: global
+ content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00,
+ 00, C3 ]
+ alignment: 16
+ section-choice: custom-required
+ section-name: .text
diff --git a/lld/test/elf/allowduplicates.objtxt b/lld/test/elf/allowduplicates.objtxt
index f9f8624928d..15e5cdb95b9 100644
--- a/lld/test/elf/allowduplicates.objtxt
+++ b/lld/test/elf/allowduplicates.objtxt
@@ -1,10 +1,13 @@
# RUN: lld -flavor gnu -target x86_64 --allow-multiple-definition %s \
+# RUN: %p/Inputs/allowduplicates.objtxt \
# RUN: --output-filetype=yaml --noinhibit-exec | FileCheck %s
#
-# RUN: not lld -flavor gnu -target x86_64 %s --output-filetype=yaml \
+# RUN: not lld -flavor gnu -target x86_64 %s %p/Inputs/allowduplicates.objtxt \
+# RUN: --output-filetype=yaml \
# RUN: --noinhibit-exec 2>&1 | FileCheck -check-prefix=ERROR %s
#
# RUN: lld -flavor gnu -target x86_64 -z muldefs %s \
+# RUN: %p/Inputs/allowduplicates.objtxt \
# RUN: --noinhibit-exec --output-filetype=yaml | FileCheck %s
---
@@ -21,19 +24,6 @@ defined-atoms:
section-choice: custom-required
section-name: .text
---
-defined-atoms:
- - name: .text
- alignment: 16
- section-choice: custom-required
- section-name: .text
- - name: main
- scope: global
- content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00,
- 00, C3 ]
- alignment: 16
- section-choice: custom-required
- section-name: .text
----
# CHECK: defined-atoms:
# CHECK: - name: .text
diff --git a/lld/test/lit.cfg b/lld/test/lit.cfg
index 5b49765f789..a965c3fa21f 100644
--- a/lld/test/lit.cfg
+++ b/lld/test/lit.cfg
@@ -25,6 +25,11 @@ config.test_format = lit.formats.ShTest(execute_external)
# suffixes: A list of file extensions to treat as test files.
config.suffixes = ['.objtxt', '.test']
+# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
+# subdirectories contain auxiliary inputs for various tests in their parent
+# directories.
+config.excludes = ['Inputs']
+
# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)
diff --git a/lld/test/mach-o/Inputs/PIE.yaml b/lld/test/mach-o/Inputs/PIE.yaml
new file mode 100644
index 00000000000..0463154fcf2
--- /dev/null
+++ b/lld/test/mach-o/Inputs/PIE.yaml
@@ -0,0 +1,6 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+install-name: /usr/lib/libSystem.B.dylib
+exports:
+ - name: dyld_stub_binder
diff --git a/lld/test/mach-o/Inputs/arm-interworking.yaml b/lld/test/mach-o/Inputs/arm-interworking.yaml
new file mode 100644
index 00000000000..b2165a92814
--- /dev/null
+++ b/lld/test/mach-o/Inputs/arm-interworking.yaml
@@ -0,0 +1,83 @@
+--- !mach-o
+arch: armv7
+file-type: MH_OBJECT
+flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
+ alignment: 2
+ address: 0x0000000000000000
+ content: [ 0xFE, 0xFF, 0xFF, 0xEB, 0x02, 0x00, 0x00, 0xFA,
+ 0xFC, 0xFF, 0xFF, 0xEB, 0xFB, 0xFF, 0xFF, 0xFA,
+ 0x1E, 0xFF, 0x2F, 0xE1, 0x1E, 0xFF, 0x2F, 0xE1 ]
+ relocations:
+ - offset: 0x0000000C
+ type: ARM_RELOC_BR24
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 4
+ - offset: 0x00000008
+ type: ARM_RELOC_BR24
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 3
+ - offset: 0x00000004
+ type: ARM_RELOC_BR24
+ length: 2
+ pc-rel: true
+ extern: false
+ symbol: 1
+ - offset: 0x00000000
+ type: ARM_RELOC_BR24
+ length: 2
+ pc-rel: true
+ extern: false
+ symbol: 1
+ - segment: __DATA
+ section: __data
+ type: S_REGULAR
+ attributes: [ ]
+ address: 0x0000000000000018
+ content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
+ relocations:
+ - offset: 0x00000004
+ type: ARM_RELOC_VANILLA
+ length: 2
+ pc-rel: false
+ extern: false
+ symbol: 1
+ - offset: 0x00000000
+ type: ARM_RELOC_VANILLA
+ length: 2
+ pc-rel: false
+ extern: true
+ symbol: 3
+local-symbols:
+ - name: _d2
+ type: N_SECT
+ sect: 2
+ value: 0x0000000000000018
+global-symbols:
+ - name: _a1
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000000
+ - name: _a2
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000014
+undefined-symbols:
+ - name: _t1
+ type: N_UNDF
+ scope: [ N_EXT ]
+ value: 0x0000000000000000
+ - name: _t2
+ type: N_UNDF
+ scope: [ N_EXT ]
+ value: 0x0000000000000000
diff --git a/lld/test/mach-o/Inputs/arm-shims.yaml b/lld/test/mach-o/Inputs/arm-shims.yaml
new file mode 100644
index 00000000000..8baebef17d8
--- /dev/null
+++ b/lld/test/mach-o/Inputs/arm-shims.yaml
@@ -0,0 +1,60 @@
+--- !mach-o
+arch: armv7
+file-type: MH_OBJECT
+flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
+ alignment: 2
+ address: 0x0000000000000000
+ content: [ 0x00, 0xBF, 0xFF, 0xF7, 0xFE, 0xEF, 0xFF, 0xF7,
+ 0xFB, 0xBF, 0x00, 0x00, 0x00, 0xF0, 0x20, 0xE3,
+ 0xFA, 0xFF, 0xFF, 0xFA, 0xF9, 0xFF, 0xFF, 0xEA ]
+ relocations:
+ - offset: 0x00000014
+ type: ARM_RELOC_BR24
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 3
+ - offset: 0x00000010
+ type: ARM_RELOC_BR24
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 3
+ - offset: 0x00000006
+ type: ARM_THUMB_RELOC_BR22
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 2
+ - offset: 0x00000002
+ type: ARM_THUMB_RELOC_BR22
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 2
+global-symbols:
+ - name: _a2
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x000000000000000C
+ - name: _t2
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ desc: [ N_ARM_THUMB_DEF ]
+ value: 0x0000000000000000
+undefined-symbols:
+ - name: _a1
+ type: N_UNDF
+ scope: [ N_EXT ]
+ value: 0x0000000000000000
+ - name: _t1
+ type: N_UNDF
+ scope: [ N_EXT ]
+ value: 0x0000000000000000
diff --git a/lld/test/mach-o/Inputs/cstring-sections.yaml b/lld/test/mach-o/Inputs/cstring-sections.yaml
new file mode 100644
index 00000000000..eb227f29f8f
--- /dev/null
+++ b/lld/test/mach-o/Inputs/cstring-sections.yaml
@@ -0,0 +1,25 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_OBJECT
+flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
+has-UUID: false
+OS: unknown
+sections:
+ - segment: __TEXT
+ section: __objc_methname
+ type: S_CSTRING_LITERALS
+ attributes: [ ]
+ address: 0x0000000000000000
+ content: [ 0x61, 0x62, 0x63, 0x00 ]
+ - segment: __TEXT
+ section: __objc_classname
+ type: S_CSTRING_LITERALS
+ attributes: [ ]
+ address: 0x0000000000000006
+ content: [ 0x61, 0x62, 0x63, 0x00 ]
+ - segment: __TEXT
+ section: __cstring
+ type: S_CSTRING_LITERALS
+ attributes: [ ]
+ address: 0x000000000000000A
+ content: [ 0x61, 0x62, 0x63, 0x00 ]
diff --git a/lld/test/mach-o/Inputs/got-order.yaml b/lld/test/mach-o/Inputs/got-order.yaml
new file mode 100644
index 00000000000..6059a452834
--- /dev/null
+++ b/lld/test/mach-o/Inputs/got-order.yaml
@@ -0,0 +1,53 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_OBJECT
+flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
+ address: 0x0000000000000000
+ content: [ 0x55, 0x48, 0x89, 0xE5, 0x48, 0x8B, 0x0D, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8B, 0x05, 0x00, 0x00,
+ 0x00, 0x00, 0x8B, 0x00, 0x03, 0x01, 0x48, 0x8B,
+ 0x0D, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x5D,
+ 0xC3 ]
+ relocations:
+ - offset: 0x00000019
+ type: X86_64_RELOC_GOT_LOAD
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 2
+ - offset: 0x0000000E
+ type: X86_64_RELOC_GOT_LOAD
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 1
+ - offset: 0x00000007
+ type: X86_64_RELOC_GOT_LOAD
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 3
+global-symbols:
+ - name: _main
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000000
+undefined-symbols:
+ - name: _bar
+ type: N_UNDF
+ scope: [ N_EXT ]
+ value: 0x0000000000000000
+ - name: _foo
+ type: N_UNDF
+ scope: [ N_EXT ]
+ value: 0x0000000000000000
+ - name: _zazzle
+ type: N_UNDF
+ scope: [ N_EXT ]
+ value: 0x0000000000000000
diff --git a/lld/test/mach-o/Inputs/got-order2.yaml b/lld/test/mach-o/Inputs/got-order2.yaml
new file mode 100644
index 00000000000..faddeda924d
--- /dev/null
+++ b/lld/test/mach-o/Inputs/got-order2.yaml
@@ -0,0 +1,11 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+install-name: /usr/lib/libfoobar.dylib
+exports:
+ - name: _bar
+ - name: _zazzle
+ - name: _foo
+ - name: _aaa
+ - name: _fff
+ - name: _zzz
diff --git a/lld/test/mach-o/Inputs/hello-world-arm64.yaml b/lld/test/mach-o/Inputs/hello-world-arm64.yaml
new file mode 100644
index 00000000000..31de71ef494
--- /dev/null
+++ b/lld/test/mach-o/Inputs/hello-world-arm64.yaml
@@ -0,0 +1,8 @@
+--- !mach-o
+arch: arm64
+file-type: MH_DYLIB
+install-name: /usr/lib/libSystem.B.dylib
+exports:
+ - name: _fprintf
+ - name: ___stdoutp
+ - name: dyld_stub_binder
diff --git a/lld/test/mach-o/Inputs/hello-world-armv6.yaml b/lld/test/mach-o/Inputs/hello-world-armv6.yaml
new file mode 100644
index 00000000000..0b29f65ab12
--- /dev/null
+++ b/lld/test/mach-o/Inputs/hello-world-armv6.yaml
@@ -0,0 +1,7 @@
+--- !mach-o
+arch: armv6
+file-type: MH_DYLIB
+install-name: /usr/lib/libSystem.B.dylib
+exports:
+ - name: _printf
+ - name: dyld_stub_binder
diff --git a/lld/test/mach-o/Inputs/hello-world-armv7.yaml b/lld/test/mach-o/Inputs/hello-world-armv7.yaml
new file mode 100644
index 00000000000..4e26120fe21
--- /dev/null
+++ b/lld/test/mach-o/Inputs/hello-world-armv7.yaml
@@ -0,0 +1,7 @@
+--- !mach-o
+arch: armv7
+file-type: MH_DYLIB
+install-name: /usr/lib/libSystem.B.dylib
+exports:
+ - name: _printf
+ - name: dyld_stub_binder
diff --git a/lld/test/mach-o/Inputs/hello-world-x86.yaml b/lld/test/mach-o/Inputs/hello-world-x86.yaml
new file mode 100644
index 00000000000..dbec62b77f3
--- /dev/null
+++ b/lld/test/mach-o/Inputs/hello-world-x86.yaml
@@ -0,0 +1,7 @@
+--- !mach-o
+arch: x86
+file-type: MH_DYLIB
+install-name: /usr/lib/libSystem.B.dylib
+exports:
+ - name: _printf
+ - name: dyld_stub_binder
diff --git a/lld/test/mach-o/Inputs/hello-world-x86_64.yaml b/lld/test/mach-o/Inputs/hello-world-x86_64.yaml
new file mode 100644
index 00000000000..7840d5c1932
--- /dev/null
+++ b/lld/test/mach-o/Inputs/hello-world-x86_64.yaml
@@ -0,0 +1,8 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+install-name: /usr/lib/libSystem.B.dylib
+exports:
+ - name: _fprintf
+ - name: dyld_stub_binder
+ - name: ___stdoutp
diff --git a/lld/test/mach-o/Inputs/interposing-section.yaml b/lld/test/mach-o/Inputs/interposing-section.yaml
new file mode 100644
index 00000000000..45966b6870c
--- /dev/null
+++ b/lld/test/mach-o/Inputs/interposing-section.yaml
@@ -0,0 +1,6 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+install-name: /usr/lib/libSystem.B.dylib
+exports:
+ - name: _open
diff --git a/lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml b/lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml
new file mode 100644
index 00000000000..50a97bc9c09
--- /dev/null
+++ b/lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml
@@ -0,0 +1,8 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+install-name: /usr/lib/libfoo.dylib
+compat-version: 2.0
+current-version: 3.4
+exports:
+ - name: _foo
diff --git a/lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml b/lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml
new file mode 100644
index 00000000000..2f61cc0cda1
--- /dev/null
+++ b/lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml
@@ -0,0 +1,8 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+install-name: /usr/lib/libbaz.dylib
+compat-version: 3.0
+current-version: 4.5
+exports:
+ - name: _baz
diff --git a/lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml b/lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml
new file mode 100644
index 00000000000..7e6cd9007bf
--- /dev/null
+++ b/lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml
@@ -0,0 +1,8 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+install-name: /usr/lib/libbar.dylib
+compat-version: 1.0
+current-version: 2.3
+exports:
+ - name: _bar
diff --git a/lld/test/mach-o/Inputs/linker-as-ld.yaml b/lld/test/mach-o/Inputs/linker-as-ld.yaml
new file mode 100644
index 00000000000..0463154fcf2
--- /dev/null
+++ b/lld/test/mach-o/Inputs/linker-as-ld.yaml
@@ -0,0 +1,6 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+install-name: /usr/lib/libSystem.B.dylib
+exports:
+ - name: dyld_stub_binder
diff --git a/lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml b/lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml
new file mode 100644
index 00000000000..1941b407de2
--- /dev/null
+++ b/lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml
@@ -0,0 +1,21 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+flags: [ MH_TWOLEVEL ]
+install-name: /junk/libfoo.dylib
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
+ address: 0x0000000000000F9A
+ content: [ 0x55, 0x48, 0x89, 0xE5, 0x5D, 0xC3 ]
+global-symbols:
+ - name: _foo
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000F9A
+dependents:
+ - path: /junk/libbar.dylib
+ kind: LC_REEXPORT_DYLIB
diff --git a/lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml b/lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml
new file mode 100644
index 00000000000..5aaf8c1b1bc
--- /dev/null
+++ b/lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml
@@ -0,0 +1,18 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+flags: [ MH_TWOLEVEL ]
+install-name: /junk/libbar.dylib
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
+ address: 0x0000000000000F9A
+ content: [ 0x55, 0x48, 0x89, 0xE5, 0x5D, 0xC3 ]
+global-symbols:
+ - name: _bar
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000F9A
diff --git a/lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml b/lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml
new file mode 100644
index 00000000000..43ba07c73a7
--- /dev/null
+++ b/lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml
@@ -0,0 +1,19 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+flags: [ MH_TWOLEVEL ]
+install-name: /usr/lib/libSystem.B.dylib
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
+ address: 0x0000000000000000
+ content: [ 0x55 ]
+
+global-symbols:
+ - name: dyld_stub_binder
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000000
diff --git a/lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml b/lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml
new file mode 100644
index 00000000000..5f7ae50717b
--- /dev/null
+++ b/lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml
@@ -0,0 +1,13 @@
+--- !mach-o
+arch: arm64
+file-type: MH_DYLIB
+install-name: /usr/lib/libc++.dylib
+exports:
+ - name: __Unwind_Resume
+ - name: __ZTIl
+ - name: __ZTIi
+ - name: ___cxa_end_catch
+ - name: ___cxa_begin_catch
+ - name: ___cxa_allocate_exception
+ - name: ___cxa_throw
+ - name: ___gxx_personality_v0
diff --git a/lld/test/mach-o/Inputs/use-simple-dylib.yaml b/lld/test/mach-o/Inputs/use-simple-dylib.yaml
new file mode 100644
index 00000000000..9081bcf7693
--- /dev/null
+++ b/lld/test/mach-o/Inputs/use-simple-dylib.yaml
@@ -0,0 +1,58 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
+has-UUID: false
+OS: unknown
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
+ alignment: 4
+ address: 0x0000000000000000
+ content: [ 0xCC, 0xC3, 0x90, 0xC3, 0x90, 0x90, 0xC3, 0x90,
+ 0x90, 0x90, 0xC3, 0x90, 0x90, 0x90, 0x90, 0xC3,
+ 0x31, 0xC0, 0xC3 ]
+local-symbols:
+ - name: _myStatic
+ type: N_SECT
+ sect: 1
+ value: 0x000000000000000B
+ - name: _myVariablePreviouslyKnownAsPrivateExtern
+ type: N_SECT
+ scope: [ N_PEXT ]
+ sect: 1
+ desc: [ N_SYMBOL_RESOLVER ]
+ value: 0x0000000000000011
+global-symbols:
+ - name: _myGlobal
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000001
+ - name: _myGlobalWeak
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ desc: [ N_WEAK_DEF ]
+ value: 0x0000000000000002
+ - name: _myHidden
+ type: N_SECT
+ scope: [ N_EXT, N_PEXT ]
+ sect: 1
+ value: 0x0000000000000004
+ - name: _myHiddenWeak
+ type: N_SECT
+ scope: [ N_EXT, N_PEXT ]
+ sect: 1
+ desc: [ N_WEAK_DEF ]
+ value: 0x0000000000000007
+ - name: _myResolver
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ desc: [ N_SYMBOL_RESOLVER ]
+ value: 0x0000000000000010
+
+install-name: libspecial.dylib
diff --git a/lld/test/mach-o/Inputs/write-final-sections.yaml b/lld/test/mach-o/Inputs/write-final-sections.yaml
new file mode 100644
index 00000000000..ed434917f2c
--- /dev/null
+++ b/lld/test/mach-o/Inputs/write-final-sections.yaml
@@ -0,0 +1,20 @@
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+flags: [ ]
+install-name: /usr/lib/libSystem.B.dylib
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
+ address: 0x0000000000000000
+ content: [ 0x55 ]
+
+global-symbols:
+ - name: dyld_stub_binder
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000000
+
diff --git a/lld/test/mach-o/Inputs/wrong-arch-error.yaml b/lld/test/mach-o/Inputs/wrong-arch-error.yaml
new file mode 100644
index 00000000000..304c872375e
--- /dev/null
+++ b/lld/test/mach-o/Inputs/wrong-arch-error.yaml
@@ -0,0 +1,24 @@
+# RUN: not lld -flavor darwin -arch x86_64 -r %s 2> %t.err
+# RUN: FileCheck %s < %t.err
+
+--- !mach-o
+arch: x86
+file-type: MH_OBJECT
+flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
+has-UUID: false
+OS: unknown
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
+ alignment: 4
+ address: 0x0000000000000000
+ content: [ 0xC3 ]
+
+global-symbols:
+ - name: _bar
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000000
diff --git a/lld/test/mach-o/PIE.yaml b/lld/test/mach-o/PIE.yaml
index 2e50951a454..24f8773cbd2 100644
--- a/lld/test/mach-o/PIE.yaml
+++ b/lld/test/mach-o/PIE.yaml
@@ -1,10 +1,13 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t && \
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/PIE.yaml -o %t && \
# RUN: llvm-objdump -macho -private-headers %t | FileCheck %s
#
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -pie -o %t\
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/PIE.yaml -pie -o %t\
# RUN: && llvm-objdump -macho -private-headers %t | FileCheck %s
#
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -no_pie -o %t\
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/PIE.yaml -no_pie -o %t\
# RUN: && llvm-objdump -macho -private-headers %t \
# RUN: | FileCheck --check-prefix=CHECK_NO_PIE %s
#
@@ -31,13 +34,6 @@ global-symbols:
sect: 1
value: 0x0000000000000000
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: dyld_stub_binder
-
...
# CHECK: MH_MAGIC_64 {{[0-9a-zA-Z _]+}} TWOLEVEL PIE
diff --git a/lld/test/mach-o/arm-interworking.yaml b/lld/test/mach-o/arm-interworking.yaml
index f7e04e65c9f..c2883024b5b 100644
--- a/lld/test/mach-o/arm-interworking.yaml
+++ b/lld/test/mach-o/arm-interworking.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch armv7 -r -print_atoms %s -o %t | FileCheck %s \
+# RUN: lld -flavor darwin -arch armv7 -r -print_atoms %s \
+# RUN: %p/Inputs/arm-interworking.yaml -o %t | FileCheck %s \
# RUN: && lld -flavor darwin -arch armv7 -dylib -print_atoms \
# RUN: %p/Inputs/libSystem.yaml %t -o %t2 | FileCheck %s \
# RUN: && macho-dump --dump-section-data %t2 | FileCheck -check-prefix=CODE %s
@@ -126,89 +127,6 @@ undefined-symbols:
scope: [ N_EXT ]
value: 0x0000000000000000
---- !mach-o
-arch: armv7
-file-type: MH_OBJECT
-flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
-sections:
- - segment: __TEXT
- section: __text
- type: S_REGULAR
- attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
- alignment: 2
- address: 0x0000000000000000
- content: [ 0xFE, 0xFF, 0xFF, 0xEB, 0x02, 0x00, 0x00, 0xFA,
- 0xFC, 0xFF, 0xFF, 0xEB, 0xFB, 0xFF, 0xFF, 0xFA,
- 0x1E, 0xFF, 0x2F, 0xE1, 0x1E, 0xFF, 0x2F, 0xE1 ]
- relocations:
- - offset: 0x0000000C
- type: ARM_RELOC_BR24
- length: 2
- pc-rel: true
- extern: true
- symbol: 4
- - offset: 0x00000008
- type: ARM_RELOC_BR24
- length: 2
- pc-rel: true
- extern: true
- symbol: 3
- - offset: 0x00000004
- type: ARM_RELOC_BR24
- length: 2
- pc-rel: true
- extern: false
- symbol: 1
- - offset: 0x00000000
- type: ARM_RELOC_BR24
- length: 2
- pc-rel: true
- extern: false
- symbol: 1
- - segment: __DATA
- section: __data
- type: S_REGULAR
- attributes: [ ]
- address: 0x0000000000000018
- content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
- relocations:
- - offset: 0x00000004
- type: ARM_RELOC_VANILLA
- length: 2
- pc-rel: false
- extern: false
- symbol: 1
- - offset: 0x00000000
- type: ARM_RELOC_VANILLA
- length: 2
- pc-rel: false
- extern: true
- symbol: 3
-local-symbols:
- - name: _d2
- type: N_SECT
- sect: 2
- value: 0x0000000000000018
-global-symbols:
- - name: _a1
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- value: 0x0000000000000000
- - name: _a2
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- value: 0x0000000000000014
-undefined-symbols:
- - name: _t1
- type: N_UNDF
- scope: [ N_EXT ]
- value: 0x0000000000000000
- - name: _t2
- type: N_UNDF
- scope: [ N_EXT ]
- value: 0x0000000000000000
...
diff --git a/lld/test/mach-o/arm-shims.yaml b/lld/test/mach-o/arm-shims.yaml
index 68a401ca78e..f051474e764 100644
--- a/lld/test/mach-o/arm-shims.yaml
+++ b/lld/test/mach-o/arm-shims.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch armv7 %s -dylib %p/Inputs/libSystem.yaml -o %t
+# RUN: lld -flavor darwin -arch armv7 %s %p/Inputs/arm-shims.yaml \
+# RUN: -dylib %p/Inputs/libSystem.yaml -o %t
# RUN: macho-dump --dump-section-data %t | FileCheck %s
#
# Test b from arm to thumb or vice versa has shims added.s
@@ -66,68 +67,6 @@ undefined-symbols:
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !mach-o
-arch: armv7
-file-type: MH_OBJECT
-flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
-sections:
- - segment: __TEXT
- section: __text
- type: S_REGULAR
- attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
- alignment: 2
- address: 0x0000000000000000
- content: [ 0x00, 0xBF, 0xFF, 0xF7, 0xFE, 0xEF, 0xFF, 0xF7,
- 0xFB, 0xBF, 0x00, 0x00, 0x00, 0xF0, 0x20, 0xE3,
- 0xFA, 0xFF, 0xFF, 0xFA, 0xF9, 0xFF, 0xFF, 0xEA ]
- relocations:
- - offset: 0x00000014
- type: ARM_RELOC_BR24
- length: 2
- pc-rel: true
- extern: true
- symbol: 3
- - offset: 0x00000010
- type: ARM_RELOC_BR24
- length: 2
- pc-rel: true
- extern: true
- symbol: 3
- - offset: 0x00000006
- type: ARM_THUMB_RELOC_BR22
- length: 2
- pc-rel: true
- extern: true
- symbol: 2
- - offset: 0x00000002
- type: ARM_THUMB_RELOC_BR22
- length: 2
- pc-rel: true
- extern: true
- symbol: 2
-global-symbols:
- - name: _a2
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- value: 0x000000000000000C
- - name: _t2
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- desc: [ N_ARM_THUMB_DEF ]
- value: 0x0000000000000000
-undefined-symbols:
- - name: _a1
- type: N_UNDF
- scope: [ N_EXT ]
- value: 0x0000000000000000
- - name: _t1
- type: N_UNDF
- scope: [ N_EXT ]
- value: 0x0000000000000000
-
...
diff --git a/lld/test/mach-o/cstring-sections.yaml b/lld/test/mach-o/cstring-sections.yaml
index 940f048b5c6..433dffcf62d 100644
--- a/lld/test/mach-o/cstring-sections.yaml
+++ b/lld/test/mach-o/cstring-sections.yaml
@@ -27,32 +27,6 @@ sections:
address: 0x000000000000000A
content: [ 0x61, 0x62, 0x63, 0x00, 0x6A, 0x6B, 0x6C, 0x00 ]
---- !mach-o
-arch: x86_64
-file-type: MH_OBJECT
-flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
-has-UUID: false
-OS: unknown
-sections:
- - segment: __TEXT
- section: __objc_methname
- type: S_CSTRING_LITERALS
- attributes: [ ]
- address: 0x0000000000000000
- content: [ 0x61, 0x62, 0x63, 0x00 ]
- - segment: __TEXT
- section: __objc_classname
- type: S_CSTRING_LITERALS
- attributes: [ ]
- address: 0x0000000000000006
- content: [ 0x61, 0x62, 0x63, 0x00 ]
- - segment: __TEXT
- section: __cstring
- type: S_CSTRING_LITERALS
- attributes: [ ]
- address: 0x000000000000000A
- content: [ 0x61, 0x62, 0x63, 0x00 ]
-
...
diff --git a/lld/test/mach-o/got-order.yaml b/lld/test/mach-o/got-order.yaml
index fbbc4e0397f..fcaa61cbc23 100644
--- a/lld/test/mach-o/got-order.yaml
+++ b/lld/test/mach-o/got-order.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -o %t %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/got-order.yaml \
+# RUN: %p/Inputs/got-order2.yaml -o %t %p/Inputs/libSystem.yaml
# RUN: llvm-objdump -bind %t | FileCheck %s
#
# Test that GOT slots are sorted by name
@@ -57,72 +58,6 @@ undefined-symbols:
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !mach-o
-arch: x86_64
-file-type: MH_OBJECT
-flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
-sections:
- - segment: __TEXT
- section: __text
- type: S_REGULAR
- attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
- address: 0x0000000000000000
- content: [ 0x55, 0x48, 0x89, 0xE5, 0x48, 0x8B, 0x0D, 0x00,
- 0x00, 0x00, 0x00, 0x48, 0x8B, 0x05, 0x00, 0x00,
- 0x00, 0x00, 0x8B, 0x00, 0x03, 0x01, 0x48, 0x8B,
- 0x0D, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x5D,
- 0xC3 ]
- relocations:
- - offset: 0x00000019
- type: X86_64_RELOC_GOT_LOAD
- length: 2
- pc-rel: true
- extern: true
- symbol: 2
- - offset: 0x0000000E
- type: X86_64_RELOC_GOT_LOAD
- length: 2
- pc-rel: true
- extern: true
- symbol: 1
- - offset: 0x00000007
- type: X86_64_RELOC_GOT_LOAD
- length: 2
- pc-rel: true
- extern: true
- symbol: 3
-global-symbols:
- - name: _main
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- value: 0x0000000000000000
-undefined-symbols:
- - name: _bar
- type: N_UNDF
- scope: [ N_EXT ]
- value: 0x0000000000000000
- - name: _foo
- type: N_UNDF
- scope: [ N_EXT ]
- value: 0x0000000000000000
- - name: _zazzle
- type: N_UNDF
- scope: [ N_EXT ]
- value: 0x0000000000000000
-
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-install-name: /usr/lib/libfoobar.dylib
-exports:
- - name: _bar
- - name: _zazzle
- - name: _foo
- - name: _aaa
- - name: _fff
- - name: _zzz
...
diff --git a/lld/test/mach-o/hello-world-arm64.yaml b/lld/test/mach-o/hello-world-arm64.yaml
index a0555e9cc42..a05940a6710 100644
--- a/lld/test/mach-o/hello-world-arm64.yaml
+++ b/lld/test/mach-o/hello-world-arm64.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch arm64 %s -o %t
+# RUN: lld -flavor darwin -arch arm64 %s %p/Inputs/hello-world-arm64.yaml -o %t
# RUN: llvm-nm -m -n %t | FileCheck %s
#
# Test that arm64 hello-world can be linked into a mach-o executable
@@ -88,16 +88,6 @@ undefined-symbols:
value: 0x0000000000000000
...
---- !mach-o
-arch: arm64
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: _fprintf
- - name: ___stdoutp
- - name: dyld_stub_binder
-...
-
# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main
# CHECK: (undefined) external ___stdoutp (from libSystem)
# CHECK: (undefined) external _fprintf (from libSystem)
diff --git a/lld/test/mach-o/hello-world-armv6.yaml b/lld/test/mach-o/hello-world-armv6.yaml
index 746ee094da6..8a9edeeddba 100644
--- a/lld/test/mach-o/hello-world-armv6.yaml
+++ b/lld/test/mach-o/hello-world-armv6.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch armv6 %s -o %t
+# RUN: lld -flavor darwin -arch armv6 %s %p/Inputs/hello-world-armv6.yaml -o %t
# RUN: llvm-nm -m %t | FileCheck %s
#
# Test that armv6 (arm) hello-world can be linked into a mach-o executable
@@ -57,14 +57,6 @@ undefined-symbols:
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !mach-o
-arch: armv6
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: _printf
- - name: dyld_stub_binder
...
# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main
diff --git a/lld/test/mach-o/hello-world-armv7.yaml b/lld/test/mach-o/hello-world-armv7.yaml
index bfc03c382a0..d53d37638dc 100644
--- a/lld/test/mach-o/hello-world-armv7.yaml
+++ b/lld/test/mach-o/hello-world-armv7.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch armv7 %s -o %t
+# RUN: lld -flavor darwin -arch armv7 %s %p/Inputs/hello-world-armv7.yaml -o %t
# RUN: llvm-nm -m -n %t | FileCheck %s
#
# Test that armv7 (thumb) hello-world can be linked into a mach-o executable
@@ -71,15 +71,6 @@ undefined-symbols:
value: 0x0000000000000000
...
---- !mach-o
-arch: armv7
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: _printf
- - name: dyld_stub_binder
-...
-
# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external [Thumb] _main
# CHECK: (undefined) external _printf (from libSystem)
# CHECK: (undefined) external dyld_stub_binder (from libSystem)
diff --git a/lld/test/mach-o/hello-world-x86.yaml b/lld/test/mach-o/hello-world-x86.yaml
index de453ed1ac4..27f3511addc 100644
--- a/lld/test/mach-o/hello-world-x86.yaml
+++ b/lld/test/mach-o/hello-world-x86.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch i386 %s -o %t
+# RUN: lld -flavor darwin -arch i386 %s %p/Inputs/hello-world-x86.yaml -o %t
# RUN: llvm-nm -m %t | FileCheck %s
#
# Test that i386 hello-world can be linked into a mach-o executable
@@ -55,15 +55,6 @@ undefined-symbols:
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !mach-o
-arch: x86
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: _printf
- - name: dyld_stub_binder
-
...
# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main
diff --git a/lld/test/mach-o/hello-world-x86_64.yaml b/lld/test/mach-o/hello-world-x86_64.yaml
index 83d4fcb3260..eba31867b26 100644
--- a/lld/test/mach-o/hello-world-x86_64.yaml
+++ b/lld/test/mach-o/hello-world-x86_64.yaml
@@ -1,7 +1,9 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -o %t
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/hello-world-x86_64.yaml \
+# RUN: -o %t
# RUN: llvm-nm -m -n %t | FileCheck %s
#
-# RUN: lld -flavor darwin -arch x86_64 %s -dead_strip -o %t2
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/hello-world-x86_64.yaml \
+# RUN: -dead_strip -o %t2
# RUN: llvm-nm -m -n %t2 | FileCheck %s
#
# Test that x86_64 hello-world can be linked into a mach-o executable
@@ -109,15 +111,6 @@ undefined-symbols:
scope: [ N_EXT ]
value: 0x0000000000000000
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: _fprintf
- - name: dyld_stub_binder
- - name: ___stdoutp
-
...
# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main
diff --git a/lld/test/mach-o/interposing-section.yaml b/lld/test/mach-o/interposing-section.yaml
index 856d4b91f3d..2ac28f03795 100644
--- a/lld/test/mach-o/interposing-section.yaml
+++ b/lld/test/mach-o/interposing-section.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -dylib -o %t %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/interposing-section.yaml \
+# RUN: -dylib -o %t %p/Inputs/libSystem.yaml
# RUN: llvm-objdump -private-headers %t | FileCheck %s
#
# RUN: lld -flavor darwin -arch x86_64 %s -r -o %t1
@@ -62,14 +63,6 @@ undefined-symbols:
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: _open
-
...
diff --git a/lld/test/mach-o/lazy-bind-x86_64.yaml b/lld/test/mach-o/lazy-bind-x86_64.yaml
index 54d787ce91b..1b4699feed3 100644
--- a/lld/test/mach-o/lazy-bind-x86_64.yaml
+++ b/lld/test/mach-o/lazy-bind-x86_64.yaml
@@ -1,6 +1,8 @@
# REQUIRES: x86
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t \
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/lazy-bind-x86_64.yaml %p/Inputs/lazy-bind-x86_64-2.yaml \
+# RUN: %p/Inputs/lazy-bind-x86_64-3.yaml -o %t \
# RUN: %p/Inputs/libSystem.yaml
# RUN: llvm-objdump -lazy-bind %t | FileCheck %s
# RUN: llvm-nm -m %t | FileCheck --check-prefix=CHECK-NM %s
@@ -63,33 +65,6 @@ undefined-symbols:
scope: [ N_EXT ]
value: 0x0000000000000000
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-install-name: /usr/lib/libbar.dylib
-compat-version: 1.0
-current-version: 2.3
-exports:
- - name: _bar
-
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-install-name: /usr/lib/libfoo.dylib
-compat-version: 2.0
-current-version: 3.4
-exports:
- - name: _foo
-
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-install-name: /usr/lib/libbaz.dylib
-compat-version: 3.0
-current-version: 4.5
-exports:
- - name: _baz
-
...
diff --git a/lld/test/mach-o/linker-as-ld.yaml b/lld/test/mach-o/linker-as-ld.yaml
index 2dd1f79818e..f0bf189876a 100644
--- a/lld/test/mach-o/linker-as-ld.yaml
+++ b/lld/test/mach-o/linker-as-ld.yaml
@@ -1,7 +1,8 @@
# REQUIRES: system-linker-mach-o
#
# RUN: mkdir -p %t.dir && cp `which lld` %t.dir/ld \
-# RUN: && %t.dir/ld -arch x86_64 -macosx_version_min 10.8 %s -o %t \
+# RUN: && %t.dir/ld -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/linker-as-ld.yaml -o %t \
# RUN: && llvm-nm %t | FileCheck %s
#
# Test linker run as "ld" on darwin works as darwin linker.
@@ -26,14 +27,6 @@ global-symbols:
scope: [ N_EXT ]
sect: 1
value: 0x0000000000000000
-
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: dyld_stub_binder
-
...
# CHECK: T _main
diff --git a/lld/test/mach-o/re-exported-dylib-ordinal.yaml b/lld/test/mach-o/re-exported-dylib-ordinal.yaml
index 9d628e9af15..ff4d756338c 100644
--- a/lld/test/mach-o/re-exported-dylib-ordinal.yaml
+++ b/lld/test/mach-o/re-exported-dylib-ordinal.yaml
@@ -1,4 +1,7 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -dylib -o %t \
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/re-exported-dylib-ordinal.yaml \
+# RUN: %p/Inputs/re-exported-dylib-ordinal2.yaml \
+# RUN: %p/Inputs/re-exported-dylib-ordinal3.yaml -dylib -o %t \
# RUN: && llvm-nm -m %t | FileCheck %s
#
# Test that when one dylib A re-exports dylib B that using a symbol from B
@@ -37,68 +40,6 @@ undefined-symbols:
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-flags: [ MH_TWOLEVEL ]
-install-name: /junk/libfoo.dylib
-sections:
- - segment: __TEXT
- section: __text
- type: S_REGULAR
- attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
- address: 0x0000000000000F9A
- content: [ 0x55, 0x48, 0x89, 0xE5, 0x5D, 0xC3 ]
-global-symbols:
- - name: _foo
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- value: 0x0000000000000F9A
-dependents:
- - path: /junk/libbar.dylib
- kind: LC_REEXPORT_DYLIB
-
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-flags: [ MH_TWOLEVEL ]
-install-name: /junk/libbar.dylib
-sections:
- - segment: __TEXT
- section: __text
- type: S_REGULAR
- attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
- address: 0x0000000000000F9A
- content: [ 0x55, 0x48, 0x89, 0xE5, 0x5D, 0xC3 ]
-global-symbols:
- - name: _bar
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- value: 0x0000000000000F9A
-
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-flags: [ MH_TWOLEVEL ]
-install-name: /usr/lib/libSystem.B.dylib
-sections:
- - segment: __TEXT
- section: __text
- type: S_REGULAR
- attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
- address: 0x0000000000000000
- content: [ 0x55 ]
-
-global-symbols:
- - name: dyld_stub_binder
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- value: 0x0000000000000000
-
...
# CHECK: (undefined) external _bar (from libfoo)
diff --git a/lld/test/mach-o/unwind-info-simple-arm64.yaml b/lld/test/mach-o/unwind-info-simple-arm64.yaml
index d46b43ff712..0e85401b16a 100644
--- a/lld/test/mach-o/unwind-info-simple-arm64.yaml
+++ b/lld/test/mach-o/unwind-info-simple-arm64.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch arm64 %s -o %t -e _main %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch arm64 -o %t %s \
+# RUN: %p/Inputs/unwind-info-simple-arm64.yaml -e _main %p/Inputs/libSystem.yaml
# RUN: llvm-objdump -unwind-info %t | FileCheck %s
--- !mach-o
@@ -236,20 +237,6 @@ undefined-symbols:
scope: [ N_EXT ]
value: 0x0000000000000000
---- !mach-o
-arch: arm64
-file-type: MH_DYLIB
-install-name: /usr/lib/libc++.dylib
-exports:
- - name: __Unwind_Resume
- - name: __ZTIl
- - name: __ZTIi
- - name: ___cxa_end_catch
- - name: ___cxa_begin_catch
- - name: ___cxa_allocate_exception
- - name: ___cxa_throw
- - name: ___gxx_personality_v0
-
...
diff --git a/lld/test/mach-o/use-simple-dylib.yaml b/lld/test/mach-o/use-simple-dylib.yaml
index 0da7d1b0bd0..658be16356e 100644
--- a/lld/test/mach-o/use-simple-dylib.yaml
+++ b/lld/test/mach-o/use-simple-dylib.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch x86_64 -print_atoms -r %s -o %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 -print_atoms -r %s \
+# RUN: %p/Inputs/use-simple-dylib.yaml -o %t | FileCheck %s
--- !mach-o
@@ -53,65 +54,6 @@ undefined-symbols:
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
-has-UUID: false
-OS: unknown
-sections:
- - segment: __TEXT
- section: __text
- type: S_REGULAR
- attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
- alignment: 4
- address: 0x0000000000000000
- content: [ 0xCC, 0xC3, 0x90, 0xC3, 0x90, 0x90, 0xC3, 0x90,
- 0x90, 0x90, 0xC3, 0x90, 0x90, 0x90, 0x90, 0xC3,
- 0x31, 0xC0, 0xC3 ]
-local-symbols:
- - name: _myStatic
- type: N_SECT
- sect: 1
- value: 0x000000000000000B
- - name: _myVariablePreviouslyKnownAsPrivateExtern
- type: N_SECT
- scope: [ N_PEXT ]
- sect: 1
- desc: [ N_SYMBOL_RESOLVER ]
- value: 0x0000000000000011
-global-symbols:
- - name: _myGlobal
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- value: 0x0000000000000001
- - name: _myGlobalWeak
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- desc: [ N_WEAK_DEF ]
- value: 0x0000000000000002
- - name: _myHidden
- type: N_SECT
- scope: [ N_EXT, N_PEXT ]
- sect: 1
- value: 0x0000000000000004
- - name: _myHiddenWeak
- type: N_SECT
- scope: [ N_EXT, N_PEXT ]
- sect: 1
- desc: [ N_WEAK_DEF ]
- value: 0x0000000000000007
- - name: _myResolver
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- desc: [ N_SYMBOL_RESOLVER ]
- value: 0x0000000000000010
-
-install-name: libspecial.dylib
...
diff --git a/lld/test/mach-o/write-final-sections.yaml b/lld/test/mach-o/write-final-sections.yaml
index 7d4afb31900..7403cac1d3d 100644
--- a/lld/test/mach-o/write-final-sections.yaml
+++ b/lld/test/mach-o/write-final-sections.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -o %t -e _foo
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/write-final-sections.yaml \
+# RUN: -o %t -e _foo
# RUN: llvm-readobj -sections -section-data %t | FileCheck %s
--- !native
@@ -143,25 +144,3 @@ defined-atoms:
- type: compact-unwind
content: [ 0E, 00, 00, 00, 00, 00, 00, 00 ]
# CHECK-NOT: Name: __compact_unwind
-
-
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-flags: [ ]
-install-name: /usr/lib/libSystem.B.dylib
-sections:
- - segment: __TEXT
- section: __text
- type: S_REGULAR
- attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
- address: 0x0000000000000000
- content: [ 0x55 ]
-
-global-symbols:
- - name: dyld_stub_binder
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- value: 0x0000000000000000
-
diff --git a/lld/test/mach-o/wrong-arch-error.yaml b/lld/test/mach-o/wrong-arch-error.yaml
index 6d233798a7b..3b8ef0dc7ee 100644
--- a/lld/test/mach-o/wrong-arch-error.yaml
+++ b/lld/test/mach-o/wrong-arch-error.yaml
@@ -1,4 +1,5 @@
-# RUN: not lld -flavor darwin -arch x86_64 -r %s 2> %t.err
+# RUN: not lld -flavor darwin -arch x86_64 -r %s \
+# RUN: %p/Inputs/wrong-arch-error.yaml 2> %t.err
# RUN: FileCheck %s < %t.err
--- !mach-o
@@ -21,28 +22,6 @@ global-symbols:
scope: [ N_EXT ]
sect: 1
value: 0x0000000000000000
-
---- !mach-o
-arch: x86
-file-type: MH_OBJECT
-flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
-has-UUID: false
-OS: unknown
-sections:
- - segment: __TEXT
- section: __text
- type: S_REGULAR
- attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
- alignment: 4
- address: 0x0000000000000000
- content: [ 0xC3 ]
-
-global-symbols:
- - name: _bar
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- value: 0x0000000000000000
...
OpenPOWER on IntegriCloud