[PowerPC] Force entry alignment in .got2
authorHal Finkel <hfinkel@anl.gov>
Tue, 30 Aug 2016 01:43:38 +0000 (01:43 +0000)
committerHal Finkel <hfinkel@anl.gov>
Tue, 30 Aug 2016 01:43:38 +0000 (01:43 +0000)
Implement Bill's suggested fix for 32-bit targets for PR22711 (for the
alignment of each entry). As pointed out in the bug report, we could just force
the section alignment, since we only add pointer-sized things currently, but
this fix is somewhat more future-proof.

llvm-svn: 280049

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/test/CodeGen/PowerPC/ppc32-pic-large.ll

index 5040f16..5bdec80 100644 (file)
@@ -1146,10 +1146,12 @@ bool PPCLinuxAsmPrinter::doFinalization(Module &M) {
          E = TOC.end(); I != E; ++I) {
       OutStreamer->EmitLabel(I->second);
       MCSymbol *S = I->first;
-      if (isPPC64)
+      if (isPPC64) {
         TS.emitTCEntry(*S);
-      else
+      } else {
+        OutStreamer->EmitValueToAlignment(4);
         OutStreamer->EmitSymbolValue(S, 4);
+      }
     }
   }
 
index 6a06945..bc1d0a5 100644 (file)
@@ -26,4 +26,5 @@ entry:
 ; LARGE-BSS-DAG:     stw {{[0-9]+}}, 8(1)
 ; LARGE-BSS:         lwz 30, -8(1)
 ; LARGE-BSS:       [[VREF]]:
+; LARGE-BSS-NEXT:     .p2align 2
 ; LARGE-BSS-NEXT:    .long bar