mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-29 08:31:13 +00:00
Delete unnecessary generality in loadFile.
loadFile could load mulitple files just because yaml has a feature for putting multiple documents in one file. Designing a linker around what yaml can do seems like a bad idea to me. This patch changes it to read a single file. There are further improvements to be done to the api and they will follow shortly. llvm-svn: 235724
This commit is contained in:
parent
af9fdb9dcf
commit
c08ab8e6e4
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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())) {
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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 ®,
|
||||
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 {
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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 ®istry,
|
||||
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 ®istry,
|
||||
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 ®istry,
|
||||
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 ®istry,
|
||||
std::unique_ptr<File> &result) const override {
|
||||
result = llvm::make_unique<MachODylibFile>(std::move(mb), &_ctx);
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
21
lld/test/core/Inputs/archive-basic.objtxt
Normal file
21
lld/test/core/Inputs/archive-basic.objtxt
Normal file
@ -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
|
24
lld/test/core/Inputs/archive-chain.objtxt
Normal file
24
lld/test/core/Inputs/archive-chain.objtxt
Normal file
@ -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
|
21
lld/test/core/Inputs/archive-chain2.objtxt
Normal file
21
lld/test/core/Inputs/archive-chain2.objtxt
Normal file
@ -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
|
11
lld/test/core/Inputs/archive-tentdef-search.objtxt
Normal file
11
lld/test/core/Inputs/archive-tentdef-search.objtxt
Normal file
@ -0,0 +1,11 @@
|
||||
--- !archive
|
||||
members:
|
||||
- name: bar.o
|
||||
content: !native
|
||||
defined-atoms:
|
||||
- name: bar
|
||||
scope: global
|
||||
type: data
|
||||
|
||||
- name: bar2
|
||||
type: data
|
8
lld/test/core/Inputs/associates.objtxt
Normal file
8
lld/test/core/Inputs/associates.objtxt
Normal file
@ -0,0 +1,8 @@
|
||||
defined-atoms:
|
||||
- name: f1
|
||||
merge: as-weak
|
||||
scope: global
|
||||
references:
|
||||
- kind: associate
|
||||
target: f2
|
||||
- name: f2
|
20
lld/test/core/Inputs/auto-hide-coalesce.objtxt
Normal file
20
lld/test/core/Inputs/auto-hide-coalesce.objtxt
Normal file
@ -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
|
4
lld/test/core/Inputs/code-model-attributes.objtxt
Normal file
4
lld/test/core/Inputs/code-model-attributes.objtxt
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _none
|
||||
code-model: none
|
4
lld/test/core/Inputs/code-model-attributes2.objtxt
Normal file
4
lld/test/core/Inputs/code-model-attributes2.objtxt
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _mips_pic
|
||||
code-model: mips-pic
|
4
lld/test/core/Inputs/code-model-attributes3.objtxt
Normal file
4
lld/test/core/Inputs/code-model-attributes3.objtxt
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _mips_micro
|
||||
code-model: mips-micro
|
4
lld/test/core/Inputs/code-model-attributes4.objtxt
Normal file
4
lld/test/core/Inputs/code-model-attributes4.objtxt
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _mips_micro_pic
|
||||
code-model: mips-micro-pic
|
4
lld/test/core/Inputs/code-model-attributes5.objtxt
Normal file
4
lld/test/core/Inputs/code-model-attributes5.objtxt
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _mips_16
|
||||
code-model: mips-16
|
9
lld/test/core/Inputs/constants-coalesce.objtxt
Normal file
9
lld/test/core/Inputs/constants-coalesce.objtxt
Normal file
@ -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 ]
|
10
lld/test/core/Inputs/constants-coalesce2.objtxt
Normal file
10
lld/test/core/Inputs/constants-coalesce2.objtxt
Normal file
@ -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 ]
|
6
lld/test/core/Inputs/cstring-coalesce.objtxt
Normal file
6
lld/test/core/Inputs/cstring-coalesce.objtxt
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- ref-name: L2
|
||||
type: c-string
|
||||
merge: by-content
|
||||
content: [ 68, 65, 6c, 6c, 6f, 00 ]
|
6
lld/test/core/Inputs/cstring-coalesce2.objtxt
Normal file
6
lld/test/core/Inputs/cstring-coalesce2.objtxt
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- ref-name: L2
|
||||
type: c-string
|
||||
merge: by-content
|
||||
content: [ 74, 68, 65, 72, 65, 00 ]
|
15
lld/test/core/Inputs/custom-section-coalesce.objtxt
Normal file
15
lld/test/core/Inputs/custom-section-coalesce.objtxt
Normal file
@ -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
|
13
lld/test/core/Inputs/custom-section-coalesce2.objtxt
Normal file
13
lld/test/core/Inputs/custom-section-coalesce2.objtxt
Normal file
@ -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 ]
|
4
lld/test/core/Inputs/dead-strip-attributes.objtxt
Normal file
4
lld/test/core/Inputs/dead-strip-attributes.objtxt
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _foo2
|
||||
dead-strip: never
|
4
lld/test/core/Inputs/dead-strip-attributes2.objtxt
Normal file
4
lld/test/core/Inputs/dead-strip-attributes2.objtxt
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _foo3
|
||||
dead-strip: always
|
9
lld/test/core/Inputs/dead-strip-basic.objtxt
Normal file
9
lld/test/core/Inputs/dead-strip-basic.objtxt
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: mydead2
|
||||
scope: global
|
||||
type: data
|
||||
|
||||
- name: bar
|
||||
scope: global
|
||||
type: data
|
8
lld/test/core/Inputs/dead-strip-basic2.objtxt
Normal file
8
lld/test/core/Inputs/dead-strip-basic2.objtxt
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: baz
|
||||
scope: global
|
||||
type: code
|
||||
|
||||
- name: mydead3
|
||||
type: code
|
9
lld/test/core/Inputs/dead-strip-globals.objtxt
Normal file
9
lld/test/core/Inputs/dead-strip-globals.objtxt
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: myglobal2
|
||||
scope: global
|
||||
type: data
|
||||
|
||||
- name: bar
|
||||
scope: hidden
|
||||
type: data
|
8
lld/test/core/Inputs/dead-strip-globals2.objtxt
Normal file
8
lld/test/core/Inputs/dead-strip-globals2.objtxt
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: baz
|
||||
scope: hidden
|
||||
type: code
|
||||
|
||||
- name: mydead
|
||||
type: code
|
5
lld/test/core/Inputs/error-duplicate-absolutes.objtxt
Normal file
5
lld/test/core/Inputs/error-duplicate-absolutes.objtxt
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
absolute-atoms:
|
||||
- name: absatom
|
||||
value: 0
|
||||
scope: global
|
26
lld/test/core/Inputs/gnulinkonce-rearrange-resolve.objtxt
Normal file
26
lld/test/core/Inputs/gnulinkonce-rearrange-resolve.objtxt
Normal file
@ -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
|
34
lld/test/core/Inputs/gnulinkonce-remaining-undef.objtxt
Normal file
34
lld/test/core/Inputs/gnulinkonce-remaining-undef.objtxt
Normal file
@ -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
|
4
lld/test/core/Inputs/gnulinkonce-remaining-undef2.objtxt
Normal file
4
lld/test/core/Inputs/gnulinkonce-remaining-undef2.objtxt
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
undefined-atoms:
|
||||
- name: f3
|
||||
can-be-null: never
|
25
lld/test/core/Inputs/gnulinkonce-resolve.objtxt
Normal file
25
lld/test/core/Inputs/gnulinkonce-resolve.objtxt
Normal file
@ -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
|
4
lld/test/core/Inputs/gnulinkonce-simple.objtxt
Normal file
4
lld/test/core/Inputs/gnulinkonce-simple.objtxt
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
undefined-atoms:
|
||||
- name: f1
|
||||
can-be-null: never
|
6
lld/test/core/Inputs/inline-coalesce.objtxt
Normal file
6
lld/test/core/Inputs/inline-coalesce.objtxt
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _inlineFunc
|
||||
scope: global
|
||||
type: code
|
||||
merge: as-weak
|
6
lld/test/core/Inputs/inline-coalesce2.objtxt
Normal file
6
lld/test/core/Inputs/inline-coalesce2.objtxt
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _inlineFunc
|
||||
scope: global
|
||||
type: code
|
||||
merge: as-weak
|
5
lld/test/core/Inputs/multiple-def-error.objtxt
Normal file
5
lld/test/core/Inputs/multiple-def-error.objtxt
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _foo
|
||||
scope: global
|
||||
type: data
|
3
lld/test/core/Inputs/sectiongroup-deadstrip.objtxt
Normal file
3
lld/test/core/Inputs/sectiongroup-deadstrip.objtxt
Normal file
@ -0,0 +1,3 @@
|
||||
undefined-atoms:
|
||||
- name: f1
|
||||
can-be-null: never
|
26
lld/test/core/Inputs/sectiongroup-gnulinkonce-error.objtxt
Normal file
26
lld/test/core/Inputs/sectiongroup-gnulinkonce-error.objtxt
Normal file
@ -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
|
25
lld/test/core/Inputs/sectiongroup-rearrange-resolve.objtxt
Normal file
25
lld/test/core/Inputs/sectiongroup-rearrange-resolve.objtxt
Normal file
@ -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
|
34
lld/test/core/Inputs/sectiongroup-remaining-undef.objtxt
Normal file
34
lld/test/core/Inputs/sectiongroup-remaining-undef.objtxt
Normal file
@ -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
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
undefined-atoms:
|
||||
- name: f3
|
||||
can-be-null: never
|
26
lld/test/core/Inputs/sectiongroup-resolve.objtxt
Normal file
26
lld/test/core/Inputs/sectiongroup-resolve.objtxt
Normal file
@ -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
|
4
lld/test/core/Inputs/sectiongroup-simple.objtxt
Normal file
4
lld/test/core/Inputs/sectiongroup-simple.objtxt
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
undefined-atoms:
|
||||
- name: f1
|
||||
can-be-null: never
|
28
lld/test/core/Inputs/shared-library-coalesce.objtxt
Normal file
28
lld/test/core/Inputs/shared-library-coalesce.objtxt
Normal file
@ -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
|
6
lld/test/core/Inputs/tent-merge.objtxt
Normal file
6
lld/test/core/Inputs/tent-merge.objtxt
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _foo
|
||||
scope: global
|
||||
type: data
|
||||
content: [ 00, 00, 00, 00 ]
|
8
lld/test/core/Inputs/undef-coalesce-error.objtxt
Normal file
8
lld/test/core/Inputs/undef-coalesce-error.objtxt
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: bar
|
||||
type: code
|
||||
|
||||
undefined-atoms:
|
||||
- name: malloc
|
||||
- name: myfunc
|
8
lld/test/core/Inputs/undef-coalesce-error2.objtxt
Normal file
8
lld/test/core/Inputs/undef-coalesce-error2.objtxt
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: myfunc
|
||||
scope: global
|
||||
type: code
|
||||
|
||||
undefined-atoms:
|
||||
- name: free
|
8
lld/test/core/Inputs/undef-coalesce.objtxt
Normal file
8
lld/test/core/Inputs/undef-coalesce.objtxt
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: bar
|
||||
type: code
|
||||
|
||||
undefined-atoms:
|
||||
- name: malloc
|
||||
- name: myfunc
|
8
lld/test/core/Inputs/undef-coalesce2.objtxt
Normal file
8
lld/test/core/Inputs/undef-coalesce2.objtxt
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: myfunc
|
||||
scope: global
|
||||
type: code
|
||||
|
||||
undefined-atoms:
|
||||
- name: free
|
7
lld/test/core/Inputs/undef-fallback.objtxt
Normal file
7
lld/test/core/Inputs/undef-fallback.objtxt
Normal file
@ -0,0 +1,7 @@
|
||||
defined-atoms:
|
||||
- name: fallback1
|
||||
|
||||
undefined-atoms:
|
||||
- name: def1
|
||||
fallback:
|
||||
name: fallback3
|
20
lld/test/core/Inputs/undef-weak-coalesce.objtxt
Normal file
20
lld/test/core/Inputs/undef-weak-coalesce.objtxt
Normal file
@ -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
|
5
lld/test/core/Inputs/weak-coalesce.objtxt
Normal file
5
lld/test/core/Inputs/weak-coalesce.objtxt
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _foo
|
||||
scope: global
|
||||
type: data
|
6
lld/test/core/Inputs/weak-coalesce2.objtxt
Normal file
6
lld/test/core/Inputs/weak-coalesce2.objtxt
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _foo
|
||||
merge: as-weak
|
||||
scope: global
|
||||
type: data
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,14 +1,5 @@
|
||||
# RUN: lld -core %s | FileCheck %s
|
||||
# RUN: lld -core %s %p/Inputs/associates.objtxt | FileCheck %s
|
||||
|
||||
---
|
||||
defined-atoms:
|
||||
- name: f1
|
||||
merge: as-weak
|
||||
scope: global
|
||||
references:
|
||||
- kind: associate
|
||||
target: f2
|
||||
- name: f2
|
||||
---
|
||||
defined-atoms:
|
||||
- name: f1
|
||||
|
@ -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
|
||||
@ -21,27 +21,6 @@ defined-atoms:
|
||||
type: code
|
||||
merge: as-addressed-weak
|
||||
|
||||
- name: _inlineFunc4
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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 ]
|
||||
...
|
||||
|
||||
|
||||
|
@ -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
|
||||
...
|
||||
|
||||
|
||||
|
@ -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
|
||||
...
|
||||
|
||||
|
||||
|
@ -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
|
||||
...
|
||||
|
||||
|
||||
|
@ -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
|
||||
...
|
||||
|
||||
|
||||
|
@ -1,36 +1,10 @@
|
||||
# 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
|
||||
# resolution
|
||||
#
|
||||
|
||||
---
|
||||
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
|
||||
---
|
||||
defined-atoms:
|
||||
- name: g1
|
||||
|
@ -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
|
||||
|
@ -1,36 +1,10 @@
|
||||
# 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
|
||||
# resolution
|
||||
#
|
||||
|
||||
---
|
||||
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
|
||||
---
|
||||
defined-atoms:
|
||||
- name: f1
|
||||
|
@ -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:
|
||||
|
@ -1,21 +1,9 @@
|
||||
# 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
|
||||
#
|
||||
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _inlineFunc
|
||||
scope: global
|
||||
type: code
|
||||
merge: as-weak
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _inlineFunc
|
||||
scope: global
|
||||
type: code
|
||||
merge: as-weak
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _inlineFunc
|
||||
|
@ -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
|
||||
@ -6,11 +6,6 @@
|
||||
|
||||
# CHECK: duplicate symbol
|
||||
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _foo
|
||||
scope: global
|
||||
type: data
|
||||
---
|
||||
defined-atoms:
|
||||
- name: _foo
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -1,36 +1,10 @@
|
||||
# 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
|
||||
# resolution
|
||||
#
|
||||
|
||||
---
|
||||
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
|
||||
---
|
||||
defined-atoms:
|
||||
- name: g1
|
||||
|
@ -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
|
||||
|
@ -5,32 +5,6 @@
|
||||
# resolution
|
||||
#
|
||||
|
||||
---
|
||||
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
|
||||
---
|
||||
defined-atoms:
|
||||
- name: f1
|
||||
|
@ -37,10 +37,6 @@ defined-atoms:
|
||||
- name: anotherfunction
|
||||
scope: global
|
||||
type: data
|
||||
---
|
||||
undefined-atoms:
|
||||
- name: f1
|
||||
can-be-null: never
|
||||
...
|
||||
|
||||
#CHECK: defined-atoms:
|
||||
|
@ -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
|
||||
|
@ -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 ]
|
||||
...
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
17
lld/test/darwin/Inputs/native-and-mach-o.objtxt
Normal file
17
lld/test/darwin/Inputs/native-and-mach-o.objtxt
Normal file
@ -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
|
19
lld/test/darwin/Inputs/native-and-mach-o2.objtxt
Normal file
19
lld/test/darwin/Inputs/native-and-mach-o2.objtxt
Normal file
@ -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
|
@ -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
|
||||
|
12
lld/test/elf/Inputs/allowduplicates.objtxt
Normal file
12
lld/test/elf/Inputs/allowduplicates.objtxt
Normal file
@ -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
|
@ -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
|
||||
|
@ -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__)
|
||||
|
||||
|
6
lld/test/mach-o/Inputs/PIE.yaml
Normal file
6
lld/test/mach-o/Inputs/PIE.yaml
Normal file
@ -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
|
83
lld/test/mach-o/Inputs/arm-interworking.yaml
Normal file
83
lld/test/mach-o/Inputs/arm-interworking.yaml
Normal file
@ -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
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user