mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-21 18:22:53 +01:00
[llvm-objdump][XCOFF] Enable the -l (--line-numbers) option.
Summary: Add support for dumping line number information for XCOFF object files in llvm-objdump. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D101272
This commit is contained in:
parent
edcfd20e4e
commit
0c72329384
@ -370,7 +370,7 @@ public:
|
||||
const void *getPointerToSymbolTable() const { return SymbolTblPtr; }
|
||||
|
||||
Expected<StringRef> getSymbolSectionName(XCOFFSymbolRef Ref) const;
|
||||
|
||||
unsigned getSymbolSectionID(SymbolRef Sym) const;
|
||||
XCOFFSymbolRef toSymbolRef(DataRefImpl Ref) const;
|
||||
|
||||
// File header related interfaces.
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "llvm/Object/ELFObjectFile.h"
|
||||
#include "llvm/Object/MachO.h"
|
||||
#include "llvm/Object/Wasm.h"
|
||||
#include "llvm/Object/XCOFFObjectFile.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace object;
|
||||
@ -30,7 +31,8 @@ static unsigned getSectionID(const ObjectFile &O, SectionRef Sec) {
|
||||
return M->getSectionID(Sec);
|
||||
if (isa<WasmObjectFile>(&O))
|
||||
return Sec.getIndex();
|
||||
|
||||
if (isa<XCOFFObjectFile>(&O))
|
||||
return Sec.getIndex();
|
||||
return cast<COFFObjectFile>(O).getSectionID(Sec);
|
||||
}
|
||||
|
||||
@ -39,6 +41,8 @@ static unsigned getSymbolSectionID(const ObjectFile &O, SymbolRef Sym) {
|
||||
return M->getSymbolSectionID(Sym);
|
||||
if (const auto *M = dyn_cast<WasmObjectFile>(&O))
|
||||
return M->getSymbolSectionId(Sym);
|
||||
if (const auto *M = dyn_cast<XCOFFObjectFile>(&O))
|
||||
return M->getSymbolSectionID(Sym);
|
||||
return cast<COFFObjectFile>(O).getSymbolSectionID(Sym);
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ uint64_t XCOFFObjectFile::getCommonSymbolSizeImpl(DataRefImpl Symb) const {
|
||||
|
||||
Expected<SymbolRef::Type>
|
||||
XCOFFObjectFile::getSymbolType(DataRefImpl Symb) const {
|
||||
llvm_unreachable("Not yet implemented!");
|
||||
// TODO: Return the correct symbol type.
|
||||
return SymbolRef::ST_Other;
|
||||
}
|
||||
|
||||
@ -394,7 +394,7 @@ void XCOFFObjectFile::getRelocationTypeName(
|
||||
|
||||
Expected<uint32_t> XCOFFObjectFile::getSymbolFlags(DataRefImpl Symb) const {
|
||||
uint32_t Result = 0;
|
||||
llvm_unreachable("Not yet implemented!");
|
||||
// TODO: Return correct symbol flags.
|
||||
return Result;
|
||||
}
|
||||
|
||||
@ -513,6 +513,11 @@ XCOFFObjectFile::getSymbolSectionName(XCOFFSymbolRef SymEntPtr) const {
|
||||
}
|
||||
}
|
||||
|
||||
unsigned XCOFFObjectFile::getSymbolSectionID(SymbolRef Sym) const {
|
||||
XCOFFSymbolRef XCOFFSymRef(Sym.getRawDataRefImpl(), this);
|
||||
return XCOFFSymRef.getSectionNumber();
|
||||
}
|
||||
|
||||
bool XCOFFObjectFile::isReservedSectionNumber(int16_t SectionNumber) {
|
||||
return (SectionNumber <= 0 && SectionNumber >= -2);
|
||||
}
|
||||
|
BIN
test/tools/llvm-objdump/XCOFF/Inputs/basic32.o
Normal file
BIN
test/tools/llvm-objdump/XCOFF/Inputs/basic32.o
Normal file
Binary file not shown.
BIN
test/tools/llvm-objdump/XCOFF/Inputs/basic64.o
Normal file
BIN
test/tools/llvm-objdump/XCOFF/Inputs/basic64.o
Normal file
Binary file not shown.
@ -1,5 +1,3 @@
|
||||
# REQUIRES: powerpc-registered-target
|
||||
|
||||
# RUN: llvm-objdump -D %p/Inputs/xcoff-section-headers.o | \
|
||||
# RUN: FileCheck %s
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
# REQUIRES: powerpc-registered-target
|
||||
|
||||
# RUN: llvm-objdump -D %p/Inputs/xcoff-section-headers.o | \
|
||||
# RUN: FileCheck --check-prefixes=COMMON,PLAIN %s
|
||||
|
||||
|
2
test/tools/llvm-objdump/XCOFF/lit.local.cfg
Normal file
2
test/tools/llvm-objdump/XCOFF/lit.local.cfg
Normal file
@ -0,0 +1,2 @@
|
||||
if not 'PowerPC' in config.root.targets:
|
||||
config.unsupported = True
|
50
test/tools/llvm-objdump/XCOFF/print-linenumber.test
Normal file
50
test/tools/llvm-objdump/XCOFF/print-linenumber.test
Normal file
@ -0,0 +1,50 @@
|
||||
# Test that the `llvm-objdump -l` can print correct line numbers.
|
||||
|
||||
# RUN: llvm-objdump -d -l %p/Inputs/basic32.o | FileCheck %s --check-prefix=LINES32
|
||||
# RUN: llvm-objdump -d -l %p/Inputs/basic64.o | FileCheck %s --check-prefix=LINES64
|
||||
|
||||
## basic32.o Compiled with IBM XL C/C++ for AIX, V16.1.1.0
|
||||
## Compiler command: xlc basic.c -c -qdbgfmt=dwarf -g -q32 -o basic32.o
|
||||
##
|
||||
## basic64.o Compiled with IBM XL C/C++ for AIX, V16.1.1.0
|
||||
## Compiler command: xlc basic.c -c -qdbgfmt=dwarf -g -q64 -o basic64.o
|
||||
##
|
||||
## basic.c:
|
||||
## int main(void)
|
||||
## {
|
||||
## return 0;
|
||||
## }
|
||||
|
||||
# LINES32: Inputs/basic32.o: file format aixcoff-rs6000
|
||||
# LINES32: Disassembly of section .text:
|
||||
# LINES32: 00000000 <.text>:
|
||||
# LINES32: ; main():
|
||||
# LINES32-NEXT: ; /basic.c:1
|
||||
# LINES32-NEXT: 0: 38 60 00 00 li 3, 0
|
||||
# LINES32-NEXT: ; /basic.c:3
|
||||
# LINES32-NEXT: 4: 48 00 00 04 b 0x8
|
||||
# LINES32-NEXT: ; /basic.c:4
|
||||
# LINES32-NEXT: 8: 4e 80 00 20 blr
|
||||
# LINES32-NEXT: c: 00 00 00 00 <unknown>
|
||||
# LINES32-NEXT: 10: 00 00 20 40 <unknown>
|
||||
# LINES32-NEXT: 14: 00 00 00 01 <unknown>
|
||||
# LINES32-NEXT: 18: 00 00 00 0c <unknown>
|
||||
# LINES32-NEXT: 1c: 00 04 6d 61 <unknown>
|
||||
# LINES32-NEXT: 20: 69 6e 00 00 xori 14, 11, 0
|
||||
|
||||
# LINES64: Inputs/basic64.o: file format aix5coff64-rs6000
|
||||
# LINES64: Disassembly of section .text:
|
||||
# LINES64: 0000000000000000 <.main>:
|
||||
# LINES64: ; main():
|
||||
# LINES64-NEXT: ; /basic.c:1
|
||||
# LINES64-NEXT: 0: 38 60 00 00 li 3, 0
|
||||
# LINES64-NEXT: ; /basic.c:3
|
||||
# LINES64-NEXT: 4: 48 00 00 04 b 0x8
|
||||
# LINES64-NEXT: ; /basic.c:4
|
||||
# LINES64-NEXT: 8: 4e 80 00 20 blr
|
||||
# LINES64-NEXT: c: 00 00 00 00 <unknown>
|
||||
# LINES64-NEXT: 10: 00 00 20 40 <unknown>
|
||||
# LINES64-NEXT: 14: 00 00 00 01 <unknown>
|
||||
# LINES64-NEXT: 18: 00 00 00 0c <unknown>
|
||||
# LINES64-NEXT: 1c: 00 04 6d 61 <unknown>
|
||||
# LINES64-NEXT: 20: 69 6e 00 00 xori 14, 11, 0
|
@ -1,5 +1,3 @@
|
||||
# REQUIRES: powerpc-registered-target
|
||||
|
||||
# RUN: llvm-objdump -r %p/Inputs/xcoff-section-headers.o | \
|
||||
# RUN: FileCheck --match-full-lines --strict-whitespace %s
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user