svn commit: r216977 - in head/libexec/rtld-elf: amd64 i386

Alexander Best arundel at freebsd.org
Wed Jan 5 18:59:44 UTC 2011


On Wed Jan  5 11, Dimitry Andric wrote:
> On 2011-01-05 02:16, Alexander Best wrote:
> >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?
> 
> I copied the order from sys/conf/kern.mk, lines 69 and 70:
> 
> 	-mfpmath=387 -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow \
> 	-msoft-float -fno-asynchronous-unwind-tables
> 
> I don't particularly care about the order, though.  The order you found
> seems to be the historical order.  If people prefer to have the same
> order everywhere, I'll fix it.

judging from the discussion going on right now it seems those flags will be
grouped together to form a new variable. so things will probably change shortly
and fixing the order is probably not necessary.

however if in fact new switches are being added to CFLAGS for clang it might
be a good idea to have them sorted consistently or the chances of missing
flags might increase. if you e.g. define all the -mno-xxx flags clang
supports, you want to stick to one order. otherwise it will be very had to spot
a missing flags between ~ 20 unsorted flags.

> 
> 
> >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
> 
> The in-tree clang has support for these "-mno-xxx" options:
> 
> -mno_3dnow
> -mno_3dnowa
> -mno_aes
> -mno_avx
> -mno_constant_cfstrings
> -mno_mmx
> -mno_omit_leaf_frame_pointer
> -mno_pascal_strings
> -mno_red_zone
> -mno_relax_all
> -mno_soft_float
> -mno_sse
> -mno_sse2
> -mno_sse3
> -mno_sse4
> -mno_sse4_1
> -mno_sse4_2
> -mno_sse4a
> -mno_ssse3
> -mno_thumb
> -mno_warn_nonportable_cfstrings
> 
> so I think you just looked incorrectly. :)

*lol* you're right. i'm not that much of a cpu guru so i wasn't sure about the
meaning of most of the flags and whether they are cpu related or not.

> 
> 
> >since these extensions only get set in a hand full of files maybe special
> >cases for CC == clang can be added.
> 
> I don't think it's necessary.  Maybe there could be one central
> definition (say, in share/sys.mk) for the flags that disable all
> 'special' features, e.g. for amd64 and i386:
> 
> CFLAGS_CONSERVATIVE=-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 
> -msoft-float

judging from the discussion going on right now this seems to be the best
solution...even if more cases need to be considered for different
architectures.

some people have proposed hacking into clang which i personally think is a very
bad idea. why not contact the clang developers? they might like the idea of a
switch disabling all advanced extensions for every architecture?

> 
> Similar flags could be defined for other arches too.
> 
> 
> >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.
> 
> @@ -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} \
> 
> Ehm, this looks wrong, those options should not be removed for anything
> in sys/boot.  Boot programs should normally refrain from using any
> advanced CPU instructions.  What did you want to achieve with this
> patch?

these flags are already being defined in sys/boot/{i386,pc98}/Makefile.inc so
it doesn't seem necessary to also have them in the other makefiles.

you should be able to verify this quite easily:

before applying the patch cd to /usr/src/sys/boot and do:

for i in amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v; do make TARGET=$i ; make TARGET=$i clean; done > ~/no-patch 2>&1

then apply the patch and rerun the command:

for i in amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v; do make TARGET=$i ; make TARGET=$i clean; done > ~/with-patch 2>&1

then do

diff -ru0N with-patch no-patch > differ

if you have a look at differ you can see that without the patch -mno-mmx,
-mno-3dnow, -mno-sse, -mno-sse2, -mno-sse3 get added twice to some commands.
with the patch they only get added once to the corresponding commands.

cheers.
alex

-- 
a13x


More information about the svn-src-all mailing list