diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2018-04-02 23:20:30 +0000 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2018-04-25 14:13:28 -0700 |
commit | 6ffc243251225819376182bea70d471822a2c977 (patch) | |
tree | 8952238e635ae2318f63fd88e77946bf8a67fc0e | |
parent | ef38d15d86d289ca3fd7b7499b15da5eae52ef05 (diff) | |
download | llvm-6ffc243251225819376182bea70d471822a2c977.tar.gz |
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!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329030 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 1 | ||||
-rw-r--r-- | test/CodeGen/X86/catch.ll | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index da4244b8b6c..2926ea64b85 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1336,6 +1336,7 @@ bool AsmPrinter::doFinalization(Module &M) { 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(), diff --git a/test/CodeGen/X86/catch.ll b/test/CodeGen/X86/catch.ll index be7466e8abb..5c0bc5008f4 100644 --- a/test/CodeGen/X86/catch.ll +++ b/test/CodeGen/X86/catch.ll @@ -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" |