[llvm] 5ce0a26 - [XCOFF] handle the toc-data for object file generation.
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 11 20:28:21 PST 2023
Author: esmeyi
Date: 2023-01-11T23:27:47-05:00
New Revision: 5ce0a26bd1cd7fb3d815fd5f03c55dcdac5482c4
URL: https://github.com/llvm/llvm-project/commit/5ce0a26bd1cd7fb3d815fd5f03c55dcdac5482c4
DIFF: https://github.com/llvm/llvm-project/commit/5ce0a26bd1cd7fb3d815fd5f03c55dcdac5482c4.diff
LOG: [XCOFF] handle the toc-data for object file generation.
Summary: The toc-data feature has been supported for assembly file generation.
This patch handles the toc-data for object file generation.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D139516
Added:
Modified:
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/lib/MC/XCOFFObjectWriter.cpp
llvm/test/CodeGen/PowerPC/basic-toc-data-def.ll
llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll
llvm/test/CodeGen/PowerPC/toc-data-const.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index b2d56adfbeab3..e760564779c28 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -2292,16 +2292,16 @@ TargetLoweringObjectFileXCOFF::getTargetSymbol(const GlobalValue *GV,
// function entry point. We choose to always return a function descriptor
// here.
if (const GlobalObject *GO = dyn_cast<GlobalObject>(GV)) {
+ if (GO->isDeclarationForLinker())
+ return cast<MCSectionXCOFF>(getSectionForExternalReference(GO, TM))
+ ->getQualNameSymbol();
+
if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV))
if (GVar->hasAttribute("toc-data"))
return cast<MCSectionXCOFF>(
SectionForGlobal(GVar, SectionKind::getData(), TM))
->getQualNameSymbol();
- if (GO->isDeclarationForLinker())
- return cast<MCSectionXCOFF>(getSectionForExternalReference(GO, TM))
- ->getQualNameSymbol();
-
SectionKind GOKind = getKindForGlobal(GO, TM);
if (GOKind.isText())
return cast<MCSectionXCOFF>(
@@ -2360,6 +2360,10 @@ MCSection *TargetLoweringObjectFileXCOFF::getSectionForExternalReference(
if (GO->isThreadLocal())
SMC = XCOFF::XMC_UL;
+ if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GO))
+ if (GVar->hasAttribute("toc-data"))
+ SMC = XCOFF::XMC_TD;
+
// Externals go into a csect of type ER.
return getContext().getXCOFFSection(
Name, SectionKind::getMetadata(),
diff --git a/llvm/lib/MC/XCOFFObjectWriter.cpp b/llvm/lib/MC/XCOFFObjectWriter.cpp
index 0657ed2156593..ab6acf085e7bc 100644
--- a/llvm/lib/MC/XCOFFObjectWriter.cpp
+++ b/llvm/lib/MC/XCOFFObjectWriter.cpp
@@ -467,13 +467,12 @@ CsectGroup &XCOFFObjectWriter::getCsectGroup(const MCSectionXCOFF *MCSec) {
return TOCCsects;
case XCOFF::XMC_TC:
case XCOFF::XMC_TE:
+ case XCOFF::XMC_TD:
assert(XCOFF::XTY_SD == MCSec->getCSectType() &&
"Only an initialized csect can contain TC entry.");
assert(!TOCCsects.empty() &&
"We should at least have a TOC-base in this CsectGroup.");
return TOCCsects;
- case XCOFF::XMC_TD:
- report_fatal_error("toc-data not yet supported when writing object files.");
default:
report_fatal_error("Unhandled mapping of csect to section.");
}
@@ -617,10 +616,6 @@ void XCOFFObjectWriter::recordRelocation(MCAssembler &Asm,
TargetObjectWriter->getRelocTypeAndSignSize(Target, Fixup, IsPCRel);
const MCSectionXCOFF *SymASec = getContainingCsect(cast<MCSymbolXCOFF>(SymA));
-
- if (SymASec->isCsect() && SymASec->getMappingClass() == XCOFF::XMC_TD)
- report_fatal_error("toc-data not yet supported when writing object files.");
-
assert(SectionMap.find(SymASec) != SectionMap.end() &&
"Expected containing csect to exist in map.");
@@ -636,15 +631,24 @@ void XCOFFObjectWriter::recordRelocation(MCAssembler &Asm,
FixedValue = 0;
else if (Type == XCOFF::RelocationType::R_TOC ||
Type == XCOFF::RelocationType::R_TOCL) {
- // The FixedValue should be the TOC entry offset from the TOC-base plus any
- // constant offset value.
- const int64_t TOCEntryOffset = SectionMap[SymASec]->Address -
- TOCCsects.front().Address +
- Target.getConstant();
- if (Type == XCOFF::RelocationType::R_TOC && !isInt<16>(TOCEntryOffset))
- report_fatal_error("TOCEntryOffset overflows in small code model mode");
-
- FixedValue = TOCEntryOffset;
+ // For non toc-data external symbols, R_TOC type relocation will relocate to
+ // data symbols that have XCOFF::XTY_SD type csect. For toc-data external
+ // symbols, R_TOC type relocation will relocate to data symbols that have
+ // XCOFF_ER type csect. For XCOFF_ER kind symbols, there will be no TOC
+ // entry for them, so the FixedValue should always be 0.
+ if (SymASec->getCSectType() == XCOFF::XTY_ER) {
+ FixedValue = 0;
+ } else {
+ // The FixedValue should be the TOC entry offset from the TOC-base plus
+ // any constant offset value.
+ const int64_t TOCEntryOffset = SectionMap[SymASec]->Address -
+ TOCCsects.front().Address +
+ Target.getConstant();
+ if (Type == XCOFF::RelocationType::R_TOC && !isInt<16>(TOCEntryOffset))
+ report_fatal_error("TOCEntryOffset overflows in small code model mode");
+
+ FixedValue = TOCEntryOffset;
+ }
} else if (Type == XCOFF::RelocationType::R_RBR) {
MCSectionXCOFF *ParentSec = cast<MCSectionXCOFF>(Fragment->getParent());
assert((SymASec->getMappingClass() == XCOFF::XMC_PR &&
diff --git a/llvm/test/CodeGen/PowerPC/basic-toc-data-def.ll b/llvm/test/CodeGen/PowerPC/basic-toc-data-def.ll
index b331416304a7e..2d2c09cc17abc 100644
--- a/llvm/test/CodeGen/PowerPC/basic-toc-data-def.ll
+++ b/llvm/test/CodeGen/PowerPC/basic-toc-data-def.ll
@@ -1,20 +1,97 @@
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s | FileCheck %s
-; RUN: not --crash llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff \
-; RUN: -verify-machineinstrs < %s 2>&1 | \
-; RUN: FileCheck %s --check-prefix=OBJ
-
; 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=OBJ
+
+; RUN: llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s -o %t32.o
+; RUN: llvm-readobj %t32.o --syms | FileCheck %s --check-prefix=OBJ32
+; RUN: llc -filetype=obj -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s -o %t64.o
+; RUN: llvm-readobj %t64.o --syms | FileCheck %s --check-prefix=OBJ64
@i = global i32 55, align 4 #0
attributes #0 = { "toc-data" }
+
; CHECK: .toc
; CHECK-NEXT: .csect i[TD],2
; CHECK-NEXT: .globl i[TD]
; CHECK-NEXT: .align 2
; CHECK-NEXT: .vbyte 4, 55
-; OBJ: LLVM ERROR: toc-data not yet supported when writing object files.
+; OBJ32: Symbol {
+; OBJ32: Index: 3
+; OBJ32-NEXT: Name: TOC
+; OBJ32-NEXT: Value (RelocatableAddress): 0x0
+; OBJ32-NEXT: Section: .data
+; OBJ32-NEXT: Type: 0x0
+; OBJ32-NEXT: StorageClass: C_HIDEXT (0x6B)
+; OBJ32-NEXT: NumberOfAuxEntries: 1
+; OBJ32-NEXT: CSECT Auxiliary Entry {
+; OBJ32-NEXT: Index: 4
+; OBJ32-NEXT: SectionLen: 0
+; OBJ32-NEXT: ParameterHashIndex: 0x0
+; OBJ32-NEXT: TypeChkSectNum: 0x0
+; OBJ32-NEXT: SymbolAlignmentLog2: 2
+; OBJ32-NEXT: SymbolType: XTY_SD (0x1)
+; OBJ32-NEXT: StorageMappingClass: XMC_TC0 (0xF)
+; OBJ32-NEXT: StabInfoIndex: 0x0
+; OBJ32-NEXT: StabSectNum: 0x0
+; OBJ32-NEXT: }
+; OBJ32-NEXT: }
+; OBJ32-NEXT: Symbol {
+; OBJ32-NEXT: Index: 5
+; OBJ32-NEXT: Name: i
+; OBJ32-NEXT: Value (RelocatableAddress): 0x0
+; OBJ32-NEXT: Section: .data
+; OBJ32-NEXT: Type: 0x0
+; OBJ32-NEXT: StorageClass: C_EXT (0x2)
+; OBJ32-NEXT: NumberOfAuxEntries: 1
+; OBJ32-NEXT: CSECT Auxiliary Entry {
+; OBJ32-NEXT: Index: 6
+; OBJ32-NEXT: SectionLen: 4
+; OBJ32-NEXT: ParameterHashIndex: 0x0
+; OBJ32-NEXT: TypeChkSectNum: 0x0
+; OBJ32-NEXT: SymbolAlignmentLog2: 2
+; OBJ32-NEXT: SymbolType: XTY_SD (0x1)
+; OBJ32-NEXT: StorageMappingClass: XMC_TD (0x10)
+; OBJ32-NEXT: StabInfoIndex: 0x0
+; OBJ32-NEXT: StabSectNum: 0x0
+; OBJ32-NEXT: }
+; OBJ32-NEXT: }
+
+; OBJ64: Symbol {
+; OBJ64: Index: 3
+; OBJ64-NEXT: Name: TOC
+; OBJ64-NEXT: Value (RelocatableAddress): 0x0
+; OBJ64-NEXT: Section: .data
+; OBJ64-NEXT: Type: 0x0
+; OBJ64-NEXT: StorageClass: C_HIDEXT (0x6B)
+; OBJ64-NEXT: NumberOfAuxEntries: 1
+; OBJ64-NEXT: CSECT Auxiliary Entry {
+; OBJ64-NEXT: Index: 4
+; OBJ64-NEXT: SectionLen: 0
+; OBJ64-NEXT: ParameterHashIndex: 0x0
+; OBJ64-NEXT: TypeChkSectNum: 0x0
+; OBJ64-NEXT: SymbolAlignmentLog2: 2
+; OBJ64-NEXT: SymbolType: XTY_SD (0x1)
+; OBJ64-NEXT: StorageMappingClass: XMC_TC0 (0xF)
+; OBJ64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
+; OBJ64-NEXT: }
+; OBJ64-NEXT: }
+; OBJ64-NEXT: Symbol {
+; OBJ64-NEXT: Index: 5
+; OBJ64-NEXT: Name: i
+; OBJ64-NEXT: Value (RelocatableAddress): 0x0
+; OBJ64-NEXT: Section: .data
+; OBJ64-NEXT: Type: 0x0
+; OBJ64-NEXT: StorageClass: C_EXT (0x2)
+; OBJ64-NEXT: NumberOfAuxEntries: 1
+; OBJ64-NEXT: CSECT Auxiliary Entry {
+; OBJ64-NEXT: Index: 6
+; OBJ64-NEXT: SectionLen: 4
+; OBJ64-NEXT: ParameterHashIndex: 0x0
+; OBJ64-NEXT: TypeChkSectNum: 0x0
+; OBJ64-NEXT: SymbolAlignmentLog2: 2
+; OBJ64-NEXT: SymbolType: XTY_SD (0x1)
+; OBJ64-NEXT: StorageMappingClass: XMC_TD (0x10)
+; OBJ64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
+; OBJ64-NEXT: }
+; OBJ64-NEXT: }
diff --git a/llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll b/llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll
index dd151bba9dd7c..04a2bfbf2dd44 100644
--- a/llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll
+++ b/llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll
@@ -1,12 +1,10 @@
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s | FileCheck %s
-; RUN: not --crash llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff \
-; RUN: -verify-machineinstrs < %s 2>&1 | \
-; RUN: FileCheck %s --check-prefix=OBJ
-
; 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=OBJ
+
+; RUN: llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s -o %t32.o
+; RUN: llvm-readobj %t32.o --syms --relocs | FileCheck %s --check-prefix=OBJ32
+; RUN: llc -filetype=obj -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s -o %t64.o
+; RUN: llvm-readobj %t64.o --syms --relocs | FileCheck %s --check-prefix=OBJ64
@i = external global i32, align 4 #0
@@ -16,10 +14,108 @@ define ptr @get() {
ret ptr @i
}
+attributes #0 = { "toc-data" }
+
; CHECK: la 3, i[TD](2)
; CHECK: .toc
; CHECK-NEXT: .extern i[TD]
-; OBJ: LLVM ERROR: toc-data not yet supported when writing object files.
+; OBJ32: Relocations [
+; OBJ32-NEXT: Section (index: 1) .text {
+; OBJ32-NEXT: 0x2 R_TOC i(1) 0xF
+; OBJ32-NEXT: }
+; OBJ32-NEXT: Section (index: 2) .data {
+; OBJ32-NEXT: 0x20 R_POS .get(5) 0x1F
+; OBJ32-NEXT: 0x24 R_POS TOC(9) 0x1F
+; OBJ32-NEXT: }
+; OBJ32-NEXT: ]
-attributes #0 = { "toc-data" }
+; OBJ32: Symbol {
+; OBJ32: Index: 1
+; OBJ32-NEXT: Name: i
+; OBJ32-NEXT: Value (RelocatableAddress): 0x0
+; OBJ32-NEXT: Section: N_UNDEF
+; OBJ32-NEXT: Type: 0x0
+; OBJ32-NEXT: StorageClass: C_EXT (0x2)
+; OBJ32-NEXT: NumberOfAuxEntries: 1
+; OBJ32-NEXT: CSECT Auxiliary Entry {
+; OBJ32-NEXT: Index: 2
+; OBJ32-NEXT: SectionLen: 0
+; OBJ32-NEXT: ParameterHashIndex: 0x0
+; OBJ32-NEXT: TypeChkSectNum: 0x0
+; OBJ32-NEXT: SymbolAlignmentLog2: 0
+; OBJ32-NEXT: SymbolType: XTY_ER (0x0)
+; OBJ32-NEXT: StorageMappingClass: XMC_TD (0x10)
+; OBJ32-NEXT: StabInfoIndex: 0x0
+; OBJ32-NEXT: StabSectNum: 0x0
+; OBJ32-NEXT: }
+; OBJ32-NEXT: }
+; OBJ32: Symbol {
+; OBJ32: Index: 9
+; OBJ32-NEXT: Name: TOC
+; OBJ32-NEXT: Value (RelocatableAddress): 0x2C
+; OBJ32-NEXT: Section: .data
+; OBJ32-NEXT: Type: 0x0
+; OBJ32-NEXT: StorageClass: C_HIDEXT (0x6B)
+; OBJ32-NEXT: NumberOfAuxEntries: 1
+; OBJ32-NEXT: CSECT Auxiliary Entry {
+; OBJ32-NEXT: Index: 10
+; OBJ32-NEXT: SectionLen: 0
+; OBJ32-NEXT: ParameterHashIndex: 0x0
+; OBJ32-NEXT: TypeChkSectNum: 0x0
+; OBJ32-NEXT: SymbolAlignmentLog2: 2
+; OBJ32-NEXT: SymbolType: XTY_SD (0x1)
+; OBJ32-NEXT: StorageMappingClass: XMC_TC0 (0xF)
+; OBJ32-NEXT: StabInfoIndex: 0x0
+; OBJ32-NEXT: StabSectNum: 0x0
+; OBJ32-NEXT: }
+; OBJ32-NEXT: }
+
+; OBJ64: Relocations [
+; OBJ64-NEXT: Section (index: 1) .text {
+; OBJ64-NEXT: 0x2 R_TOC i(1) 0xF
+; OBJ64-NEXT: }
+; OBJ64-NEXT: Section (index: 2) .data {
+; OBJ64-NEXT: 0x20 R_POS .get(5) 0x3F
+; OBJ64-NEXT: 0x28 R_POS TOC(9) 0x3F
+; OBJ64-NEXT: }
+; OBJ64-NEXT: ]
+
+; OBJ64: Symbol {
+; OBJ64: Index: 1
+; OBJ64-NEXT: Name: i
+; OBJ64-NEXT: Value (RelocatableAddress): 0x0
+; OBJ64-NEXT: Section: N_UNDEF
+; OBJ64-NEXT: Type: 0x0
+; OBJ64-NEXT: StorageClass: C_EXT (0x2)
+; OBJ64-NEXT: NumberOfAuxEntries: 1
+; OBJ64-NEXT: CSECT Auxiliary Entry {
+; OBJ64-NEXT: Index: 2
+; OBJ64-NEXT: SectionLen: 0
+; OBJ64-NEXT: ParameterHashIndex: 0x0
+; OBJ64-NEXT: TypeChkSectNum: 0x0
+; OBJ64-NEXT: SymbolAlignmentLog2: 0
+; OBJ64-NEXT: SymbolType: XTY_ER (0x0)
+; OBJ64-NEXT: StorageMappingClass: XMC_TD (0x10)
+; OBJ64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
+; OBJ64-NEXT: }
+; OBJ64-NEXT: }
+; OBJ64: Symbol {
+; OBJ64: Index: 9
+; OBJ64-NEXT: Name: TOC
+; OBJ64-NEXT: Value (RelocatableAddress): 0x38
+; OBJ64-NEXT: Section: .data
+; OBJ64-NEXT: Type: 0x0
+; OBJ64-NEXT: StorageClass: C_HIDEXT (0x6B)
+; OBJ64-NEXT: NumberOfAuxEntries: 1
+; OBJ64-NEXT: CSECT Auxiliary Entry {
+; OBJ64-NEXT: Index: 10
+; OBJ64-NEXT: SectionLen: 0
+; OBJ64-NEXT: ParameterHashIndex: 0x0
+; OBJ64-NEXT: TypeChkSectNum: 0x0
+; OBJ64-NEXT: SymbolAlignmentLog2: 2
+; OBJ64-NEXT: SymbolType: XTY_SD (0x1)
+; OBJ64-NEXT: StorageMappingClass: XMC_TC0 (0xF)
+; OBJ64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
+; OBJ64-NEXT: }
+; OBJ64-NEXT: }
diff --git a/llvm/test/CodeGen/PowerPC/toc-data-const.ll b/llvm/test/CodeGen/PowerPC/toc-data-const.ll
index 5d126ca44af83..740032e26a432 100644
--- a/llvm/test/CodeGen/PowerPC/toc-data-const.ll
+++ b/llvm/test/CodeGen/PowerPC/toc-data-const.ll
@@ -1,6 +1,14 @@
; RUN: llc -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck %s --check-prefix CHECK
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck %s --check-prefix CHECK
+; RUN: llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s -o %t32.o
+; RUN: llvm-readobj %t32.o --syms --relocs | FileCheck %s --check-prefix=OBJ32
+; RUN: llvm-objdump %t32.o -dr | FileCheck %s --check-prefix=DIS32
+
+; RUN: llc -filetype=obj -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s -o %t64.o
+; RUN: llvm-readobj %t64.o --syms --relocs | FileCheck %s --check-prefix=OBJ64
+; RUN: llvm-objdump %t64.o -dr | FileCheck %s --check-prefix=DIS64
+
@i1 = external constant i32 #0
@i2 = constant ptr @i1 #0
@@ -13,6 +21,8 @@ define ptr @retptr() {
ret ptr @i2
}
+attributes #0 = { "toc-data" }
+
; CHECK: .read:
; CHECK: la 3, i1[TD](2)
@@ -23,4 +33,163 @@ define ptr @retptr() {
; CHECK: .extern i1[TD]
; CHECK: .csect i2[TD]
-attributes #0 = { "toc-data" }
+; OBJ32: Relocations [
+; OBJ32-NEXT: Section (index: 1) .text {
+; OBJ32-NEXT: 0x2 R_TOC i1(1) 0xF
+; OBJ32-NEXT: 0x26 R_TOC i2(15) 0xF
+; OBJ32-NEXT: }
+; OBJ32-NEXT: Section (index: 2) .data {
+; OBJ32-NEXT: 0x44 R_POS .read(5) 0x1F
+; OBJ32-NEXT: 0x48 R_POS TOC(13) 0x1F
+; OBJ32-NEXT: 0x50 R_POS .retptr(7) 0x1F
+; OBJ32-NEXT: 0x54 R_POS TOC(13) 0x1F
+; OBJ32-NEXT: 0x5C R_POS i1(1) 0x1F
+; OBJ32-NEXT: }
+; OBJ32-NEXT: ]
+
+; OBJ32: Symbol {
+; OBJ32: Index: 1
+; OBJ32-NEXT: Name: i1
+; OBJ32-NEXT: Value (RelocatableAddress): 0x0
+; OBJ32-NEXT: Section: N_UNDEF
+; OBJ32-NEXT: Type: 0x0
+; OBJ32-NEXT: StorageClass: C_EXT (0x2)
+; OBJ32-NEXT: NumberOfAuxEntries: 1
+; OBJ32-NEXT: CSECT Auxiliary Entry {
+; OBJ32-NEXT: Index: 2
+; OBJ32-NEXT: SectionLen: 0
+; OBJ32-NEXT: ParameterHashIndex: 0x0
+; OBJ32-NEXT: TypeChkSectNum: 0x0
+; OBJ32-NEXT: SymbolAlignmentLog2: 0
+; OBJ32-NEXT: SymbolType: XTY_ER (0x0)
+; OBJ32-NEXT: StorageMappingClass: XMC_TD (0x10)
+; OBJ32-NEXT: StabInfoIndex: 0x0
+; OBJ32-NEXT: StabSectNum: 0x0
+; OBJ32-NEXT: }
+; OBJ32-NEXT: }
+; OBJ32: Symbol {
+; OBJ32: Index: 13
+; OBJ32-NEXT: Name: TOC
+; OBJ32-NEXT: Value (RelocatableAddress): 0x5C
+; OBJ32-NEXT: Section: .data
+; OBJ32-NEXT: Type: 0x0
+; OBJ32-NEXT: StorageClass: C_HIDEXT (0x6B)
+; OBJ32-NEXT: NumberOfAuxEntries: 1
+; OBJ32-NEXT: CSECT Auxiliary Entry {
+; OBJ32-NEXT: Index: 14
+; OBJ32-NEXT: SectionLen: 0
+; OBJ32-NEXT: ParameterHashIndex: 0x0
+; OBJ32-NEXT: TypeChkSectNum: 0x0
+; OBJ32-NEXT: SymbolAlignmentLog2: 2
+; OBJ32-NEXT: SymbolType: XTY_SD (0x1)
+; OBJ32-NEXT: StorageMappingClass: XMC_TC0 (0xF)
+; OBJ32-NEXT: StabInfoIndex: 0x0
+; OBJ32-NEXT: StabSectNum: 0x0
+; OBJ32-NEXT: }
+; OBJ32-NEXT: }
+; OBJ32: Symbol {
+; OBJ32: Index: 15
+; OBJ32-NEXT: Name: i2
+; OBJ32-NEXT: Value (RelocatableAddress): 0x5C
+; OBJ32-NEXT: Section: .data
+; OBJ32-NEXT: Type: 0x0
+; OBJ32-NEXT: StorageClass: C_EXT (0x2)
+; OBJ32-NEXT: NumberOfAuxEntries: 1
+; OBJ32-NEXT: CSECT Auxiliary Entry {
+; OBJ32-NEXT: Index: 16
+; OBJ32-NEXT: SectionLen: 4
+; OBJ32-NEXT: ParameterHashIndex: 0x0
+; OBJ32-NEXT: TypeChkSectNum: 0x0
+; OBJ32-NEXT: SymbolAlignmentLog2: 2
+; OBJ32-NEXT: SymbolType: XTY_SD (0x1)
+; OBJ32-NEXT: StorageMappingClass: XMC_TD (0x10)
+; OBJ32-NEXT: StabInfoIndex: 0x0
+; OBJ32-NEXT: StabSectNum: 0x0
+; OBJ32-NEXT: }
+; OBJ32-NEXT: }
+
+; OBJ64: Relocations [
+; OBJ64-NEXT: Section (index: 1) .text {
+; OBJ64-NEXT: 0x2 R_TOC i1(1) 0xF
+; OBJ64-NEXT: 0x26 R_TOC i2(15) 0xF
+; OBJ64-NEXT: }
+; OBJ64-NEXT: Section (index: 2) .data {
+; OBJ64-NEXT: 0x48 R_POS .read(5) 0x3F
+; OBJ64-NEXT: 0x50 R_POS TOC(13) 0x3F
+; OBJ64-NEXT: 0x60 R_POS .retptr(7) 0x3F
+; OBJ64-NEXT: 0x68 R_POS TOC(13) 0x3F
+; OBJ64-NEXT: 0x78 R_POS i1(1) 0x3F
+; OBJ64-NEXT: }
+; OBJ64-NEXT: ]
+
+; OBJ64: Symbol {
+; OBJ64: Index: 1
+; OBJ64-NEXT: Name: i1
+; OBJ64-NEXT: Value (RelocatableAddress): 0x0
+; OBJ64-NEXT: Section: N_UNDEF
+; OBJ64-NEXT: Type: 0x0
+; OBJ64-NEXT: StorageClass: C_EXT (0x2)
+; OBJ64-NEXT: NumberOfAuxEntries: 1
+; OBJ64-NEXT: CSECT Auxiliary Entry {
+; OBJ64-NEXT: Index: 2
+; OBJ64-NEXT: SectionLen: 0
+; OBJ64-NEXT: ParameterHashIndex: 0x0
+; OBJ64-NEXT: TypeChkSectNum: 0x0
+; OBJ64-NEXT: SymbolAlignmentLog2: 0
+; OBJ64-NEXT: SymbolType: XTY_ER (0x0)
+; OBJ64-NEXT: StorageMappingClass: XMC_TD (0x10)
+; OBJ64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
+; OBJ64-NEXT: }
+; OBJ64-NEXT: }
+; OBJ64: Symbol {
+; OBJ64: Index: 13
+; OBJ64-NEXT: Name: TOC
+; OBJ64-NEXT: Value (RelocatableAddress): 0x78
+; OBJ64-NEXT: Section: .data
+; OBJ64-NEXT: Type: 0x0
+; OBJ64-NEXT: StorageClass: C_HIDEXT (0x6B)
+; OBJ64-NEXT: NumberOfAuxEntries: 1
+; OBJ64-NEXT: CSECT Auxiliary Entry {
+; OBJ64-NEXT: Index: 14
+; OBJ64-NEXT: SectionLen: 0
+; OBJ64-NEXT: ParameterHashIndex: 0x0
+; OBJ64-NEXT: TypeChkSectNum: 0x0
+; OBJ64-NEXT: SymbolAlignmentLog2: 2
+; OBJ64-NEXT: SymbolType: XTY_SD (0x1)
+; OBJ64-NEXT: StorageMappingClass: XMC_TC0 (0xF)
+; OBJ64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
+; OBJ64-NEXT: }
+; OBJ64-NEXT: }
+; OBJ64: Symbol {
+; OBJ64: Index: 15
+; OBJ64-NEXT: Name: i2
+; OBJ64-NEXT: Value (RelocatableAddress): 0x78
+; OBJ64-NEXT: Section: .data
+; OBJ64-NEXT: Type: 0x0
+; OBJ64-NEXT: StorageClass: C_EXT (0x2)
+; OBJ64-NEXT: NumberOfAuxEntries: 1
+; OBJ64-NEXT: CSECT Auxiliary Entry {
+; OBJ64-NEXT: Index: 16
+; OBJ64-NEXT: SectionLen: 8
+; OBJ64-NEXT: ParameterHashIndex: 0x0
+; OBJ64-NEXT: TypeChkSectNum: 0x0
+; OBJ64-NEXT: SymbolAlignmentLog2: 3
+; OBJ64-NEXT: SymbolType: XTY_SD (0x1)
+; OBJ64-NEXT: StorageMappingClass: XMC_TD (0x10)
+; OBJ64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
+; OBJ64-NEXT: }
+; OBJ64-NEXT: }
+
+; DIS32: 00000000 <.read>:
+; DIS32-NEXT: 0: 38 62 00 00 addi 3, 2, 0
+; DIS32-NEXT: 00000002: R_TOC i1
+; DIS32: 00000024 <.retptr>:
+; DIS32-NEXT: 24: 38 62 00 00 addi 3, 2, 0
+; DIS32-NEXT: 00000026: R_TOC i2
+
+; DIS64: 0000000000000000 <.read>:
+; DIS64-NEXT: 0: 38 62 00 00 addi 3, 2, 0
+; DIS64-NEXT: 0000000000000002: R_TOC i1
+; DIS64: 0000000000000024 <.retptr>:
+; DIS64-NEXT: 24: 38 62 00 00 addi 3, 2, 0
+; DIS64-NEXT: 0000000000000026: R_TOC i2
More information about the llvm-commits
mailing list