[llvm] de20a3b - [XCOFF] support XCOFFObjectWriter for fileHeader and sectionHeaders in 64-bit XCOFF.
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 20 06:31:53 PDT 2022
Author: esmeyi
Date: 2022-03-20T09:31:29-04:00
New Revision: de20a3b6775252889eab60942461109b0a17269d
URL: https://github.com/llvm/llvm-project/commit/de20a3b6775252889eab60942461109b0a17269d
DIFF: https://github.com/llvm/llvm-project/commit/de20a3b6775252889eab60942461109b0a17269d.diff
LOG: [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
Added:
Modified:
llvm/lib/MC/XCOFFObjectWriter.cpp
llvm/test/CodeGen/PowerPC/aix-available-externally-linkage.ll
llvm/test/CodeGen/PowerPC/aix-extern-weak.ll
llvm/test/CodeGen/PowerPC/aix-extern.ll
llvm/test/CodeGen/PowerPC/aix-func-align.ll
llvm/test/CodeGen/PowerPC/aix-internal.ll
llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll
llvm/test/CodeGen/PowerPC/aix-overflow-toc.py
llvm/test/CodeGen/PowerPC/aix-return55.ll
llvm/test/CodeGen/PowerPC/aix-tls-xcoff-variables.ll
llvm/test/CodeGen/PowerPC/aix-user-defined-memcpy.ll
llvm/test/CodeGen/PowerPC/aix-weak.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-data-only-notoc.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-externL.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-huge-relocs.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-lower-comm.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-toc.ll
llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll
Removed:
################################################################################
diff --git a/llvm/lib/MC/XCOFFObjectWriter.cpp b/llvm/lib/MC/XCOFFObjectWriter.cpp
index 8e695acf28b40..ea3bad4e31145 100644
--- a/llvm/lib/MC/XCOFFObjectWriter.cpp
+++ b/llvm/lib/MC/XCOFFObjectWriter.cpp
@@ -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);
-
- 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.
-
- W.write<uint16_t>(Sec->RelocationCount);
- W.write<uint16_t>(0); // NumberOfLineNumbers. Not supported yet.
- W.write<int32_t>(Sec->Flags);
+ writeWord(IsDwarf ? 0 : Sec->Address);
+ writeWord(IsDwarf ? 0 : Sec->Address);
+
+ writeWord(Sec->Size);
+ writeWord(Sec->FileOffsetToData);
+ writeWord(Sec->FileOffsetToRelocations);
+ writeWord(0); // FileOffsetToLineNumberInfo. Not supported yet.
+
+ 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;
diff --git a/llvm/test/CodeGen/PowerPC/aix-available-externally-linkage.ll b/llvm/test/CodeGen/PowerPC/aix-available-externally-linkage.ll
index a0201f6351502..7b2f948afb2a4 100644
--- a/llvm/test/CodeGen/PowerPC/aix-available-externally-linkage.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-available-externally-linkage.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-extern-weak.ll b/llvm/test/CodeGen/PowerPC/aix-extern-weak.ll
index f7e2fcd5d7cbc..c9aca7ca22222 100644
--- a/llvm/test/CodeGen/PowerPC/aix-extern-weak.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-extern-weak.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-extern.ll b/llvm/test/CodeGen/PowerPC/aix-extern.ll
index 1ff330286a480..e63300e2ac442 100644
--- a/llvm/test/CodeGen/PowerPC/aix-extern.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-extern.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-func-align.ll b/llvm/test/CodeGen/PowerPC/aix-func-align.ll
index fb95f2c5c4e5f..bdafb5469d13e 100644
--- a/llvm/test/CodeGen/PowerPC/aix-func-align.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-func-align.ll
@@ -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:
diff --git a/llvm/test/CodeGen/PowerPC/aix-internal.ll b/llvm/test/CodeGen/PowerPC/aix-internal.ll
index 6f3ce858f6e85..790315e0210e7 100644
--- a/llvm/test/CodeGen/PowerPC/aix-internal.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-internal.ll
@@ -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.
diff --git a/llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll b/llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll
index 44be6c65dcc61..2ff48aa0a6d76 100644
--- a/llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll
@@ -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 }
diff --git a/llvm/test/CodeGen/PowerPC/aix-overflow-toc.py b/llvm/test/CodeGen/PowerPC/aix-overflow-toc.py
index 026c80105e1a1..8d88722681509 100644
--- a/llvm/test/CodeGen/PowerPC/aix-overflow-toc.py
+++ b/llvm/test/CodeGen/PowerPC/aix-overflow-toc.py
@@ -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):
diff --git a/llvm/test/CodeGen/PowerPC/aix-return55.ll b/llvm/test/CodeGen/PowerPC/aix-return55.ll
index 19e8322f8f8a2..3328786f9e03d 100644
--- a/llvm/test/CodeGen/PowerPC/aix-return55.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-return55.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-variables.ll b/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-variables.ll
index 28cc3c0668a62..7f536e7a96013 100644
--- a/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-variables.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-variables.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-user-defined-memcpy.ll b/llvm/test/CodeGen/PowerPC/aix-user-defined-memcpy.ll
index 097eb302e4161..7742e1a3ac552 100644
--- a/llvm/test/CodeGen/PowerPC/aix-user-defined-memcpy.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-user-defined-memcpy.ll
@@ -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.
diff --git a/llvm/test/CodeGen/PowerPC/aix-weak.ll b/llvm/test/CodeGen/PowerPC/aix-weak.ll
index f703b49fa8f19..e23ebf0bd5d63 100644
--- a/llvm/test/CodeGen/PowerPC/aix-weak.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-weak.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-data-only-notoc.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-data-only-notoc.ll
index a1f1f12f96870..fd94cc434405c 100644
--- a/llvm/test/CodeGen/PowerPC/aix-xcoff-data-only-notoc.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-data-only-notoc.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll
index 462a1b7a6f113..a59863423b436 100644
--- a/llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll
@@ -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: ]
diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-externL.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-externL.ll
index 3674b75683d55..9773bf63daeee 100644
--- a/llvm/test/CodeGen/PowerPC/aix-xcoff-externL.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-externL.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-huge-relocs.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-huge-relocs.ll
index 43eae034fe6e7..78490fe598a05 100644
--- a/llvm/test/CodeGen/PowerPC/aix-xcoff-huge-relocs.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-huge-relocs.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll
index a937ba5f7bd45..fd3a682e9f7ca 100644
--- a/llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-lower-comm.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-lower-comm.ll
index 3ec5bfcb1d8b8..4755ca18d8aa3 100644
--- a/llvm/test/CodeGen/PowerPC/aix-xcoff-lower-comm.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-lower-comm.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
index 1bbc12c5a3af5..7cf20b5ac7052 100644
--- a/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll
index 3f8290ddee6ee..6fa1d220e11fc 100644
--- a/llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-toc.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-toc.ll
index a60e8047b37a7..dac811a0014e1 100644
--- a/llvm/test/CodeGen/PowerPC/aix-xcoff-toc.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-toc.ll
@@ -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
diff --git a/llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll b/llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll
index d5e7a0e0fe02c..e4d717c035be4 100644
--- a/llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll
+++ b/llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll
@@ -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" }
More information about the llvm-commits
mailing list