[llvm] 81441cf - [XCOFF] [llvm-readobj] replace tests using binary as input
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 1 01:45:18 PDT 2021
Author: Esme-Yi
Date: 2021-11-01T08:43:32Z
New Revision: 81441cf44c145e1d90a10c743e0190a44fbf8fcb
URL: https://github.com/llvm/llvm-project/commit/81441cf44c145e1d90a10c743e0190a44fbf8fcb
DIFF: https://github.com/llvm/llvm-project/commit/81441cf44c145e1d90a10c743e0190a44fbf8fcb.diff
LOG: [XCOFF] [llvm-readobj] replace tests using binary as input
with tests generated by yaml2obj.
Summary: Because yaml2obj supports basic transforming for XCOFF,
some of the binary inputs used in the tests of llvm-readobj
can be replaced with yaml files.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D111699
Added:
llvm/test/tools/llvm-readobj/XCOFF/file-header.test
llvm/test/tools/llvm-readobj/XCOFF/relocations.test
Modified:
llvm/include/llvm/ObjectYAML/XCOFFYAML.h
llvm/test/tools/llvm-readobj/XCOFF/sections.test
Removed:
llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic-neg-sym-count.o
llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic-neg-time.o
llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic.o
llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic64.o
llvm/test/tools/llvm-readobj/XCOFF/basic.test
################################################################################
diff --git a/llvm/include/llvm/ObjectYAML/XCOFFYAML.h b/llvm/include/llvm/ObjectYAML/XCOFFYAML.h
index 20d072c1991fc..4f07e24586224 100644
--- a/llvm/include/llvm/ObjectYAML/XCOFFYAML.h
+++ b/llvm/include/llvm/ObjectYAML/XCOFFYAML.h
@@ -24,7 +24,7 @@ struct FileHeader {
uint16_t NumberOfSections;
int32_t TimeStamp;
llvm::yaml::Hex64 SymbolTableOffset;
- uint32_t NumberOfSymTableEntries;
+ int32_t NumberOfSymTableEntries;
uint16_t AuxHeaderSize;
llvm::yaml::Hex16 Flags;
};
diff --git a/llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic-neg-sym-count.o b/llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic-neg-sym-count.o
deleted file mode 100644
index e7f63664acd33..0000000000000
Binary files a/llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic-neg-sym-count.o and /dev/null
diff er
diff --git a/llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic-neg-time.o b/llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic-neg-time.o
deleted file mode 100644
index f814965f4f0f6..0000000000000
Binary files a/llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic-neg-time.o and /dev/null
diff er
diff --git a/llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic.o b/llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic.o
deleted file mode 100644
index c84056bdb00bd..0000000000000
Binary files a/llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic.o and /dev/null
diff er
diff --git a/llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic64.o b/llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic64.o
deleted file mode 100644
index d6c79abd8cfa6..0000000000000
Binary files a/llvm/test/tools/llvm-readobj/XCOFF/Inputs/basic64.o and /dev/null
diff er
diff --git a/llvm/test/tools/llvm-readobj/XCOFF/basic.test b/llvm/test/tools/llvm-readobj/XCOFF/basic.test
deleted file mode 100644
index 9d9917274e84c..0000000000000
--- a/llvm/test/tools/llvm-readobj/XCOFF/basic.test
+++ /dev/null
@@ -1,160 +0,0 @@
-# RUN: llvm-readobj --file-header %p/Inputs/basic.o | \
-# RUN: FileCheck --check-prefix=FILEHEADER %s
-#
-# RUN: llvm-readobj --file-header %p/Inputs/basic64.o | \
-# RUN: FileCheck --check-prefix=FILEHEADER64 %s
-
-# RUN: llvm-readobj --file-header %p/Inputs/basic-neg-time.o | \
-# RUN: FileCheck --check-prefix=NEGTIME %s
-
-# RUN: llvm-readobj --file-header %p/Inputs/basic-neg-sym-count.o | \
-# RUN: FileCheck --check-prefix=NEGSYMCOUNT %s
-
-# RUN: llvm-readobj --relocs --expand-relocs %p/Inputs/basic.o | \
-# RUN: FileCheck --check-prefix=RELOCSEXP %s
-
-# FILEHEADER: File: {{.*}}basic.o
-# FILEHEADER-NEXT: Format: aixcoff-rs6000
-# FILEHEADER-NEXT: Arch: powerpc
-# FILEHEADER-NEXT: AddressSize: 32bit
-# FILEHEADER-NEXT: FileHeader {
-# FILEHEADER-NEXT: Magic: 0x1DF
-# FILEHEADER-NEXT: NumberOfSections: 6
-# FILEHEADER-NEXT: TimeStamp: 2019-03-12T14:04:43Z (0x5C87BC7B)
-# FILEHEADER-NEXT: SymbolTableOffset: 0x52E
-# FILEHEADER-NEXT: SymbolTableEntries: 120
-# FILEHEADER-NEXT: OptionalHeaderSize: 0x1C
-# FILEHEADER-NEXT: Flags: 0x0
-# FILEHEADER-NEXT: }
-
-# FILEHEADER64: File: {{.*}}basic64.o
-# FILEHEADER64-NEXT: Format: aix5coff64-rs6000
-# FILEHEADER64-NEXT: Arch: powerpc64
-# FILEHEADER64-NEXT: AddressSize: 64bit
-# FILEHEADER64-NEXT: FileHeader {
-# FILEHEADER64-NEXT: Magic: 0x1F7
-# FILEHEADER64-NEXT: NumberOfSections: 5
-# FILEHEADER64-NEXT: TimeStamp: 2019-03-18T20:03:47Z (0x5C8FF9A3)
-# FILEHEADER64-NEXT: SymbolTableOffset: 0x54C
-# FILEHEADER64-NEXT: SymbolTableEntries: 58
-# FILEHEADER64-NEXT: OptionalHeaderSize: 0x0
-# FILEHEADER64-NEXT: Flags: 0x0
-# FILEHEADER64-NEXT: }
-
-# NEGTIME: File: {{.*}}basic-neg-time.o
-# NEGTIME-NEXT: Format: aixcoff-rs6000
-# NEGTIME-NEXT: Arch: powerpc
-# NEGTIME-NEXT: AddressSize: 32bit
-# NEGTIME-NEXT: FileHeader {
-# NEGTIME-NEXT: Magic: 0x1DF
-# NEGTIME-NEXT: NumberOfSections: 6
-# NEGTIME-NEXT: TimeStamp: Reserved Value (0xDC87BC7B)
-# NEGTIME-NEXT: SymbolTableOffset: 0x52E
-# NEGTIME-NEXT: SymbolTableEntries: 120
-# NEGTIME-NEXT: OptionalHeaderSize: 0x1C
-# NEGTIME-NEXT: Flags: 0x0
-# NEGTIME-NEXT: }
-
-# NEGSYMCOUNT: File: {{.*}}basic-neg-sym-count.o
-# NEGSYMCOUNT-NEXT: Format: aixcoff-rs6000
-# NEGSYMCOUNT-NEXT: Arch: powerpc
-# NEGSYMCOUNT-NEXT: AddressSize: 32bit
-# NEGSYMCOUNT-NEXT: FileHeader {
-# NEGSYMCOUNT-NEXT: Magic: 0x1DF
-# NEGSYMCOUNT-NEXT: NumberOfSections: 5
-# NEGSYMCOUNT-NEXT: TimeStamp: 2019-03-12T14:04:43Z (0x5C87BC7B)
-# NEGSYMCOUNT-NEXT: SymbolTableOffset: 0x0
-# NEGSYMCOUNT-NEXT: SymbolTableEntries: Reserved Value (0x80000000)
-# NEGSYMCOUNT-NEXT: OptionalHeaderSize: 0x1C
-# NEGSYMCOUNT-NEXT: Flags: 0xD
-# NEGSYMCOUNT-NEXT: }
-
-# xcoff-basic.o was compiled with `xlc -qtls -O3 -g -c xcoff-basic.c`
-# from the following source:
-# int a = 55;
-# int b;
-# __thread int j = 55;
-# __thread double d;
-# int A() { return a; }
-# int B() { return b; }
-# int J() { return j; }
-# double D() { return d; }
-#
-# xcoff-basic-neg-time.o was manually edited to include a negative time stamp.
-# xcoff-basic-neg-sym-count.o was stripped using the 'strip' utility, and
-# manually edited to have a negative symbol table entry count.
-
-# RELOCSEXP: File: {{.*}}basic.o
-# RELOCSEXP-NEXT: Format: aixcoff-rs6000
-# RELOCSEXP-NEXT: Arch: powerpc
-# RELOCSEXP-NEXT: AddressSize: 32bit
-# RELOCSEXP-NEXT: Relocations [
-# RELOCSEXP-NEXT: Section (index: 1) .text {
-# RELOCSEXP-NEXT: Relocation {
-# RELOCSEXP-NEXT: Virtual Address: 0x2
-# RELOCSEXP-NEXT: Symbol: a (85)
-# RELOCSEXP-NEXT: IsSigned: Yes
-# RELOCSEXP-NEXT: FixupBitValue: 0
-# RELOCSEXP-NEXT: Length: 16
-# RELOCSEXP-NEXT: Type: R_TOC (0x3)
-# RELOCSEXP-NEXT: }
-
-# RELOCSEXP: Virtual Address: 0x90
-# RELOCSEXP-NEXT: Symbol: .__tls_get_addr (118)
-# RELOCSEXP-NEXT: IsSigned: Yes
-# RELOCSEXP-NEXT: FixupBitValue: 0
-# RELOCSEXP-NEXT: Length: 26
-# RELOCSEXP-NEXT: Type: R_RBA (0x18)
-# RELOCSEXP-NEXT: }
-# RELOCSEXP-NEXT: }
-# RELOCSEXP-NEXT: Section (index: 2) .data {
-# RELOCSEXP-NEXT: Relocation {
-# RELOCSEXP-NEXT: Virtual Address: 0x100
-# RELOCSEXP-NEXT: Symbol: A (78)
-# RELOCSEXP-NEXT: IsSigned: No
-# RELOCSEXP-NEXT: FixupBitValue: 0
-# RELOCSEXP-NEXT: Length: 32
-# RELOCSEXP-NEXT: Type: R_POS (0x0)
-# RELOCSEXP-NEXT: }
-
-# RELOCSEXP: Virtual Address: 0x110
-# RELOCSEXP-NEXT: Symbol: J (96)
-# RELOCSEXP-NEXT: IsSigned: No
-# RELOCSEXP-NEXT: FixupBitValue: 0
-# RELOCSEXP-NEXT: Length: 32
-# RELOCSEXP-NEXT: Type: R_POS (0x0)
-# RELOCSEXP-NEXT: }
-
-# RELOCSEXP: Virtual Address: 0x114
-# RELOCSEXP-NEXT: Symbol: j (100)
-# RELOCSEXP-NEXT: IsSigned: No
-# RELOCSEXP-NEXT: FixupBitValue: 0
-# RELOCSEXP-NEXT: Length: 32
-# RELOCSEXP-NEXT: Type: R_TLS (0x20)
-# RELOCSEXP-NEXT: }
-
-# RELOCSEXP: Virtual Address: 0x124
-# RELOCSEXP-NEXT: Symbol: d (111)
-# RELOCSEXP-NEXT: IsSigned: No
-# RELOCSEXP-NEXT: FixupBitValue: 0
-# RELOCSEXP-NEXT: Length: 32
-# RELOCSEXP-NEXT: Type: R_TLSM (0x24)
-# RELOCSEXP-NEXT: }
-
-# RELOCSEXP: Virtual Address: 0x128
-# RELOCSEXP-NEXT: Symbol: (76)
-# RELOCSEXP-NEXT: IsSigned: No
-# RELOCSEXP-NEXT: FixupBitValue: 0
-# RELOCSEXP-NEXT: Length: 32
-# RELOCSEXP-NEXT: Type: R_POS (0x0)
-# RELOCSEXP-NEXT: }
-
-# RELOCSEXP: Virtual Address: 0x154
-# RELOCSEXP-NEXT: Symbol: TOC (72)
-# RELOCSEXP-NEXT: IsSigned: No
-# RELOCSEXP-NEXT: FixupBitValue: 0
-# RELOCSEXP-NEXT: Length: 32
-# RELOCSEXP-NEXT: Type: R_POS (0x0)
-# RELOCSEXP-NEXT: }
-# RELOCSEXP-NEXT: }
-# RELOCSEXP-NEXT:]
diff --git a/llvm/test/tools/llvm-readobj/XCOFF/file-header.test b/llvm/test/tools/llvm-readobj/XCOFF/file-header.test
new file mode 100644
index 0000000000000..9fe09a893997c
--- /dev/null
+++ b/llvm/test/tools/llvm-readobj/XCOFF/file-header.test
@@ -0,0 +1,65 @@
+## This is a general test for the --file-header option.
+
+# RUN: yaml2obj %s -o %t1
+# RUN: llvm-readobj %t1 --file-header | \
+# RUN: FileCheck %s --strict-whitespace --match-full-lines --check-prefix=FILEHEADER32
+
+# FILEHEADER32:Format: aixcoff-rs6000
+# FILEHEADER32-NEXT:Arch: powerpc
+# FILEHEADER32-NEXT:AddressSize: 32bit
+# FILEHEADER32-NEXT:FileHeader {
+# FILEHEADER32-NEXT: Magic: 0x1DF
+# FILEHEADER32-NEXT: NumberOfSections: 1
+# FILEHEADER32-NEXT: TimeStamp: 1970-01-01T00:00:01Z (0x1)
+# FILEHEADER32-NEXT: SymbolTableOffset: 0x3C
+# FILEHEADER32-NEXT: SymbolTableEntries: 1
+# FILEHEADER32-NEXT: OptionalHeaderSize: 0x0
+# FILEHEADER32-NEXT: Flags: 0x12
+# FILEHEADER32-NEXT:}
+
+--- !XCOFF
+FileHeader:
+ MagicNumber: [[MAGIC=0x01DF]]
+ CreationTime: [[CREATTIME=1]]
+ EntriesInSymbolTable: [[SYMBOLCOUNT=1]]
+ NumberOfSections: 1
+ OffsetToSymbolTable: 0x3C
+ AuxiliaryHeaderSize: 0
+ Flags: 0x12
+Sections:
+ - Name: .text
+Symbols:
+ - Name: foo
+
+# RUN: yaml2obj -DMAGIC=0x01F7 -DCREATTIME=0 %s -o %t2
+# RUN: llvm-readobj %t2 --file-header | \
+# RUN: FileCheck %s --strict-whitespace --match-full-lines --check-prefix=FILEHEADER64
+
+# FILEHEADER64:Format: aix5coff64-rs6000
+# FILEHEADER64-NEXT:Arch: powerpc64
+# FILEHEADER64-NEXT:AddressSize: 64bit
+# FILEHEADER64-NEXT:FileHeader {
+# FILEHEADER64-NEXT: Magic: 0x1F7
+# FILEHEADER64-NEXT: NumberOfSections: 1
+# FILEHEADER64-NEXT: TimeStamp: None (0x0)
+# FILEHEADER64-NEXT: SymbolTableOffset: 0x3C
+# FILEHEADER64-NEXT: SymbolTableEntries: 1
+# FILEHEADER64-NEXT: OptionalHeaderSize: 0x0
+# FILEHEADER64-NEXT: Flags: 0x12
+# FILEHEADER64-NEXT:}
+
+# RUN: yaml2obj -DCREATTIME=-1 %s -o %t3
+# RUN: llvm-readobj %t3 --file-header | \
+# RUN: FileCheck %s --strict-whitespace --match-full-lines --check-prefix=NEGTIME
+
+# NEGTIME:FileHeader {
+# NEGTIME: TimeStamp: Reserved Value (0xFFFFFFFF)
+# NEGTIME:}
+
+# RUN: yaml2obj -DSYMBOLCOUNT=-1 %s -o %t4
+# RUN: llvm-readobj %t4 --file-header | \
+# RUN: FileCheck %s --strict-whitespace --match-full-lines --check-prefix=NEGSYMCOUNT
+
+# NEGSYMCOUNT:FileHeader {
+# NEGSYMCOUNT: SymbolTableEntries: Reserved Value (0xFFFFFFFF)
+# NEGSYMCOUNT:}
diff --git a/llvm/test/tools/llvm-readobj/XCOFF/relocations.test b/llvm/test/tools/llvm-readobj/XCOFF/relocations.test
new file mode 100644
index 0000000000000..bff17120c15b4
--- /dev/null
+++ b/llvm/test/tools/llvm-readobj/XCOFF/relocations.test
@@ -0,0 +1,68 @@
+## Test how relocations are dumped.
+
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-readobj --relocs --expand-relocs %t | \
+# RUN: FileCheck %s --strict-whitespace --match-full-lines --check-prefix=RELOCSEXP
+
+## TODO: Output of relocations not aligned.
+
+# RELOCSEXP:Relocations [
+# RELOCSEXP-NEXT: Section (index: 1) .text {
+# RELOCSEXP-NEXT: Relocation {
+# RELOCSEXP-NEXT: Virtual Address: 0x80
+# RELOCSEXP-NEXT: Symbol: foo (0)
+# RELOCSEXP-NEXT: IsSigned: No
+# RELOCSEXP-NEXT: FixupBitValue: 0
+# RELOCSEXP-NEXT: Length: 22
+# RELOCSEXP-NEXT: Type: R_POS (0x0)
+# RELOCSEXP-NEXT: }
+# RELOCSEXP-NEXT: Relocation {
+# RELOCSEXP-NEXT: Virtual Address: 0x100
+# RELOCSEXP-NEXT: Symbol: foo (0)
+# RELOCSEXP-NEXT: IsSigned: No
+# RELOCSEXP-NEXT: FixupBitValue: 0
+# RELOCSEXP-NEXT: Length: 21
+# RELOCSEXP-NEXT: Type: R_REL (0x2)
+# RELOCSEXP-NEXT: }
+# RELOCSEXP-NEXT:}
+# RELOCSEXP-NEXT:Section (index: 2) .data {
+# RELOCSEXP-NEXT:Relocation {
+# RELOCSEXP-NEXT: Virtual Address: 0x200
+# RELOCSEXP-NEXT: Symbol: bar (1)
+# RELOCSEXP-NEXT: IsSigned: No
+# RELOCSEXP-NEXT: FixupBitValue: 0
+# RELOCSEXP-NEXT: Length: 20
+# RELOCSEXP-NEXT: Type: R_TOC (0x3)
+# RELOCSEXP-NEXT:}
+# RELOCSEXP-NEXT:}
+# RELOCSEXP-NEXT:]
+
+--- !XCOFF
+FileHeader:
+ MagicNumber: 0x01DF
+Sections:
+ - Name: .text
+ Flags: [ STYP_TEXT ]
+ Relocations:
+ - Address: 0x80
+ Symbol: 0x0
+ Info: 0x15
+ Type: 0x0
+ - Address: 0x100
+ Symbol: 0x0
+ Info: 0x14
+ Type: 0x2
+ - Name: .data
+ Flags: [ STYP_DATA ]
+ Relocations:
+ - Address: 0x200
+ Symbol: 0x1
+ Info: 0x13
+ Type: 0x3
+Symbols:
+ - Name: foo
+ Value: 0x0
+ Section: .text
+ - Name: bar
+ Value: 0x80
+ Section: .data
diff --git a/llvm/test/tools/llvm-readobj/XCOFF/sections.test b/llvm/test/tools/llvm-readobj/XCOFF/sections.test
index b0d5436e0baba..62695de1a70c5 100644
--- a/llvm/test/tools/llvm-readobj/XCOFF/sections.test
+++ b/llvm/test/tools/llvm-readobj/XCOFF/sections.test
@@ -1,164 +1,89 @@
-# RUN: llvm-readobj --section-headers %p/Inputs/basic.o | \
-# RUN: FileCheck --check-prefix=SEC32 %s
+## This is a general test for the --section-headers option.
-# RUN: llvm-readobj --section-headers %p/Inputs/basic64.o | \
-# RUN: FileCheck --check-prefix=SEC64 %s
+# RUN: yaml2obj %s -o %t1
+# RUN: llvm-readobj --section-headers %t1 | \
+# RUN: FileCheck --strict-whitespace --match-full-lines --check-prefix=SEC32 %s
-# SEC32: File: {{.*}}basic.o
-# SEC32-NEXT: Format: aixcoff-rs6000
-# SEC32-NEXT: Arch: powerpc
-# SEC32-NEXT: AddressSize: 32bit
-# SEC32-NEXT: Sections [
-# SEC32-NEXT: Section {
-# SEC32-NEXT: Index: 1
-# SEC32-NEXT: Name: .text
-# SEC32-NEXT: PhysicalAddress: 0x0
-# SEC32-NEXT: VirtualAddress: 0x0
-# SEC32-NEXT: Size: 0x100
-# SEC32-NEXT: RawDataOffset: 0x200
-# SEC32-NEXT: RelocationPointer: 0x3D8
-# SEC32-NEXT: LineNumberPointer: 0x4E6
-# SEC32-NEXT: NumberOfRelocations: 8
-# SEC32-NEXT: NumberOfLineNumbers: 12
-# SEC32-NEXT: Type: STYP_TEXT (0x20)
-# SEC32-NEXT: }
-# SEC32-NEXT: Section {
-# SEC32-NEXT: Index: 2
-# SEC32-NEXT: Name: .data
-# SEC32-NEXT: PhysicalAddress: 0x100
-# SEC32-NEXT: VirtualAddress: 0x100
-# SEC32-NEXT: Size: 0x68
-# SEC32-NEXT: RawDataOffset: 0x300
-# SEC32-NEXT: RelocationPointer: 0x428
-# SEC32-NEXT: LineNumberPointer: 0x0
-# SEC32-NEXT: NumberOfRelocations: 19
-# SEC32-NEXT: NumberOfLineNumbers: 0
-# SEC32-NEXT: Type: STYP_DATA (0x40)
-# SEC32-NEXT: }
-# SEC32-NEXT: Section {
-# SEC32-NEXT: Index: 3
-# SEC32-NEXT: Name: .bss
-# SEC32-NEXT: PhysicalAddress: 0x168
-# SEC32-NEXT: VirtualAddress: 0x168
-# SEC32-NEXT: Size: 0x4
-# SEC32-NEXT: RawDataOffset: 0x0
-# SEC32-NEXT: RelocationPointer: 0x0
-# SEC32-NEXT: LineNumberPointer: 0x0
-# SEC32-NEXT: NumberOfRelocations: 0
-# SEC32-NEXT: NumberOfLineNumbers: 0
-# SEC32-NEXT: Type: STYP_BSS (0x80)
-# SEC32-NEXT: }
-# SEC32-NEXT: Section {
-# SEC32-NEXT: Index: 4
-# SEC32-NEXT: Name: .tdata
-# SEC32-NEXT: PhysicalAddress: 0x0
-# SEC32-NEXT: VirtualAddress: 0x0
-# SEC32-NEXT: Size: 0x4
-# SEC32-NEXT: RawDataOffset: 0x368
-# SEC32-NEXT: RelocationPointer: 0x47A
-# SEC32-NEXT: LineNumberPointer: 0x0
-# SEC32-NEXT: NumberOfRelocations: 0
-# SEC32-NEXT: NumberOfLineNumbers: 0
-# SEC32-NEXT: Type: STYP_TDATA (0x400)
-# SEC32-NEXT: }
-# SEC32-NEXT: Section {
-# SEC32-NEXT: Index: 5
-# SEC32-NEXT: Name: .tbss
-# SEC32-NEXT: PhysicalAddress: 0x4
-# SEC32-NEXT: VirtualAddress: 0x4
-# SEC32-NEXT: Size: 0x8
-# SEC32-NEXT: RawDataOffset: 0x0
-# SEC32-NEXT: RelocationPointer: 0x0
-# SEC32-NEXT: LineNumberPointer: 0x0
-# SEC32-NEXT: NumberOfRelocations: 0
-# SEC32-NEXT: NumberOfLineNumbers: 0
-# SEC32-NEXT: Type: STYP_TBSS (0x800)
-# SEC32-NEXT: }
-# SEC32-NEXT: Section {
-# SEC32-NEXT: Index: 6
-# SEC32-NEXT: Name: .debug
-# SEC32-NEXT: PhysicalAddress: 0x0
-# SEC32-NEXT: VirtualAddress: 0x0
-# SEC32-NEXT: Size: 0x6C
-# SEC32-NEXT: RawDataOffset: 0x36C
-# SEC32-NEXT: RelocationPointer: 0x0
-# SEC32-NEXT: LineNumberPointer: 0x0
-# SEC32-NEXT: NumberOfRelocations: 0
-# SEC32-NEXT: NumberOfLineNumbers: 0
-# SEC32-NEXT: Type: STYP_DEBUG (0x2000)
-# SEC32-NEXT: }
-# SEC32-NEXT: ]
+# SEC32:Format: aixcoff-rs6000
+# SEC32-NEXT:Arch: powerpc
+# SEC32-NEXT:AddressSize: 32bit
+# SEC32-NEXT:Sections [
+# SEC32-NEXT: Section {
+# SEC32-NEXT: Index: 1
+# SEC32-NEXT: Name: .text
+# SEC32-NEXT: PhysicalAddress: 0x0
+# SEC32-NEXT: VirtualAddress: 0x0
+# SEC32-NEXT: Size: 0x4
+# SEC32-NEXT: RawDataOffset: 0x64
+# SEC32-NEXT: RelocationPointer: 0x0
+# SEC32-NEXT: LineNumberPointer: 0x0
+# SEC32-NEXT: NumberOfRelocations: 0
+# SEC32-NEXT: NumberOfLineNumbers: 0
+# SEC32-NEXT: Type: STYP_TEXT (0x20)
+# SEC32-NEXT: }
+# SEC32-NEXT: Section {
+# SEC32-NEXT: Index: 2
+# SEC32-NEXT: Name: .data
+# SEC32-NEXT: PhysicalAddress: 0x4
+# SEC32-NEXT: VirtualAddress: 0x4
+# SEC32-NEXT: Size: 0x4
+# SEC32-NEXT: RawDataOffset: 0x68
+# SEC32-NEXT: RelocationPointer: 0x6C
+# SEC32-NEXT: LineNumberPointer: 0x0
+# SEC32-NEXT: NumberOfRelocations: 1
+# SEC32-NEXT: NumberOfLineNumbers: 0
+# SEC32-NEXT: Type: STYP_DATA (0x40)
+# SEC32-NEXT: }
+# SEC32-NEXT:]
+--- !XCOFF
+FileHeader:
+ MagicNumber: [[MAGIC=0x1DF]]
+Sections:
+ - Name: .text
+ Flags: [ STYP_TEXT ]
+ SectionData: "1234"
+ - Name: .data
+ Flags: [ STYP_DATA ]
+ SectionData: "5678"
+ Relocations:
+ - Address: 0x80
+ Symbol: 0x21
+ Info: 0x1F
+ Type: 0x0
-# SEC64: File: {{.*}}basic64.o
-# SEC64-NEXT: Format: aix5coff64-rs6000
-# SEC64-NEXT: Arch: powerpc64
-# SEC64-NEXT: AddressSize: 64bit
-# SEC64-NEXT: Sections [
-# SEC64-NEXT: Section {
-# SEC64-NEXT: Index: 1
-# SEC64-NEXT: Name: .text
-# SEC64-NEXT: PhysicalAddress: 0x0
-# SEC64-NEXT: VirtualAddress: 0x0
-# SEC64-NEXT: Size: 0x100
-# SEC64-NEXT: RawDataOffset: 0x200
-# SEC64-NEXT: RelocationPointer: 0x3C4
-# SEC64-NEXT: LineNumberPointer: 0x0
-# SEC64-NEXT: NumberOfRelocations: 9
-# SEC64-NEXT: NumberOfLineNumbers: 0
-# SEC64-NEXT: Type: STYP_TEXT (0x20)
-# SEC64-NEXT: }
-# SEC64-NEXT: Section {
-# SEC64-NEXT: Index: 2
-# SEC64-NEXT: Name: .data
-# SEC64-NEXT: PhysicalAddress: 0x100
-# SEC64-NEXT: VirtualAddress: 0x100
-# SEC64-NEXT: Size: 0xC0
-# SEC64-NEXT: RawDataOffset: 0x300
-# SEC64-NEXT: RelocationPointer: 0x442
-# SEC64-NEXT: LineNumberPointer: 0x0
-# SEC64-NEXT: NumberOfRelocations: 19
-# SEC64-NEXT: NumberOfLineNumbers: 0
-# SEC64-NEXT: Type: STYP_DATA (0x40)
-# SEC64-NEXT: }
-# SEC64-NEXT: Section {
-# SEC64-NEXT: Index: 3
-# SEC64-NEXT: Name: .bss
-# SEC64-NEXT: PhysicalAddress: 0x1C0
-# SEC64-NEXT: VirtualAddress: 0x1C0
-# SEC64-NEXT: Size: 0x8
-# SEC64-NEXT: RawDataOffset: 0x0
-# SEC64-NEXT: RelocationPointer: 0x0
-# SEC64-NEXT: LineNumberPointer: 0x0
-# SEC64-NEXT: NumberOfRelocations: 0
-# SEC64-NEXT: NumberOfLineNumbers: 0
-# SEC64-NEXT: Type: STYP_BSS (0x80)
-# SEC64-NEXT: }
-# SEC64-NEXT: Section {
-# SEC64-NEXT: Index: 4
-# SEC64-NEXT: Name: .tdata
-# SEC64-NEXT: PhysicalAddress: 0x0
-# SEC64-NEXT: VirtualAddress: 0x0
-# SEC64-NEXT: Size: 0x4
-# SEC64-NEXT: RawDataOffset: 0x3C0
-# SEC64-NEXT: RelocationPointer: 0x54C
-# SEC64-NEXT: LineNumberPointer: 0x0
-# SEC64-NEXT: NumberOfRelocations: 0
-# SEC64-NEXT: NumberOfLineNumbers: 0
-# SEC64-NEXT: Type: STYP_TDATA (0x400)
-# SEC64-NEXT: }
-# SEC64-NEXT: Section {
-# SEC64-NEXT: Index: 5
-# SEC64-NEXT: Name: .tbss
-# SEC64-NEXT: PhysicalAddress: 0x4
-# SEC64-NEXT: VirtualAddress: 0x4
-# SEC64-NEXT: Size: 0x8
-# SEC64-NEXT: RawDataOffset: 0x0
-# SEC64-NEXT: RelocationPointer: 0x0
-# SEC64-NEXT: LineNumberPointer: 0x0
-# SEC64-NEXT: NumberOfRelocations: 0
-# SEC64-NEXT: NumberOfLineNumbers: 0
-# SEC64-NEXT: Type: STYP_TBSS (0x800)
-# SEC64-NEXT: }
-# SEC64-NEXT: ]
+# RUN: yaml2obj -DMAGIC=0x01F7 %s -o %t2
+# RUN: llvm-readobj --section-headers %t2 | \
+# RUN: FileCheck --strict-whitespace --match-full-lines --check-prefix=SEC64 %s
+# SEC64:Format: aix5coff64-rs6000
+# SEC64-NEXT:Arch: powerpc64
+# SEC64-NEXT:AddressSize: 64bit
+# SEC64-NEXT:Sections [
+# SEC64-NEXT: Section {
+# SEC64-NEXT: Index: 1
+# SEC64-NEXT: Name: .text
+# SEC64-NEXT: PhysicalAddress: 0x0
+# SEC64-NEXT: VirtualAddress: 0x0
+# SEC64-NEXT: Size: 0x4
+# SEC64-NEXT: RawDataOffset: 0xA8
+# SEC64-NEXT: RelocationPointer: 0x0
+# SEC64-NEXT: LineNumberPointer: 0x0
+# SEC64-NEXT: NumberOfRelocations: 0
+# SEC64-NEXT: NumberOfLineNumbers: 0
+# SEC64-NEXT: Type: STYP_TEXT (0x20)
+# SEC64-NEXT: }
+# SEC64-NEXT: Section {
+# SEC64-NEXT: Index: 2
+# SEC64-NEXT: Name: .data
+# SEC64-NEXT: PhysicalAddress: 0x4
+# SEC64-NEXT: VirtualAddress: 0x4
+# SEC64-NEXT: Size: 0x4
+# SEC64-NEXT: RawDataOffset: 0xAC
+# SEC64-NEXT: RelocationPointer: 0xB0
+# SEC64-NEXT: LineNumberPointer: 0x0
+# SEC64-NEXT: NumberOfRelocations: 1
+# SEC64-NEXT: NumberOfLineNumbers: 0
+# SEC64-NEXT: Type: STYP_DATA (0x40)
+# SEC64-NEXT: }
+# SEC64-NEXT:]
More information about the llvm-commits
mailing list