public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug build/18744] New: FAIL: elf/tst-ld-sse-use when using -march=native in CFLAGS
@ 2015-07-30 16:33 markus at trippelsdorf dot de
  2015-07-30 16:41 ` [Bug build/18744] " markus at trippelsdorf dot de
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: markus at trippelsdorf dot de @ 2015-07-30 16:33 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=18744

            Bug ID: 18744
           Summary: FAIL: elf/tst-ld-sse-use when using -march=native in
                    CFLAGS
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: markus at trippelsdorf dot de
                CC: carlos at redhat dot com
  Target Milestone: ---

With:
CFLAGS="-march=native -g -O2 -pipe" CXXFLAGS="-march=native -g -O2 -pipe"
../glibc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
--with-headers=/usr/include --enable-add-ons --enable-kernel=4.0 --with-tls
--with-__thread --enable-bind-now --without-gd --without-cvs --disable-profile
--disable-multi-arch --disable-werror

I get:

FAIL: elf/tst-ld-sse-use

function __profil in rtld-profil.os modifies xmm/ymm/zmm

markus@x4 gmon % objdump -dr rtld-profil.os
...
0000000000000060 <__profil>:
  60:   48 81 ec c8 00 00 00    sub    $0xc8,%rsp
  67:   48 8d 05 92 ff ff ff    lea    -0x6e(%rip),%rax        # 0
<__profil_counter>
  6e:   48 d1 ee                shr    %rsi
  71:   48 89 44 24 20          mov    %rax,0x20(%rsp)
  76:   48 8d 44 24 20          lea    0x20(%rsp),%rax
  7b:   48 89 35 00 00 00 00    mov    %rsi,0x0(%rip)        # 82
<__profil+0x22>
                        7e: R_X86_64_PC32       .bss+0xc
  82:   48 89 3d 00 00 00 00    mov    %rdi,0x0(%rip)        # 89
<__profil+0x29>
                        85: R_X86_64_PC32       .bss+0x14
  89:   48 89 15 00 00 00 00    mov    %rdx,0x0(%rip)        # 90
<__profil+0x30>
                        8c: R_X86_64_PC32       .bss+0x4
  90:   48 8d b0 80 00 00 00    lea    0x80(%rax),%rsi
  97:   89 0d 00 00 00 00       mov    %ecx,0x0(%rip)        # 9d
<__profil+0x3d>
                        99: R_X86_64_PC32       .bss-0x4
  9d:   c7 84 24 a8 00 00 00    movl   $0x10000000,0xa8(%rsp)
  a4:   00 00 00 10 
  a8:   0f 1f 40 00             nopl   0x0(%rax)
  ac:   66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
  b3:   00 00 00 
  b6:   66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
  bd:   00 00 00 
  c0:   48 c7 06 ff ff ff ff    movq   $0xffffffffffffffff,(%rsi)
  c7:   48 83 ee 08             sub    $0x8,%rsi
  cb:   48 39 c6                cmp    %rax,%rsi
  ce:   75 f0                   jne    c0 <__profil+0x60>
  d0:   31 d2                   xor    %edx,%edx
  d2:   bf 1b 00 00 00          mov    $0x1b,%edi
  d7:   e8 00 00 00 00          callq  dc <__profil+0x7c>
                        d8: R_X86_64_PLT32      __sigaction-0x4
  dc:   85 c0                   test   %eax,%eax
  de:   78 40                   js     120 <__profil+0xc0>
  e0:   48 c7 44 24 10 00 00    movq   $0x0,0x10(%rsp)
  e7:   00 00 
  e9:   e8 00 00 00 00          callq  ee <__profil+0x8e>
                        ea: R_X86_64_PLT32      __profile_frequency-0x4
  ee:   89 c1                   mov    %eax,%ecx
  f0:   b8 40 42 0f 00          mov    $0xf4240,%eax
  f5:   48 89 e6                mov    %rsp,%rsi
  f8:   99                      cltd   
  f9:   bf 02 00 00 00          mov    $0x2,%edi
  fe:   f7 f9                   idiv   %ecx
 100:   31 d2                   xor    %edx,%edx
 102:   48 98                   cltq   
 104:   48 89 44 24 18          mov    %rax,0x18(%rsp)
 109:   66 0f 6f 44 24 10       movdqa 0x10(%rsp),%xmm0                 #!!!
 10f:   0f 29 04 24             movaps %xmm0,(%rsp)                     #!!!
 113:   e8 00 00 00 00          callq  118 <__profil+0xb8>
                        114: R_X86_64_PC32      __setitimer-0x4
 118:   48 81 c4 c8 00 00 00    add    $0xc8,%rsp
 11f:   c3                      retq   
 120:   b8 ff ff ff ff          mov    $0xffffffff,%eax
 125:   eb f1                   jmp    118 <__profil+0xb8>

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug build/18744] FAIL: elf/tst-ld-sse-use when using -march=native in CFLAGS
  2015-07-30 16:33 [Bug build/18744] New: FAIL: elf/tst-ld-sse-use when using -march=native in CFLAGS markus at trippelsdorf dot de
@ 2015-07-30 16:41 ` markus at trippelsdorf dot de
  2015-07-30 21:03 ` carlos at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: markus at trippelsdorf dot de @ 2015-07-30 16:41 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=18744

--- Comment #1 from Markus Trippelsdorf <markus at trippelsdorf dot de> ---
gcc version 5.2. 
-march=native == amdfam10 on this machine.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug build/18744] FAIL: elf/tst-ld-sse-use when using -march=native in CFLAGS
  2015-07-30 16:33 [Bug build/18744] New: FAIL: elf/tst-ld-sse-use when using -march=native in CFLAGS markus at trippelsdorf dot de
  2015-07-30 16:41 ` [Bug build/18744] " markus at trippelsdorf dot de
