Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2011 03:52:43 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        Dimitry Andric <dim@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r216977 - in head/libexec/rtld-elf: amd64 i386
Message-ID:  <20110105035243.GA24903@freebsd.org>
In-Reply-To: <20110105011635.GA4952@freebsd.org>
References:  <201101042051.p04KpSGk054564@svn.freebsd.org> <20110105011635.GA4952@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed Jan  5 11, 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.
> 
> also maybe you could have a look at the attached patch. i sent this to hackers@
> and nobody objected, but nobody wanted to commit the patch unfortunately.
> 
> cheers.
> alex
> 
> >   
> >   One symptom of this is sshd dying early on amd64 with "PRNG not seeded",
> >   which is ultimately caused by libcrypto.so.6 calling RAND_add() with a
> >   double parameter.  That parameter is passed via %xmm0, which gets wiped
> >   out by an SSE memset() in _rtld_bind().
> >   
> >   Reviewed by:	kib, kan
> > 
> > Modified:
> >   head/libexec/rtld-elf/amd64/Makefile.inc
> >   head/libexec/rtld-elf/i386/Makefile.inc
> > 
> > Modified: head/libexec/rtld-elf/amd64/Makefile.inc
> > ==============================================================================
> > --- head/libexec/rtld-elf/amd64/Makefile.inc	Tue Jan  4 20:38:52 2011	(r216976)
> > +++ head/libexec/rtld-elf/amd64/Makefile.inc	Tue Jan  4 20:51:28 2011	(r216977)
> > @@ -1,5 +1,6 @@
> >  # $FreeBSD$
> >  
> > +CFLAGS+=	-mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow -msoft-float
> >  # Uncomment this to build the dynamic linker as an executable instead
> >  # of a shared library:
> >  #LDSCRIPT=	${.CURDIR}/${MACHINE_CPUARCH}/elf_rtld.x
> > 
> > Modified: head/libexec/rtld-elf/i386/Makefile.inc
> > ==============================================================================
> > --- head/libexec/rtld-elf/i386/Makefile.inc	Tue Jan  4 20:38:52 2011	(r216976)
> > +++ head/libexec/rtld-elf/i386/Makefile.inc	Tue Jan  4 20:51:28 2011	(r216977)
> > @@ -1,5 +1,6 @@
> >  # $FreeBSD$
> >  
> > +CFLAGS+=	-mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow -msoft-float
> >  # Uncomment this to build the dynamic linker as an executable instead
> >  # of a shared library:
> >  #LDSCRIPT=	${.CURDIR}/${MACHINE_CPUARCH}/elf_rtld.x
> 
> -- 
> a13x

> diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
> index b91a43b..39ef619 100644
> --- a/sys/boot/i386/boot2/Makefile
> +++ b/sys/boot/i386/boot2/Makefile
> @@ -3,7 +3,7 @@
>  .include <bsd.own.mk>
>  
>  # XXX: clang can compile the boot code just fine, but boot2 gets too big
> -CC:=${CC:C/^(.*\/)?clang$/gcc/1}
> +#CC:=${CC:C/^(.*\/)?clang$/gcc/1}

^^
sorry. that was a leftover from some hacking i did.

>  
>  FILES=		boot boot1 boot2
>  
> @@ -31,7 +31,6 @@ CFLAGS=	-Os \
>  	-fno-unit-at-a-time \
>  	-mno-align-long-strings \
>  	-mrtd \
> -	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
>  	-D${BOOT2_UFS} \
>  	-DFLAGS=${BOOT_BOOT1_FLAGS} \
>  	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
> diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
> index a0fad61..452b100 100644
> --- a/sys/boot/i386/gptboot/Makefile
> +++ b/sys/boot/i386/gptboot/Makefile
> @@ -26,7 +26,6 @@ CFLAGS=	-DBOOTPROG=\"gptboot\" \
>  	-fno-unit-at-a-time \
>  	-mno-align-long-strings \
>  	-mrtd \
> -	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
>  	-DGPT \
>  	-D${GPTBOOT_UFS} \
>  	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
> diff --git a/sys/boot/i386/gptzfsboot/Makefile b/sys/boot/i386/gptzfsboot/Makefile
> index 30a5fc7..7f5f287 100644
> --- a/sys/boot/i386/gptzfsboot/Makefile
> +++ b/sys/boot/i386/gptzfsboot/Makefile
> @@ -23,7 +23,6 @@ CFLAGS=	-DBOOTPROG=\"gptzfsboot\" \
>  	-fno-unit-at-a-time \
>  	-mno-align-long-strings \
>  	-mrtd \
> -	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
>  	-DGPT -DBOOT2 \
>  	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
>  	-DSIOFMT=${B2SIOFMT} \
> diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile
> index 10616e4..38e8a9f 100644
> --- a/sys/boot/i386/zfsboot/Makefile
> +++ b/sys/boot/i386/zfsboot/Makefile
> @@ -24,7 +24,6 @@ CFLAGS=	-DBOOTPROG=\"zfsboot\" \
>  	-fno-unit-at-a-time \
>  	-mno-align-long-strings \
>  	-mrtd \
> -	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
>  	-DBOOT2 \
>  	-DFLAGS=${BOOT_BOOT1_FLAGS} \
>  	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
> diff --git a/sys/boot/pc98/boot2/Makefile b/sys/boot/pc98/boot2/Makefile
> index dfd8607..035b5dd 100644
> --- a/sys/boot/pc98/boot2/Makefile
> +++ b/sys/boot/pc98/boot2/Makefile
> @@ -28,7 +28,6 @@ CFLAGS=	-Os \
>  	-fno-unit-at-a-time \
>  	-mno-align-long-strings \
>  	-mrtd \
> -	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
>  	-D${BOOT2_UFS} \
>  	-DFLAGS=${BOOT_BOOT1_FLAGS} \
>  	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \


-- 
a13x



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