From 8c58750cc41e105ad26dd225b23049907341ad85 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 2 Apr 2018 23:20:30 +0000 Subject: 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! llvm-svn: 329030 --- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'llvm/lib/CodeGen/AsmPrinter') diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index da4244b8b6c..2926ea64b85 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/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(), -- cgit v1.2.3