[PATCH] D103079: [XCOFF] [llvm-objdump] Add XCOFF recognition of debug section types under `--section-headers` option.
EsmeYi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 26 02:56:09 PDT 2021
Esme updated this revision to Diff 347873.
Esme added a comment.
Address comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103079/new/
https://reviews.llvm.org/D103079
Files:
llvm/include/llvm/Object/XCOFFObjectFile.h
llvm/lib/Object/XCOFFObjectFile.cpp
llvm/test/tools/llvm-objdump/XCOFF/section-headers.test
Index: llvm/test/tools/llvm-objdump/XCOFF/section-headers.test
===================================================================
--- llvm/test/tools/llvm-objdump/XCOFF/section-headers.test
+++ llvm/test/tools/llvm-objdump/XCOFF/section-headers.test
@@ -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 .dwinfo 00000046 00000000 DEBUG
--- !XCOFF
FileHeader:
@@ -33,6 +35,12 @@
- 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
Index: llvm/lib/Object/XCOFFObjectFile.cpp
===================================================================
--- llvm/lib/Object/XCOFFObjectFile.cpp
+++ llvm/lib/Object/XCOFFObjectFile.cpp
@@ -314,6 +314,11 @@
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;
Index: llvm/include/llvm/Object/XCOFFObjectFile.h
===================================================================
--- llvm/include/llvm/Object/XCOFFObjectFile.h
+++ llvm/include/llvm/Object/XCOFFObjectFile.h
@@ -294,6 +294,7 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103079.347873.patch
Type: text/x-patch
Size: 2242 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210526/fcddff19/attachment.bin>
More information about the llvm-commits
mailing list