[llvm] bee70bf - [XCOFF][AIX] Fix incorrect alignment for function descriptor csect

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 10:15:41 PST 2020


Author: jasonliu
Date: 2020-02-24T18:15:17Z
New Revision: bee70bfff0f41a1cea5010276cf4a6229c2c3b93

URL: https://github.com/llvm/llvm-project/commit/bee70bfff0f41a1cea5010276cf4a6229c2c3b93
DIFF: https://github.com/llvm/llvm-project/commit/bee70bfff0f41a1cea5010276cf4a6229c2c3b93.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
    llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll
    llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 00ffc120ce00..885c625557d5 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -1547,9 +1547,10 @@ void PPCLinuxAsmPrinter::emitFunctionBodyEnd() {
 void PPCAIXAsmPrinter::SetupMachineFunction(MachineFunction &MF) {
   // Get the function descriptor symbol.
   CurrentFnDescSym = getSymbol(&MF.getFunction());
-  // Set the containing csect.
+  // Set the alignment and the containing csect.
   MCSectionXCOFF *FnDescSec = cast<MCSectionXCOFF>(
       getObjFileLowering().getSectionForFunctionDescriptor(CurrentFnDescSym));
+  FnDescSec->setAlignment(Align(Subtarget->isPPC64() ? 8 : 4));
   cast<MCSymbolXCOFF>(CurrentFnDescSym)->setContainingCsect(FnDescSec);
 
   return AsmPrinter::SetupMachineFunction(MF);

diff  --git a/llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll b/llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll
index 29b2d4c454c4..d983c8de54a9 100644
--- a/llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll
@@ -63,7 +63,7 @@ entry:
 ; CHECK-NEXT:       SectionLen: 12
 ; CHECK-NEXT:       ParameterHashIndex: 0x0
 ; CHECK-NEXT:       TypeChkSectNum: 0x0
-; CHECK-NEXT:       SymbolAlignmentLog2: 0
+; CHECK-NEXT:       SymbolAlignmentLog2: 2
 ; CHECK-NEXT:       SymbolType: XTY_SD (0x1)
 ; CHECK-NEXT:       StorageMappingClass: XMC_DS (0xA)
 ; CHECK-NEXT:       StabInfoIndex: 0x0

diff  --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
index 0b8f43f9c791..1cb4c1f3e32b 100644
--- a/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
@@ -318,7 +318,7 @@ declare i32 @bar(i32)
 ; SYM-NEXT:       SectionLen: 12
 ; SYM-NEXT:       ParameterHashIndex: 0x0
 ; SYM-NEXT:       TypeChkSectNum: 0x0
-; SYM-NEXT:       SymbolAlignmentLog2: 0
+; SYM-NEXT:       SymbolAlignmentLog2: 2
 ; SYM-NEXT:       SymbolType: XTY_SD (0x1)
 ; SYM-NEXT:       StorageMappingClass: XMC_DS (0xA)
 ; SYM-NEXT:       StabInfoIndex: 0x0


        


More information about the llvm-commits mailing list