Skip to content

Commit bee70bf

Browse files
committed
[XCOFF][AIX] Fix incorrect alignment for function descriptor csect
Summary: Function descriptor csect on AIX should be 4 byte align instead of 1 byte align. Reviewer: daltenty Differential Revision: https://reviews.llvm.org/D74974
1 parent 6369b9b commit bee70bf

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1547,9 +1547,10 @@ void PPCLinuxAsmPrinter::emitFunctionBodyEnd() {
15471547
void PPCAIXAsmPrinter::SetupMachineFunction(MachineFunction &MF) {
15481548
// Get the function descriptor symbol.
15491549
CurrentFnDescSym = getSymbol(&MF.getFunction());
1550-
// Set the containing csect.
1550+
// Set the alignment and the containing csect.
15511551
MCSectionXCOFF *FnDescSec = cast<MCSectionXCOFF>(
15521552
getObjFileLowering().getSectionForFunctionDescriptor(CurrentFnDescSym));
1553+
FnDescSec->setAlignment(Align(Subtarget->isPPC64() ? 8 : 4));
15531554
cast<MCSymbolXCOFF>(CurrentFnDescSym)->setContainingCsect(FnDescSec);
15541555

15551556
return AsmPrinter::SetupMachineFunction(MF);

llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ entry:
6363
; CHECK-NEXT: SectionLen: 12
6464
; CHECK-NEXT: ParameterHashIndex: 0x0
6565
; CHECK-NEXT: TypeChkSectNum: 0x0
66-
; CHECK-NEXT: SymbolAlignmentLog2: 0
66+
; CHECK-NEXT: SymbolAlignmentLog2: 2
6767
; CHECK-NEXT: SymbolType: XTY_SD (0x1)
6868
; CHECK-NEXT: StorageMappingClass: XMC_DS (0xA)
6969
; CHECK-NEXT: StabInfoIndex: 0x0

llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ declare i32 @bar(i32)
318318
; SYM-NEXT: SectionLen: 12
319319
; SYM-NEXT: ParameterHashIndex: 0x0
320320
; SYM-NEXT: TypeChkSectNum: 0x0
321-
; SYM-NEXT: SymbolAlignmentLog2: 0
321+
; SYM-NEXT: SymbolAlignmentLog2: 2
322322
; SYM-NEXT: SymbolType: XTY_SD (0x1)
323323
; SYM-NEXT: StorageMappingClass: XMC_DS (0xA)
324324
; SYM-NEXT: StabInfoIndex: 0x0

0 commit comments

Comments
 (0)