mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[XCOFF][AIX] Check linkage on the function, and two fixes for comments
This is a follow up commit to address post-commit comment in D70443 Differential revision: https://reviews.llvm.org/D70443
This commit is contained in:
parent
5fa4ad5707
commit
dd53195fe6
@ -574,7 +574,7 @@ void XCOFFObjectWriter::assignAddressesAndIndices(const MCAsmLayout &Layout) {
|
||||
// yet, so start at index 0.
|
||||
uint32_t SymbolTableIndex = 0;
|
||||
|
||||
// Calculate undefined symbol's indices.
|
||||
// Calculate indices for undefined symbols.
|
||||
for (auto &Csect : UndefinedCsects) {
|
||||
Csect.Size = 0;
|
||||
Csect.Address = 0;
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
||||
#include "llvm/CodeGen/TargetInstrInfo.h"
|
||||
#include "llvm/CodeGen/TargetLowering.h"
|
||||
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
|
||||
#include "llvm/CodeGen/TargetRegisterInfo.h"
|
||||
#include "llvm/CodeGen/ValueTypes.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
@ -5326,16 +5327,19 @@ SDValue PPCTargetLowering::FinishCall(
|
||||
GlobalAddressSDNode *G = cast<GlobalAddressSDNode>(Callee);
|
||||
auto &Context = DAG.getMachineFunction().getMMI().getContext();
|
||||
|
||||
const GlobalObject *GO = cast<GlobalObject>(G->getGlobal());
|
||||
MCSymbolXCOFF *S = cast<MCSymbolXCOFF>(Context.getOrCreateSymbol(
|
||||
Twine(".") + Twine(G->getGlobal()->getName())));
|
||||
Twine(".") + Twine(GO->getName())));
|
||||
|
||||
const GlobalValue *GV = G->getGlobal();
|
||||
if (GV && GV->isDeclaration() && !S->hasContainingCsect()) {
|
||||
// On AIX, undefined symbol need to associate with a MCSectionXCOFF to
|
||||
// get the correct storage mapping class. In this case, XCOFF::XMC_PR.
|
||||
if (GO && GO->isDeclaration() && !S->hasContainingCsect()) {
|
||||
// On AIX, an undefined symbol needs to be associated with a
|
||||
// MCSectionXCOFF to get the correct storage mapping class.
|
||||
// In this case, XCOFF::XMC_PR.
|
||||
const XCOFF::StorageClass SC =
|
||||
TargetLoweringObjectFileXCOFF::getStorageClassForGlobal(GO);
|
||||
MCSectionXCOFF *Sec =
|
||||
Context.getXCOFFSection(S->getName(), XCOFF::XMC_PR, XCOFF::XTY_ER,
|
||||
XCOFF::C_EXT, SectionKind::getMetadata());
|
||||
SC, SectionKind::getMetadata());
|
||||
S->setContainingCsect(Sec);
|
||||
}
|
||||
|
||||
|
30
test/CodeGen/PowerPC/aix-weak-undef-func-call.ll
Normal file
30
test/CodeGen/PowerPC/aix-weak-undef-func-call.ll
Normal file
@ -0,0 +1,30 @@
|
||||
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
|
||||
; RUN: llvm-readobj --symbols %t.o | FileCheck %s
|
||||
|
||||
define void @bar() {
|
||||
entry:
|
||||
call void bitcast (void (...)* @foo to void ()*)()
|
||||
ret void
|
||||
}
|
||||
|
||||
declare extern_weak void @foo(...)
|
||||
|
||||
;CHECK: Symbol {
|
||||
;CHECK: Name: .foo
|
||||
;CHECK-NEXT: Value (RelocatableAddress): 0x0
|
||||
;CHECK-NEXT: Section: N_UNDEF
|
||||
;CHECK-NEXT: Type: 0x0
|
||||
;CHECK-NEXT: StorageClass: C_WEAKEXT (0x6F)
|
||||
;CHECK-NEXT: NumberOfAuxEntries: 1
|
||||
;CHECK-NEXT: CSECT Auxiliary Entry {
|
||||
;CHECK: SectionLen: 0
|
||||
;CHECK-NEXT: ParameterHashIndex: 0x0
|
||||
;CHECK-NEXT: TypeChkSectNum: 0x0
|
||||
;CHECK-NEXT: SymbolAlignmentLog2: 0
|
||||
;CHECK-NEXT: SymbolType: XTY_ER (0x0)
|
||||
;CHECK-NEXT: StorageMappingClass: XMC_PR (0x0)
|
||||
;CHECK-NEXT: StabInfoIndex: 0x0
|
||||
;CHECK-NEXT: StabSectNum: 0x0
|
||||
;CHECK-NEXT: }
|
||||
;CHECK-NEXT: }
|
||||
|
Loading…
x
Reference in New Issue
Block a user