This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][BZ #15627] Disable SSE for rtld-* objects (tst-xmmymm failure)


Hi,

I had mentioned a testsuite regression I had seen in the Fedora
rawhide build in another thread.  Here are more details on that and a
candidate fix.

gcc-4.8 seems to be able to vectorize some instructions in rtld-memset
on x86_64 (which is essentially string/memset.c), which results in
code writing to xmm0.  This resulted in the test case failure
described in BZ #15627.

I had initially written a fix that disables sse when building all
rtld-* objects that are to be linked into the dynamic linker.  I
reckoned however that it was an extreme measure and that we probably
ought to be doing it on a case to case basis, based on feedback from
the tst-xmmymm test case since writing to xmm/ymm is potentially wrong
only in the code paths involving dynamic relocation.

The result is the patch below, which applies on top of Roland's
sysd-rules patches.  I only disable sse for rtld-memset.os, which now
results in the test returning clean.  I have also verified that other
rtld-* objects don't get this flag.

OK to commit?

Siddhesh

	[BZ #15627]
	* scripts/sysd-rules.awk (BEGIN): Add CFLAGS to compile
	command.
	* sysdeps/x86/Makefile [rtld-modules] (rtld-CFLAGS): Add flags
	to disable SSE.

diff --git a/scripts/sysd-rules.awk b/scripts/sysd-rules.awk
index cc14334..d04614e 100644
--- a/scripts/sysd-rules.awk
+++ b/scripts/sysd-rules.awk
@@ -54,7 +54,7 @@ BEGIN {
           command_suffix = "";
         } else {
           prefix = gensub(/%/, "", "", target_pattern);
-          command_suffix = " $(" prefix  "CPPFLAGS)";
+          command_suffix = " $(" prefix "CPPFLAGS) $(" prefix "CFLAGS)";
         }
         target = "$(objpfx)" target_pattern o ":";
         if (asm_rules) {
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
index 3e87a77..099aeb2 100644
--- a/sysdeps/x86/Makefile
+++ b/sysdeps/x86/Makefile
@@ -7,3 +7,9 @@ $(objpfx)tst-xmmymm.out: ../sysdeps/x86/tst-xmmymm.sh $(objpfx)ld.so
 	@echo "Checking ld.so for SSE register use.  This will take a few seconds..."
 	$(SHELL) $< $(objpfx) '$(NM)' '$(OBJDUMP)' '$(READELF)' > $@
 endif
+
+ifdef rtld-modules
+rtld-modules-no-sse = rtld-memset
+rtld-CFLAGS += $(if $(filter $(@F),$(patsubst %,%.os,$(rtld-modules-no-sse))),\
+		    -mno-sse -mno-mmx)
+endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]