1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

[XCOFF][llvm-objdump] Dump the debug type in --section-headers option.

Summary: Add XCOFF recognition of debug section types
under `--section-headers` option.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D103079
This commit is contained in:
Esme-Yi 2021-06-10 07:08:23 +00:00
parent a2165afcf1
commit af137d3a70
3 changed files with 14 additions and 0 deletions

View File

@ -338,6 +338,7 @@ public:
bool isSectionText(DataRefImpl Sec) const override;
bool isSectionData(DataRefImpl Sec) const override;
bool isSectionBSS(DataRefImpl Sec) const override;
bool isDebugSection(DataRefImpl Sec) const override;
bool isSectionVirtual(DataRefImpl Sec) const override;
relocation_iterator section_rel_begin(DataRefImpl Sec) const override;

View File

@ -311,6 +311,11 @@ bool XCOFFObjectFile::isSectionBSS(DataRefImpl Sec) const {
return Flags & (XCOFF::STYP_BSS | XCOFF::STYP_TBSS);
}
bool XCOFFObjectFile::isDebugSection(DataRefImpl Sec) const {
uint32_t Flags = getSectionFlags(Sec);
return Flags & (XCOFF::STYP_DEBUG | XCOFF::STYP_DWARF);
}
bool XCOFFObjectFile::isSectionVirtual(DataRefImpl Sec) const {
return is64Bit() ? toSection64(Sec)->FileOffsetToRawData == 0
: toSection32(Sec)->FileOffsetToRawData == 0;

View File

@ -11,6 +11,8 @@
# CHECK-NEXT: 2 .bss 00000000 00000010 BSS
# CHECK-NEXT: 3 .tdata 00000004 00000000 DATA
# CHECK-NEXT: 4 .tbss 00000000 00000000 BSS
# CHECK-NEXT: 5 .dwline 00000046 00000000 DEBUG
# CHECK-NEXT: 6 .debug 00000046 00000000 DEBUG
--- !XCOFF
FileHeader:
@ -33,6 +35,12 @@ Sections:
- Name: .tbss
Size: 0x0
Flags: [ STYP_TBSS ]
- Name: .dwline
Size: 0x46
Flags: [ STYP_DWARF ]
- Name: .debug
Size: 0x46
Flags: [ STYP_DEBUG ]
## Check the -h/--section-headers option prints long section names.
# RUN: yaml2obj %s --docnum=2 -o %t-longname.o