mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-19 13:16:46 +00:00
[ELF] Make -t work with --format=binary
This is natural and matches GNU ld.
This commit is contained in:
parent
4da1c180b9
commit
bd288ebf5f
@ -284,13 +284,6 @@ template <class ELFT> static void doParseFile(InputFile *file) {
|
||||
if (!isCompatible(file))
|
||||
return;
|
||||
|
||||
// Binary file
|
||||
if (auto *f = dyn_cast<BinaryFile>(file)) {
|
||||
ctx.binaryFiles.push_back(f);
|
||||
f->parse();
|
||||
return;
|
||||
}
|
||||
|
||||
// Lazy object file
|
||||
if (file->lazy) {
|
||||
if (auto *f = dyn_cast<BitcodeFile>(file)) {
|
||||
@ -305,22 +298,18 @@ template <class ELFT> static void doParseFile(InputFile *file) {
|
||||
if (config->trace)
|
||||
message(toString(file));
|
||||
|
||||
// .so file
|
||||
if (auto *f = dyn_cast<SharedFile>(file)) {
|
||||
if (file->kind() == InputFile::ObjKind) {
|
||||
ctx.objectFiles.push_back(cast<ELFFileBase>(file));
|
||||
cast<ObjFile<ELFT>>(file)->parse();
|
||||
} else if (auto *f = dyn_cast<SharedFile>(file)) {
|
||||
f->parse<ELFT>();
|
||||
return;
|
||||
}
|
||||
|
||||
// LLVM bitcode file
|
||||
if (auto *f = dyn_cast<BitcodeFile>(file)) {
|
||||
} else if (auto *f = dyn_cast<BitcodeFile>(file)) {
|
||||
ctx.bitcodeFiles.push_back(f);
|
||||
f->parse();
|
||||
return;
|
||||
} else {
|
||||
ctx.binaryFiles.push_back(cast<BinaryFile>(file));
|
||||
cast<BinaryFile>(file)->parse();
|
||||
}
|
||||
|
||||
// Regular object file
|
||||
ctx.objectFiles.push_back(cast<ELFFileBase>(file));
|
||||
cast<ObjFile<ELFT>>(file)->parse();
|
||||
}
|
||||
|
||||
// Add symbols in File to the symbol table.
|
||||
|
@ -6,9 +6,11 @@
|
||||
|
||||
# RUN: mkdir d
|
||||
# RUN: echo -n "Fluffle Puff" > d/t.txt
|
||||
# RUN: ld.lld -m elf_x86_64 -r -b binary d/t.txt -o ro
|
||||
# RUN: ld.lld -m elf_x86_64 -r -b binary d/t.txt -t -o ro | FileCheck %s --check-prefix=RO-TRACE
|
||||
# RUN: llvm-readelf -h -S -s -x .data ro | FileCheck --check-prefix=RO %s
|
||||
|
||||
# RO-TRACE: d/t.txt
|
||||
|
||||
# RO: Machine: Advanced Micro Devices X86-64
|
||||
# RO: Name Type Address Off Size ES Flg Lk Inf Al
|
||||
# RO-NEXT: NULL 0000000000000000 000000 000000 00 0 0 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user