[PATCH] D44848: Align stubs for external and common global variables to pointer size.

Rahul Chaudhry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 16:14:11 PDT 2018


rahulchaudhry updated this revision to Diff 140355.
rahulchaudhry added a comment.

Minimized test case.


Repository:
  rL LLVM

https://reviews.llvm.org/D44848

Files:
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  test/CodeGen/X86/catch.ll


Index: test/CodeGen/X86/catch.ll
===================================================================
--- test/CodeGen/X86/catch.ll
+++ test/CodeGen/X86/catch.ll
@@ -3,7 +3,10 @@
 ; PR18390
 ; We used to assert creating this label. The name itself is not critical. It
 ; just needs to be a unique local symbol.
-; CHECK:      .L.Lstr.DW.stub:
+; PR36885
+; The stub symbol should have pointer-size (8 byte) alignment.
+; CHECK:      .data{{[[:space:]]}} .p2align 3
+; CHECK-NEXT: .L.Lstr.DW.stub:
 ; CHECK-NEXT: .quad   .Lstr
 
 @str = private unnamed_addr constant [12 x i8] c"NSException\00"
Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1336,6 +1336,7 @@
       OutStreamer->SwitchSection(TLOF.getDataSection());
       const DataLayout &DL = M.getDataLayout();
 
+      EmitAlignment(Log2_32(DL.getPointerSize()));
       for (const auto &Stub : Stubs) {
         OutStreamer->EmitLabel(Stub.first);
         OutStreamer->EmitSymbolValue(Stub.second.getPointer(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44848.140355.patch
Type: text/x-patch
Size: 1122 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180329/ba359e54/attachment.bin>


More information about the llvm-commits mailing list