https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113874
--- Comment #26 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Jakub Jelinek from comment #25) > (In reply to H.J. Lu from comment #23) > > > And i386/dl-tlsdesc.S needs to save/restore 387 and SSE regs? > > > > i386 doesn't preserve them in _dl_runtime_resolve nor _dl_tlsdesc_dynamic. > > That is different. _dl_runtime_resolve happens only at the start of calls > to functions, if in all supported ia32 ABIs all of i387 state is unsupported > upon entering functions, then there is no need to save anything. > While _dl_tlsdesc_dynamic can happen anywhere from within functions and > doesn't clobber any registers except ax which gets the value, so I think it > needs to be saved for that case. I couldn't find a test to show it is needed on i386: #0 __GI___libc_malloc (bytes=3200) at malloc.c:3294 #1 0xf7fdb771 in malloc (size=<optimized out>) at ../include/rtld-malloc.h:56 #2 allocate_dtv_entry (size=<optimized out>, alignment=4) at dl-tls.c:679 #3 allocate_and_init (map=0xf6e00670) at dl-tls.c:704 #4 tls_get_addr_tail (ti=0xf6e00a30, dtv=0x5655fcd8, the_map=0xf6e00670) at dl-tls.c:904 #5 0xf7fdf5d5 in _dl_tlsdesc_dynamic () at ../sysdeps/i386/dl-tlsdesc.S:129 #6 0xf7fb017b in apply_tls (p=0xf7a0037c) at tst-gnu2-tls2mod1.c:26 #7 0x5655769b in access_mod (i=1, sym=0x5655a026 "apply_tls") at ../sysdeps/i386/i686/tst-gnu2-tls2-i686.c:55 #8 start (arg=0x0) at ../sysdeps/i386/i686/tst-gnu2-tls2-i686.c:70 #9 0xf7c96207 in start_thread (arg=<optimized out>) at pthread_create.c:447 #10 0xf7d3dc08 in clone3 () at ../sysdeps/unix/sysv/linux/i386/clone3.S:111 Even if I compile ia32 glibc with -march=skylake, the _dl_tlsdesc_dynamic slow path doesn't touch XMM registers at all.