File tree Expand file tree Collapse file tree 4 files changed +30
-4
lines changed
test/tools/llvm-objdump/XCOFF Expand file tree Collapse file tree 4 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,9 @@ template <typename T> struct XCOFFAuxiliaryHeader {
70
70
}
71
71
72
72
uint16_t getVersion () const { return static_cast <const T *>(this )->Version ; }
73
+ uint64_t getEntryPointAddr () const {
74
+ return static_cast <const T *>(this )->EntryPointAddr ;
75
+ }
73
76
};
74
77
75
78
struct XCOFFAuxiliaryHeader32 : XCOFFAuxiliaryHeader<XCOFFAuxiliaryHeader32> {
Original file line number Diff line number Diff line change @@ -737,9 +737,11 @@ bool XCOFFObjectFile::isRelocatableObject() const {
737
737
}
738
738
739
739
Expected<uint64_t > XCOFFObjectFile::getStartAddress () const {
740
- // TODO FIXME Should get from auxiliary_header->o_entry when support for the
741
- // auxiliary_header is added.
742
- return 0 ;
740
+ if (AuxiliaryHeader == nullptr )
741
+ return 0 ;
742
+
743
+ return is64Bit () ? auxiliaryHeader64 ()->getEntryPointAddr ()
744
+ : auxiliaryHeader32 ()->getEntryPointAddr ();
743
745
}
744
746
745
747
StringRef XCOFFObjectFile::mapDebugSectionName (StringRef Name) const {
Original file line number Diff line number Diff line change
1
+ ## Test the `--file-headers` option of llvm-objdump for XCOFF object files.
2
+ # RUN: yaml2obj %s -o %t1
3
+ # RUN: llvm-objdump --file-headers %t1 |\
4
+ # RUN: FileCheck %s --check-prefix=CHECK32 --match-full-lines
5
+ # RUN: yaml2obj %s -DMAGIC=0x1F7 -o %t2
6
+ # RUN: llvm-objdump --file-headers %t2 |\
7
+ # RUN: FileCheck %s --check-prefix=CHECK64 --match-full-lines
8
+
9
+ # CHECK32: {{.*}}file format aixcoff-rs6000
10
+ # CHECK32-NEXT: architecture: powerpc
11
+ # CHECK32-NEXT: start address: 0x00001111
12
+
13
+ # CHECK64: {{.*}}file format aix5coff64-rs6000
14
+ # CHECK64-NEXT: architecture: powerpc64
15
+ # CHECK64-NEXT: start address: 0x0000000000001111
16
+
17
+ --- !XCOFF
18
+ FileHeader:
19
+ MagicNumber: [[MAGIC=0x1DF]]
20
+ AuxiliaryHeader:
21
+ EntryPointAddr: 0x1111
Original file line number Diff line number Diff line change @@ -3151,7 +3151,7 @@ void Dumper::printPrivateHeaders() {
3151
3151
}
3152
3152
3153
3153
static void printFileHeaders (const ObjectFile *O) {
3154
- if (!O->isELF () && !O->isCOFF ())
3154
+ if (!O->isELF () && !O->isCOFF () && !O-> isXCOFF () )
3155
3155
reportError (O->getFileName (), " Invalid/Unsupported object file format" );
3156
3156
3157
3157
Triple::ArchType AT = O->getArch ();
You can’t perform that action at this time.
0 commit comments