@ 2015-07-30 21:03 ` carlos at redhat dot com
  2015-07-31  6:29 ` markus at trippelsdorf dot de
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: carlos at redhat dot com @ 2015-07-30 21:03 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=18744

--- Comment #2 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to Markus Trippelsdorf from comment #1)
> gcc version 5.2. 
> -march=native == amdfam10 on this machine.

If you profile the dynamic loader you can't use SSE.

There are some combination of CFLAGS that result in broken builds and this is
one of them. In several cases we've had to manually disable the optimizations
that yield SSE usage, and this is yet another case.

This is supposed to catch everything:

sysdeps/x86/Makefile
  1 ifeq ($(subdir),elf)
  2 CFLAGS-.os += $(if $(filter $(@F),$(patsubst
%,%.os,$(all-rtld-routines))),\
  3                    -mno-sse -mno-mmx)
  4 
  5 tests-special += $(objpfx)tst-ld-sse-use.out
  6 $(objpfx)tst-ld-sse-use.out: ../sysdeps/x86/tst-ld-sse-use.sh
$(objpfx)ld.so
  7         @echo "Checking ld.so for SSE register use.  This will take a few
seconds..."
  8         $(BASH) $< $(objpfx) '$(NM)' '$(OBJDUMP)' '$(READELF)' > $@; \
  9         $(evaluate-test)
 10 endif

Why doesn't rtld-profil end up in all-rtld-routines?

It certainly is processed as we enter gmon and put into rtld-modules.

Either work out why it isn't in all-rtld-routines, or that all-rtld-routines is
insufficient, and then decide what else should get an added `-mno-sse
-mno-mmx`.

Otherwise, beware that your profiling code is broken.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug build/18744] FAIL: elf/tst-ld-sse-use when using -march=native in CFLAGS
  2015-07-30 16:33 [Bug build/18744] New: FAIL: elf/tst-ld-sse-use when using -march=native in CFLAGS markus at trippelsdorf dot de
  2015-07-30 16:41 ` [Bug build/18744] " markus at trippelsdorf dot de
  2015-07-30 21:03 ` carlos at redhat dot com
