[XCOFF] support XCOFFObjectWriter for fileHeader and sectionHeaders in 64-bit XCOFF.

This is the first patch to enable the XCOFF64 object writer.
Currently only fileHeader and sectionHeaders are supported.

Reviewed By: jhenderson, DiggerLin

Differential Revision: https://reviews.llvm.org/D120861
This commit is contained in:
esmeyi 2022-03-20 09:31:29 -04:00
parent 9d6a6fbbbd
commit de20a3b677
22 changed files with 149 additions and 131 deletions

View File

@ -78,8 +78,8 @@ struct Symbol {
struct XCOFFSection {
const MCSectionXCOFF *const MCSec;
uint32_t SymbolTableIndex;
uint32_t Address;
uint32_t Size;
uint64_t Address;
uint64_t Size;
SmallVector<Symbol, 1> Syms;
SmallVector<XCOFFRelocation, 1> Relocations;
@ -101,10 +101,10 @@ struct SectionEntry {
char Name[XCOFF::NameSize];
// The physical/virtual address of the section. For an object file
// these values are equivalent.
uint32_t Address;
uint32_t Size;
uint32_t FileOffsetToData;
uint32_t FileOffsetToRelocations;
uint64_t Address;
uint64_t Size;
uint64_t FileOffsetToData;
uint64_t FileOffsetToRelocations;
uint32_t RelocationCount;
int32_t Flags;
@ -190,9 +190,9 @@ struct DwarfSectionEntry : public SectionEntry {
class XCOFFObjectWriter : public MCObjectWriter {
uint32_t SymbolTableEntryCount = 0;
uint32_t SymbolTableOffset = 0;
uint64_t SymbolTableOffset = 0;
uint16_t SectionCount = 0;
uint32_t RelocationEntryOffset = 0;
uint64_t RelocationEntryOffset = 0;
support::endian::Writer W;
std::unique_ptr<MCXCOFFObjectTargetWriter> TargetObjectWriter;
@ -295,10 +295,8 @@ class XCOFFObjectWriter : public MCObjectWriter {
void assignAddressesAndIndices(const MCAsmLayout &);
void finalizeSectionInfo();
bool
needsAuxiliaryHeader() const { /* TODO aux header support not implemented. */
return false;
}
// TODO aux header support not implemented.
bool needsAuxiliaryHeader() const { return false; }
// Returns the size of the auxiliary header to be written to the object file.
size_t auxiliaryHeaderSize() const {
@ -310,6 +308,10 @@ class XCOFFObjectWriter : public MCObjectWriter {
public:
XCOFFObjectWriter(std::unique_ptr<MCXCOFFObjectTargetWriter> MOTW,
raw_pwrite_stream &OS);
void writeWord(uint64_t Word) {
is64Bit() ? W.write<uint64_t>(Word) : W.write<uint32_t>(Word);
}
};
XCOFFObjectWriter::XCOFFObjectWriter(
@ -413,9 +415,6 @@ static MCSectionXCOFF *getContainingCsect(const MCSymbolXCOFF *XSym) {
void XCOFFObjectWriter::executePostLayoutBinding(MCAssembler &Asm,
const MCAsmLayout &Layout) {
if (is64Bit())
report_fatal_error("64-bit XCOFF object files are not supported yet.");
for (const auto &S : Asm) {
const auto *MCSec = cast<const MCSectionXCOFF>(&S);
assert(SectionMap.find(MCSec) == SectionMap.end() &&
@ -624,20 +623,20 @@ uint64_t XCOFFObjectWriter::writeObject(MCAssembler &Asm,
if (Asm.isIncrementalLinkerCompatible())
report_fatal_error("Incremental linking not supported for XCOFF.");
if (is64Bit())
report_fatal_error("64-bit XCOFF object files are not supported yet.");
finalizeSectionInfo();
uint64_t StartOffset = W.OS.tell();
writeFileHeader();
writeSectionHeaderTable();
writeSections(Asm, Layout);
writeRelocations();
writeSymbolTable(Layout);
// Write the string table.
Strings.write(W.OS);
if (!is64Bit()) {
writeSections(Asm, Layout);
writeRelocations();
writeSymbolTable(Layout);
// Write the string table.
Strings.write(W.OS);
}
return W.OS.tell() - StartOffset;
}
@ -734,18 +733,24 @@ void XCOFFObjectWriter::writeSymbolEntryForControlSection(
}
void XCOFFObjectWriter::writeFileHeader() {
assert(!is64Bit() && "Writing 64-bit file header is not yet supported.");
W.write<uint16_t>(XCOFF::XCOFF32);
W.write<uint16_t>(is64Bit() ? XCOFF::XCOFF64 : XCOFF::XCOFF32);
W.write<uint16_t>(SectionCount);
W.write<int32_t>(0); // TimeStamp
W.write<uint32_t>(SymbolTableOffset);
W.write<int32_t>(SymbolTableEntryCount);
W.write<uint16_t>(0); // AuxHeaderSize
W.write<uint16_t>(0); // Flags
writeWord(SymbolTableOffset);
if (is64Bit()) {
W.write<uint16_t>(0); // AuxHeaderSize. No optional header for an object
// file that is not to be loaded.
W.write<uint16_t>(0); // Flags
W.write<int32_t>(0); // SymbolTableEntryCount. Not supported yet.
} else {
W.write<int32_t>(SymbolTableEntryCount);
W.write<uint16_t>(0); // AuxHeaderSize. No optional header for an object
// file that is not to be loaded.
W.write<uint16_t>(0); // Flags
}
}
void XCOFFObjectWriter::writeSectionHeaderTable() {
assert(!is64Bit() && "Writing 64-bit section headers is not yet supported.");
auto writeSectionHeader = [&](const SectionEntry *Sec, bool IsDwarf) {
// Nothing to write for this Section.
if (Sec->Index == SectionEntry::UninitializedIndex)
@ -758,17 +763,24 @@ void XCOFFObjectWriter::writeSectionHeaderTable() {
// Write the Physical Address and Virtual Address. In an object file these
// are the same.
// We use 0 for DWARF sections' Physical and Virtual Addresses.
W.write<uint32_t>(IsDwarf ? 0 : Sec->Address);
W.write<uint32_t>(IsDwarf ? 0 : Sec->Address);
writeWord(IsDwarf ? 0 : Sec->Address);
writeWord(IsDwarf ? 0 : Sec->Address);
W.write<uint32_t>(Sec->Size);
W.write<uint32_t>(Sec->FileOffsetToData);
W.write<uint32_t>(Sec->FileOffsetToRelocations);
W.write<uint32_t>(0); // FileOffsetToLineNumberInfo. Not supported yet.
writeWord(Sec->Size);
writeWord(Sec->FileOffsetToData);
writeWord(Sec->FileOffsetToRelocations);
writeWord(0); // FileOffsetToLineNumberInfo. Not supported yet.
W.write<uint16_t>(Sec->RelocationCount);
W.write<uint16_t>(0); // NumberOfLineNumbers. Not supported yet.
W.write<int32_t>(Sec->Flags);
if (is64Bit()) {
W.write<uint32_t>(0); // NumberOfRelocations. Not yet supported in 64-bit.
W.write<uint32_t>(0); // NumberOfLineNumbers. Not supported yet.
W.write<int32_t>(Sec->Flags);
W.OS.write_zeros(4);
} else {
W.write<uint16_t>(Sec->RelocationCount);
W.write<uint16_t>(0); // NumberOfLineNumbers. Not supported yet.
W.write<int32_t>(Sec->Flags);
}
return true;
};
@ -1031,8 +1043,13 @@ void XCOFFObjectWriter::assignAddressesAndIndices(const MCAsmLayout &Layout) {
SymbolTableEntryCount = SymbolTableIndex;
// Calculate the RawPointer value for each section.
uint64_t RawPointer = XCOFF::FileHeaderSize32 + auxiliaryHeaderSize() +
SectionCount * XCOFF::SectionHeaderSize32;
uint64_t RawPointer =
(is64Bit() ? (XCOFF::FileHeaderSize64 +
SectionCount * XCOFF::SectionHeaderSize64)
: (XCOFF::FileHeaderSize32 +
SectionCount * XCOFF::SectionHeaderSize32)) +
auxiliaryHeaderSize();
for (auto *Sec : Sections) {
if (Sec->Index == SectionEntry::UninitializedIndex || Sec->IsVirtual)
continue;

View File

@ -11,10 +11,7 @@
; RUN: llvm-readobj --symbols %t.o | \
; RUN: FileCheck --check-prefix=XCOFF32 %s
; RUN: not --crash llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff \
; RUN: -mcpu=pwr4 -mattr=-altivec -filetype=obj -o %t.o 2>&1 < %s | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@_ZN3Foo1aE = available_externally constant i32 -1

View File

@ -8,11 +8,7 @@
; RUN: -mattr=-altivec -data-sections=false -xcoff-traceback-table=false -filetype=obj -o %t.o < %s
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefix=CHECKSYM %s
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff \
; RUN: -mattr=-altivec -data-sections=false -xcoff-traceback-table=false -filetype=obj -o %t.o 2>&1 < %s | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@foo_ext_weak_p = global void (...)* bitcast (void ()* @foo_ext_weak_ref to void (...)*)
@b_w = extern_weak global i32

View File

@ -8,9 +8,7 @@
; RUN: -mattr=-altivec -data-sections=false -xcoff-traceback-table=false -filetype=obj -o %t.o < %s
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefix=CHECKSYM %s
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff \
; RUN: -mattr=-altivec -data-sections=false -xcoff-traceback-table=false -filetype=obj -o %t.o 2>&1 < %s | FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@bar_p = global i32 (...)* @bar_ref, align 4
@b_e = external global i32, align 4

View File

@ -9,9 +9,7 @@
; RUN: -xcoff-traceback-table=false -filetype=obj -o %t.o < %s
; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYMS %s
; RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj < %s 2>&1 | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
define i32 @foo() align 32 {
entry:

View File

@ -1,8 +1,8 @@
; RUN: llc -mtriple powerpc-ibm-aix -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec \
; RUN: -filetype=obj -o %t.o < %s
; RUN: llvm-readobj --syms %t.o | FileCheck %s
; RUN: not --crash llc -mtriple powerpc64-ibm-aix -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec \
; RUN: -filetype=obj -o %t.o < %s 2>&1 | FileCheck --check-prefix=64-CHECK %s
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
define internal i32 @foo() {
ret i32 1
@ -34,5 +34,3 @@ define internal i32 @foo() {
; Make sure no label is emitted.
; CHECK-NOT: Name: foo
;64-CHECK: LLVM ERROR: 64-bit XCOFF object files are not supported yet.

View File

@ -9,10 +9,7 @@
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefix=CHECKSYM %s
; RUN: llvm-objdump -r -d --symbol-description %t.o | FileCheck --check-prefix=CHECKRELOC %s
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff \
; RUN: -mattr=-altivec -filetype=obj -o %t.o 2>&1 < %s | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
%struct.S = type { i32, i32 }

View File

@ -11,10 +11,7 @@
# RUN: -filetype=obj -o %t.o < %t.ll
# RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS32 %s
# RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff -data-sections=false \
# RUN: -mcpu=pwr4 -mattr=-altivec -filetype=obj -o %t.o 2>&1 < %t.ll | \
# RUN: FileCheck --check-prefix=XCOFF64 %s
# XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
## FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
numentries = 12290
for x in range(0, numentries):

View File

@ -5,9 +5,7 @@
; RUN: llvm-objdump -D %t.o | FileCheck --check-prefix=CHECKOBJ %s
; RUN: llvm-readobj -S %t.o | FileCheck --check-prefix=CHECKSECT %s
; RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj < %s 2>&1 | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@a = global i64 320255973571806, align 8
@d = global double 5.000000e+00, align 8

View File

@ -10,8 +10,7 @@
; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefixes=SYMS,SYMS-NODATASECT %s
; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck --check-prefixes=OBJDUMP-NODATASECT %s
; RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj < %s 2>&1 | FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
; SECTION: File: {{.*}}aix-tls-xcoff-variables.ll.tmp.o
; SECTION-NEXT: Format: aixcoff-rs6000

View File

@ -1,20 +1,17 @@
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
; RUN: -mattr=-altivec -filetype=obj -xcoff-traceback-table=false -o %t.o < %s
; RUN: -mattr=-altivec -filetype=obj -xcoff-traceback-table=false -o %t.o < %s
; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=32-SYM %s
; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck \
; RUN: --check-prefix=32-REL %s
; RUN: --check-prefix=32-REL %s
; RUN: llvm-objdump -D %t.o | FileCheck --check-prefix=32-DIS %s
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff \
; RUN: -mcpu=pwr4 -mattr=-altivec < %s | \
; RUN: FileCheck %s
; RUN: -mcpu=pwr4 -mattr=-altivec < %s | FileCheck %s
; RUN: not --crash llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff \
; RUN: -mcpu=pwr4 -mattr=-altivec -filetype=obj < %s 2>&1 | FileCheck \
; RUN: --check-prefix=64-CHECK %s
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
; Test verifies:
; If there exists a user-defined function whose name is the same as the
@ -117,5 +114,3 @@ declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture r
; 32-DIS-NEXT: 28: 80 01 00 08 lwz 0, 8(1)
; 32-DIS-NEXT: 2c: 7c 08 03 a6 mtlr 0
; 32-DIS-NEXT: 30: 4e 80 00 20 blr
; 64-CHECK: LLVM ERROR: 64-bit XCOFF object files are not supported yet.

View File

@ -1,17 +1,14 @@
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -xcoff-traceback-table=false -mcpu=pwr4 \
; RUN: -mattr=-altivec -data-sections=false < %s | FileCheck --check-prefixes=COMMON,BIT32 %s
; RUN: -mattr=-altivec -data-sections=false < %s | FileCheck --check-prefixes=COMMON,BIT32 %s
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -xcoff-traceback-table=false -mcpu=pwr4 \
; RUN: -mattr=-altivec -data-sections=false < %s | FileCheck --check-prefixes=COMMON,BIT64 %s
; RUN: -mattr=-altivec -data-sections=false < %s | FileCheck --check-prefixes=COMMON,BIT64 %s
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -xcoff-traceback-table=false -mcpu=pwr4 \
; RUN: -mattr=-altivec -data-sections=false -filetype=obj -o %t.o < %s
; RUN: -mattr=-altivec -data-sections=false -filetype=obj -o %t.o < %s
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefix=CHECKSYM %s
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff \
; RUN: -mattr=-altivec -data-sections=false -filetype=obj -o %t.o 2>&1 < %s | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@foo_weak_p = global void (...)* bitcast (void ()* @foo_ref_weak to void (...)*), align 4
@b = weak global i32 0, align 4

View File

@ -4,9 +4,7 @@
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYMS %s
; RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj < %s 2>&1 | \
; RUN: FileCheck --check-prefix=OBJ64 %s
; OBJ64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@a = external global i32, align 4
@b = external global i64, align 8

View File

@ -6,12 +6,13 @@
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -data-sections=false -filetype=obj -o %t.o < %s
; RUN: llvm-readobj --section-headers --file-header %t.o | \
; RUN: FileCheck --check-prefix=OBJ %s
; RUN: FileCheck --check-prefix=OBJ %s
; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYMS %s
; RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff -data-sections=false -filetype=obj < %s 2>&1 | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -data-sections=false -filetype=obj -o %t64.o < %s
; RUN: llvm-readobj --section-headers --file-header %t64.o | \
; RUN: FileCheck --check-prefix=OBJ64 %s
@ivar = local_unnamed_addr global i32 35, align 4
@llvar = local_unnamed_addr global i64 36, align 8
@ -681,3 +682,58 @@
; SYMS-NEXT: }
; SYMS-NEXT: }
; SYMS: ]
; OBJ64: Format: aix5coff64-rs6000
; OBJ64-NEXT: Arch: powerpc64
; OBJ64-NEXT: AddressSize: 64bit
; OBJ64-NEXT: FileHeader {
; OBJ64-NEXT: Magic: 0x1F7
; OBJ64-NEXT: NumberOfSections: 3
; OBJ64-NEXT: TimeStamp: None (0x0)
; OBJ64-NEXT: SymbolTableOffset: 0x170
; OBJ64-NEXT: SymbolTableEntries: 0
; OBJ64-NEXT: OptionalHeaderSize: 0x0
; OBJ64-NEXT: Flags: 0x0
; OBJ64-NEXT: }
; OBJ64: Sections [
; OBJ64-NEXT: Section {
; OBJ64-NEXT: Index: [[#OBJ64_INDX:]]
; OBJ64-NEXT: Name: .text
; OBJ64-NEXT: PhysicalAddress: 0x0
; OBJ64-NEXT: VirtualAddress: 0x0
; OBJ64-NEXT: Size: 0x0
; OBJ64-NEXT: RawDataOffset: 0xF0
; OBJ64-NEXT: RelocationPointer: 0x0
; OBJ64-NEXT: LineNumberPointer: 0x0
; OBJ64-NEXT: NumberOfRelocations: 0
; OBJ64-NEXT: NumberOfLineNumbers: 0
; OBJ64-NEXT: Type: STYP_TEXT (0x20)
; OBJ64-NEXT: }
; OBJ64-NEXT: Section {
; OBJ64-NEXT: Index: [[#OBJ64_INDX+1]]
; OBJ64-NEXT: Name: .data
; OBJ64-NEXT: PhysicalAddress: 0x0
; OBJ64-NEXT: VirtualAddress: 0x0
; OBJ64-NEXT: Size: 0x80
; OBJ64-NEXT: RawDataOffset: 0xF0
; OBJ64-NEXT: RelocationPointer: 0x0
; OBJ64-NEXT: LineNumberPointer: 0x0
; OBJ64-NEXT: NumberOfRelocations: 0
; OBJ64-NEXT: NumberOfLineNumbers: 0
; OBJ64-NEXT: Type: STYP_DATA (0x40)
; OBJ64-NEXT: }
; OBJ64-NEXT: Section {
; OBJ64-NEXT: Index: [[#OBJ64_INDX+2]]
; OBJ64-NEXT: Name: .bss
; OBJ64-NEXT: PhysicalAddress: 0x80
; OBJ64-NEXT: VirtualAddress: 0x80
; OBJ64-NEXT: Size: 0x6C
; OBJ64-NEXT: RawDataOffset: 0x0
; OBJ64-NEXT: RelocationPointer: 0x0
; OBJ64-NEXT: LineNumberPointer: 0x0
; OBJ64-NEXT: NumberOfRelocations: 0
; OBJ64-NEXT: NumberOfLineNumbers: 0
; OBJ64-NEXT: Type: STYP_BSS (0x80)
; OBJ64-NEXT: }
; OBJ64-NEXT: ]

View File

@ -8,10 +8,7 @@
; RUN: llvm-readobj --symbols %t.o | \
; RUN: FileCheck --check-prefix=XCOFF32 %s
; RUN: not --crash llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff \
; RUN: -mcpu=pwr4 -mattr=-altivec -filetype=obj -o %t.o 2>&1 < %s | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@La = external global i32, align 4

View File

@ -20,13 +20,7 @@
; RUN: -mcpu=pwr4 -mattr=-altivec -filetype=obj -o %t.o %t.ll
; RUN: llvm-readobj --section-headers %t.o | FileCheck --check-prefix=XCOFF32 %s
; RUN: not --crash llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff \
; RUN: -mcpu=pwr4 -mattr=-altivec -filetype=obj -o %t.o %t.overflow.ll 2>&1 | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; RUN: not --crash llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff \
; RUN: -mcpu=pwr4 -mattr=-altivec -filetype=obj -o %t.o %t.ll 2>&1 | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@c = external global i8, align 1
@arr = global [SIZE x i8*] [MACRO], align 8

View File

@ -3,12 +3,10 @@
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
; RUN: llvm-readobj --section-headers --file-header %t.o | \
; RUN: FileCheck --check-prefix=OBJ %s
; RUN: FileCheck --check-prefix=OBJ %s
; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYMS %s
; RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj < %s 2>&1 | \
; RUN: FileCheck --check-prefix=OBJ64 %s
; OBJ64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@a = internal global i32 0, align 4
@b = internal global i64 0, align 8

View File

@ -6,10 +6,7 @@
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -data-sections=false -filetype=obj -o %t.o < %s
; RUN: llvm-readobj -r --expand-relocs --syms %t.o | FileCheck --check-prefixes=RELOC,SYM %s
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff \
; RUN: -data-sections=false -filetype=obj < %s 2>&1 | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@common = common global i32 0, align 4
@pointer = global i32* @common, align 4

View File

@ -1,15 +1,13 @@
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -mattr=-altivec \
; RUN: -xcoff-traceback-table=false -data-sections=false -filetype=obj -o %t.o < %s
; RUN: llvm-readobj --section-headers --file-header %t.o | \
; RUN: FileCheck --check-prefix=OBJ %s
; RUN: FileCheck --check-prefix=OBJ %s
; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck --check-prefix=RELOC %s
; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYM %s
; RUN: llvm-objdump -D %t.o | FileCheck --check-prefix=DIS %s
; RUN: llvm-objdump -r %t.o | FileCheck --check-prefix=DIS_REL %s
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff -mattr=-altivec -data-sections=false -filetype=obj < %s 2>&1 | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@globalA = global i32 1, align 4
@globalB = global i32 2, align 4

View File

@ -5,13 +5,11 @@
; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple powerpc-ibm-aix-xcoff -data-sections=false -filetype=obj -o %t.o < %s
; RUN: llvm-readobj --section-headers --file-header %t.o | \
; RUN: FileCheck --check-prefix=OBJ %s
; RUN: FileCheck --check-prefix=OBJ %s
; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYMS %s
; RUN: llvm-objdump -D %t.o | FileCheck --check-prefix=DIS %s
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr7 -mtriple powerpc64-ibm-aix-xcoff -data-sections=false -filetype=obj < %s 2>&1 | \
; RUN: FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@const_ivar = constant i32 35, align 4
@const_llvar = constant i64 36, align 8

View File

@ -9,9 +9,7 @@
; RUN: --xcoff-traceback-table=false -filetype=obj -o %t.o < %s
; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYM %s
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc64-ibm-aix-xcoff -filetype=obj -o %t.o 2>&1 \
; RUN: < %s | FileCheck --check-prefix=XCOFF64 %s
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@a = external global i32, align 4
@b = external global i64, align 8

View File

@ -2,10 +2,8 @@
; RUN: not --crash llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff \
; RUN: -verify-machineinstrs < %s 2>&1 | \
; RUN: FileCheck %s --check-prefix=OBJ32
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s | FileCheck %s
; RUN: not --crash llc -filetype=obj -mtriple powerpc64-ibm-aix-xcoff \
; RUN: -verify-machineinstrs < %s 2>&1 | \
; RUN: FileCheck %s --check-prefix=OBJ64
;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
@i = external global i32, align 4 #0
@ -20,6 +18,5 @@ define i32* @get() {
; CHECK-NEXT: .extern i[TD]
; OBJ32: LLVM ERROR: toc-data not yet supported when writing object files.
; OBJ64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
attributes #0 = { "toc-data" }