Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2011 09:37:22 -0500
From:      David Schultz <das@FreeBSD.ORG>
To:        John Baldwin <jhb@FreeBSD.ORG>
Cc:        Gleb Kurtsou <gleb.kurtsou@gmail.com>, src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, Dimitry Andric <dim@FreeBSD.ORG>, svn-src-head@FreeBSD.ORG, Alexander Best <arundel@FreeBSD.ORG>
Subject:   Re: svn commit: r216977 - in head/libexec/rtld-elf: amd64 i386
Message-ID:  <20110105143722.GA40648@zim.MIT.EDU>
In-Reply-To: <201101050759.50877.jhb@freebsd.org>
References:  <201101042051.p04KpSGk054564@svn.freebsd.org> <20110105011635.GA4952@freebsd.org> <20110105121910.GA1841@tops.skynet.lt> <201101050759.50877.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 05, 2011, John Baldwin wrote:
> On Wednesday, January 05, 2011 7:19:10 am Gleb Kurtsou wrote:
> > On (05/01/2011 01:16), Alexander Best wrote:
> > > On Tue Jan  4 11, Dimitry Andric wrote:
> > > > Author: dim
> > > > Date: Tue Jan  4 20:51:28 2011
> > > > New Revision: 216977
> > > > URL: http://svn.freebsd.org/changeset/base/216977
> > > > 
> > > > Log:
> > > >   On amd64 and i386, tell the compiler to refrain from generating SSE,
> > > >   3DNow, MMX and floating point instructions in rtld-elf.
> > > >   
> > > >   Otherwise, _rtld_bind() (and whatever it calls) could possibly clobber
> > > >   function arguments that are passed in SSE/3DNow/MMX/FP registers,
> > > >   usually floating point values.  This can happen, for example, when clang
> > > >   generates SSE code for memset() or memcpy() calls.
> > > 
> > > the sorting order for these flags seems to be:
> > > 
> > > -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3
> > > 
> > > see 'grep -R "\-no-sse" /usr/src'. maybe the sorting order should stay
> > > consistent?
> > > 
> > > also what's the status of clang? will these flags make sure that newer
> > > cpu extension won't be activated? i checked
> > > contrib/llvm/tools/clang/include/clang/Driver/Options.td
> > > and clang has support for:
> > > 
> > > -m3dnowa
> > > -mssse3
> > > -msse4a
> > > -msse4
> > > -msse4_1
> > > -msse4_2
> > > -maes
> > > -mavx
> > > 
> > > since these extensions only get set in a hand full of files maybe special
> > > cases for CC == clang can be added.
> > Why not to add NO_HWFLOAT knob (or similar) into makefile
> > infrastructure. And set CFLAGS accordingly, depending on CC, arch, etc.
> > These flags are getting rather common in tree.
> 
> It strikes me that we really want clang/gcc to have some sort of
> '-mno-hwfloat' so we don't keep having to add new flags in the future.

It would have to be called something like -mno-xmmregs.  Many SSE
instructions are for vector operations on integers, not floating
point.  Furthermore, I don't think the i387 floating point
instructions would cause the problem being addressed here
(although they're a bad idea for _rtld_bind() for other reasons).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110105143722.GA40648>