@ 2015-07-31  6:29 ` markus at trippelsdorf dot de
  2015-07-31  6:36 ` markus at trippelsdorf dot de
  2015-07-31  7:39 ` schwab@linux-m68k.org
  4 siblings, 0 replies; 6+ messages in thread
From: markus at trippelsdorf dot de @ 2015-07-31  6:29 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=18744

Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #3 from Markus Trippelsdorf <markus at trippelsdorf dot de> ---
CCing H.J. who wrote the Makefile rule in question.
The following patch works for me.

diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
index 19f5eca741af..4a473d73c730 100644
--- a/sysdeps/x86/Makefile
+++ b/sysdeps/x86/Makefile
@@ -1,3 +1,6 @@
+ifeq ($(subdir),gmon)
+CFLAGS-.os += -mno-sse -mno-mmx
+endif
 ifeq ($(subdir),elf)
 CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
                   -mno-sse -mno-mmx)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug build/18744] FAIL: elf/tst-ld-sse-use when using -march=native in CFLAGS
  2015-07-30 16:33 [Bug build/18744] New: FAIL: elf/tst-ld-sse-use when using -march=native in CFLAGS markus at trippelsdorf dot de
                   ` (2 preceding siblings ...)
  2015-07-31  6:29 ` markus at trippelsdorf dot de
@ 2015-07-31  6:36 ` markus at trippelsdorf dot de
  2015-07-31  7:39 ` schwab@linux-m68k.org
  4 siblings, 0 replies; 6+ messages in thread
From: markus at trippelsdorf dot de @ 2015-07-31  6:36 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=18744

--- Comment #4 from Markus Trippelsdorf <markus at trippelsdorf dot de> ---
(In reply to Markus Trippelsdorf from comment #3)
> CCing H.J. who wrote the Makefile rule in question.
> The following patch works for me.
> 
> diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
> index 19f5eca741af..4a473d73c730 100644
> --- a/sysdeps/x86/Makefile
> +++ b/sysdeps/x86/Makefile
> @@ -1,3 +1,6 @@
> +ifeq ($(subdir),gmon)
> +CFLAGS-.os += -mno-sse -mno-mmx
> +endif
>  ifeq ($(subdir),elf)
>  CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
>                    -mno-sse -mno-mmx)

No, it doesn't work at all.
But you get the idea: subdir elf is not enough, because rtld-profil.os is build
in gmon.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug build/18744] FAIL: elf/tst-ld-sse-use when using -march=native in CFLAGS
  2015-07-30 16:33 [Bug build/18744] New: FAIL: elf/tst-ld-sse-use when using -march=native in CFLAGS markus at trippelsdorf dot de
                   ` (3 preceding siblings ...)
  2015-07-31  6:36 ` markus at trippelsdorf dot de
@ 2015-07-31  7:39 ` schwab@linux-m68k.org
  4 siblings, 0 replies; 6+ messages in thread
From: schwab@linux-m68k.org @ 2015-07-31  7:39 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=18744

--- Comment #5 from Andreas Schwab <schwab@linux-m68k.org> ---
> Why doesn't rtld-profil end up in all-rtld-routines?

all-rtld-routines does not contain the objects from rtld-libc.a.  rtld-Rules
should probably use sysdep-rtld-CFLAGS which can be set by sysdep makefiles.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-31  7:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-30 16:33 [Bug build/18744] New: FAIL: elf/tst-ld-sse-use when using -march=native in CFLAGS markus at trippelsdorf dot de
2015-07-30 16:41 ` [Bug build/18744] " markus at trippelsdorf dot de
2015-07-30 21:03 ` carlos at redhat dot com
2015-07-31  6:29 ` markus at trippelsdorf dot de
2015-07-31  6:36 ` markus at trippelsdorf dot de
2015-07-31  7:39 ` schwab@linux-m68k.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).