[llvm] r329030 - Align stubs for external and common global variables to pointer size.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 2 16:20:31 PDT 2018
Author: rafael
Date: Mon Apr 2 16:20:30 2018
New Revision: 329030
URL: http://llvm.org/viewvc/llvm-project?rev=329030&view=rev
Log:
Align stubs for external and common global variables to pointer size.
This patch fixes PR36885: clang++ generates unaligned stub symbol
holding a pointer.
Patch by Rahul Chaudhry!
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/test/CodeGen/X86/catch.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=329030&r1=329029&r2=329030&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Apr 2 16:20:30 2018
@@ -1336,6 +1336,7 @@ bool AsmPrinter::doFinalization(Module &
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(),
Modified: llvm/trunk/test/CodeGen/X86/catch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/catch.ll?rev=329030&r1=329029&r2=329030&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/catch.ll (original)
+++ llvm/trunk/test/CodeGen/X86/catch.ll Mon Apr 2 16:20:30 2018
@@ -3,7 +3,11 @@
; 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
+; CHECK-NEXT: .p2align 3
+; CHECK-NEXT: .L.Lstr.DW.stub:
; CHECK-NEXT: .quad .Lstr
@str = private unnamed_addr constant [12 x i8] c"NSException\00"
More information about the llvm-commits
mailing list