This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] i386: disable sse in rtld-divdi3.os
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Aurelien Jarno <aurelien at aurel32 dot net>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 14 Jul 2016 08:00:41 -0700
- Subject: Re: [PATCH] i386: disable sse in rtld-divdi3.os
- Authentication-results: sourceware.org; auth=none
- References: <1468493124-20655-1-git-send-email-aurelien@aurel32.net>
On Thu, Jul 14, 2016 at 3:45 AM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> When compiling the GNU libc on i386 using GCC 6 and for a CPU with SSE
> support (e.g. -march=pentium4, -march=core2, -march=haswell, ...) the
> rtld-divdi3.os file ends up with SSE instructions using the XMM
> registers. This makes the elf/tst-ld-sse-use test to fail:
>
> function __udivdi3 in rtld-divdi3.os modifies xmm/ymm/zmm
>
> Modify sysdeps/i386/Makefile to compile this file with -mno-sse -mno-mmx
> -mfpmath=387 like it is already done for other files used by ld.so.
>
> Changelog:
> * sysdeps/i386/Makefile [$(subdir) == csu] (CFLAGS-rtld-divdi3.os):
> New. Set to -mno-sse -mno-mmx -mfpmath=387.
Don't all rtld-*.os have the same issue? Please try this one.
--
H.J.
From 4c130663163ab22f1ec76739633a5cbe0550a118 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 14 Jul 2016 07:54:18 -0700
Subject: [PATCH] i386: Compile rtld-*.os with -mno-sse -mno-mmx -mfpmath=387
Compile i386 rtld-*.os with -mno-sse -mno-mmx -mfpmath=387 so that no
code in ld.so uses mm/xmm/ymm/zmm registers on i386 since the first 3
mm/xmm/ymm/zmm registers are used to pass vector parameters which must
be preserved.
* sysdeps/i386/Makefile (rtld-CFLAGS): New.
[subdir == elf] (CFLAGS-.os): Replace -mno-sse -mno-mmx
-mfpmath=387 with $(rtld-CFLAGS).
[subdir != elf] (CFLAGS-.os): Compile rtld-*.os with
$(rtld-CFLAGS).
---
sysdeps/i386/Makefile | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile
index 6c91842..e94f2cb 100644
--- a/sysdeps/i386/Makefile
+++ b/sysdeps/i386/Makefile
@@ -84,17 +84,20 @@ ifeq ($(subdir),csu)
gen-as-const-headers += tlsdesc.sym
endif
-ifeq ($(subdir),elf)
# Make sure no code in ld.so uses mm/xmm/ymm/zmm registers on i386 since
# the first 3 mm/xmm/ymm/zmm registers are used to pass vector parameters
# which must be preserved.
# With SSE disabled, ensure -fpmath is not set to use sse either.
+rtld-CFLAGS = -mno-sse -mno-mmx -mfpmath=387
+ifeq ($(subdir),elf)
CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
- -mno-sse -mno-mmx -mfpmath=387)
+ $(rtld-CFLAGS))
tests-special += $(objpfx)tst-ld-sse-use.out
$(objpfx)tst-ld-sse-use.out: ../sysdeps/i386/tst-ld-sse-use.sh $(objpfx)ld.so
@echo "Checking ld.so for SSE register use. This will take a few seconds..."
$(BASH) $< $(objpfx) '$(NM)' '$(OBJDUMP)' '$(READELF)' > $@; \
$(evaluate-test)
+else
+CFLAGS-.os += $(if $(filter rtld-%.os,$(@F)), $(rtld-CFLAGS))
endif
--
2.7.4