<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Oct 10, 2015 at 5:40 PM, Tim Northover via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> So there are two slightly different things here. I think we should be<br>
> able to raise the alignment of global objects, independently of what the<br>
> platform ABI says.<br>
<br>
</span>I'd like that to be the case, but it clearly is visible at shared<br>
object boundaries so I don't think it's something we can change at<br>
will.<br>
<span class=""><br>
> Now on the specific case of AMD64, there is a<br>
> separate ABI rule which makes this a correct transform.<br>
<br>
</span>I don't think it does quite that. If you're applying that rule it<br>
makes it a *necessary* transformation (in this view LLVM enforces ABI<br>
alignments whether you want them or not for your language, LLVM 3.6<br>
had a bug by not doing so, and trunk still has a bug for not always<br>
doing so).<br>
<span class=""><br>
> The strange part is that noone seems to be observing this outside<br>
> FreeBSD, which has a pretty ancient ld. What I don't know is where ld<br>
> *is* picking up the 64bit alignment from.<br>
<br>
</span>ELF files don't actually contain an alignment field for symbols.<br>
Gold's algorithm appears to start with the section's alignment, keep<br>
reducing that until the symbol's address is properly aligned and then<br>
decide that was "obviously" the intended alignment. Not ideal (objects<br>
can easily get over-aligned by accident), but about the only sensible<br>
way to do it given the data available.<br>
<br>
So the 64-bit alignment ultimately came from LLVM only aligning the<br>
section containing std::cout to 64-bits.</blockquote><div><br></div><div>Any chance this is because libc++ gives these objects different types in the declaration versus the definition?</div></div></div></div>