Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Oct 2015 11:37:26 +0000
From:      Ed Maste <emaste@freebsd.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Dimitry Andric <dim@freebsd.org>,  "src-committers@freebsd.org" <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r289072 - in head/contrib: libc++/src llvm/lib/Transforms/Vectorize
Message-ID:  <CAPyFy2Dm=OaJbTfwVDABPz=e_H-XhhnTc%2BjYtr0iSHYv3uEObw@mail.gmail.com>
In-Reply-To: <20151010060846.GA2257@kib.kiev.ua>
References:  <201510091821.t99ILjHI054211@repo.freebsd.org> <20151010060846.GA2257@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10 October 2015 at 06:08, Konstantin Belousov <kostikbel@gmail.com> wrote:
> On Fri, Oct 09, 2015 at 06:21:45PM +0000, Dimitry Andric wrote:
>> Author: dim
>> Date: Fri Oct  9 18:21:45 2015
>> New Revision: 289072
>> URL: https://svnweb.freebsd.org/changeset/base/289072
>>
>> Log:
>>   Temporarily revert upstream llvm trunk r240144 (by Michael Zolotukhin):
>
> This might be indeed a clang bug, but probably not in the revision which
> you reverted.  Or it might be a libc++ bug.

Yes, the bug is almost certainly not r240144; reverting it is a
short-term workaround until the underlying issue is fixed.

> The story, from what I understand from the discussion at some other
> place, is that the fault occurs on access to the common unaligned
> symbol. Apparently, ELF does allow to specify alignment of the common
> symbols, and static linker, when finally allocating .bss space for the
> object, must obey the requirement. The symbol value for the common
> symbol must be interpreted as the desired alignment.
>
> Could you look up the symbol reference in the .o files (again) and see
> which alignment is requested ?  I think that it is probably clang which
> should set it to be at least 16 bytes to generate ABI-compliant code.

The declaration is extern ostream cout; which correctly has 8 byte alignment.

In the implementation (contrib/libc++/src/iostream.cpp) it is defined
as a char array which is where the 16-byte ABI alignment would arise,
but explicitly specifies 8-byte alignment:
_ALIGNAS_TYPE (ostream)  _LIBCPP_FUNC_VIS char cout[sizeof(ostream)];

Compiling with -emit-llvm --save-temps shows the desired 8-byte
alignment for cout in the LLVM IR but 16-byte in the assembly file.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPyFy2Dm=OaJbTfwVDABPz=e_H-XhhnTc%2BjYtr0iSHYv3uEObw>