[PATCH] D16145: Stop increasing alignment of externally-visible globals on ELF platforms.

James Y Knight via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 08:55:31 PST 2016


jyknight created this revision.
jyknight added reviewers: t.p.northover, dim.
jyknight added a subscriber: llvm-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

With ELF, the alignment of a global variable in a shared library will
get copied into an executables linked against it, if the executable even
accesss the variable. So, it's not possible to implicitly increase
alignment based on access patterns, or you'll break existing binaries.

This happened to affect libc++'s std::cout symbol, for example. See
thread: http://thread.gmane.org/gmane.comp.compilers.clang.devel/45311

http://reviews.llvm.org/D16145

Files:
  include/llvm/IR/GlobalValue.h
  lib/CodeGen/CodeGenPrepare.cpp
  lib/IR/Globals.cpp
  lib/Transforms/Utils/Local.cpp
  test/CodeGen/ARM/memfunc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16145.44756.patch
Type: text/x-patch
Size: 8446 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160113/b1121a4a/attachment.bin>


More information about the llvm-commits mailing list