This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch hjl/pr18661 created. glibc-2.21-660-ge52b127
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 28 Jul 2015 13:01:32 -0000
- Subject: GNU C Library master sources branch hjl/pr18661 created. glibc-2.21-660-ge52b127
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/pr18661 has been created
at e52b127fe28fce951cab0bcc55904b68dd39a6c3 (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e52b127fe28fce951cab0bcc55904b68dd39a6c3
commit e52b127fe28fce951cab0bcc55904b68dd39a6c3
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Jul 28 05:47:54 2015 -0700
Check AVX/AVX512 in elf_machine_runtime_setup
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index cae6db3..7ec39dc 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -26,6 +26,7 @@
#include <sysdep.h>
#include <tls.h>
#include <dl-tlsdesc.h>
+#include <cpuid.h>
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int __attribute__ ((unused))
@@ -70,6 +71,27 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
if (l->l_info[DT_JMPREL] && lazy)
{
+ unsigned int eax, ebx, ecx, edx;
+ bool has_avx, has_avx512f;
+
+ __cpuid (1, eax, ebx, ecx, edx);
+ if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE))
+ {
+ __cpuid_count (7, 0, eax, ebx, ecx, edx);
+ has_avx512f = (ebx & bit_AVX512F) != 0;
+
+ /* Verify that ZMM, YMM and XMM states are enabled. */
+ asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
+ has_avx = (eax & 6) == 6;
+ if (has_avx512f)
+ has_avx512f = (eax & 0xe6) == 0xe6;
+ }
+ else
+ {
+ has_avx = false;
+ has_avx512f = false;
+ }
+
/* The GOT entries for functions in the PLT have not yet been filled
in. Their initial contents will arrange when called to push an
offset into the .rel.plt section, push _GLOBAL_OFFSET_TABLE_[1],
@@ -94,7 +116,12 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
end in this function. */
if (__glibc_unlikely (profile))
{
- *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_profile;
+ if (has_avx)
+ *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_profile;
+ else if (has_avx512f)
+ *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_profile;
+ else
+ *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_profile;
if (GLRO(dl_profile) != NULL
&& _dl_name_match_p (GLRO(dl_profile), l))
@@ -103,9 +130,17 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
GL(dl_profile_map) = l;
}
else
- /* This function will get called to fix up the GOT entry indicated by
- the offset on the stack, and then jump to the resolved address. */
- *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve;
+ {
+ /* This function will get called to fix up the GOT entry
+ indicated by the offset on the stack, and then jump to
+ the resolved address. */
+ if (has_avx)
+ *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve;
+ else if (has_avx512f)
+ *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve;
+ else
+ *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve;
+ }
}
if (l->l_info[ADDRIDX (DT_TLSDESC_GOT)] && lazy)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=856a4116f1f939e81197afce989fa91a1c1ea079
commit 856a4116f1f939e81197afce989fa91a1c1ea079
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sat Jul 11 13:25:25 2015 -0700
Save and restore xmm0-xmm7 in _dl_runtime_resolve
diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S
index 678c57f..c527881 100644
--- a/sysdeps/x86_64/dl-trampoline.S
+++ b/sysdeps/x86_64/dl-trampoline.S
@@ -27,26 +27,36 @@
/* Area on stack to save and restore registers used for parameter
passing when calling _dl_fixup. */
#ifdef __ILP32__
-/* X32 saves RCX, RDX, RSI, RDI, R8 and R9 plus RAX. */
-# define REGISTER_SAVE_AREA (8 * 7)
-# define REGISTER_SAVE_RAX 0
+/* X32 saves RCX, RDX, RSI, RDI, R8 and R9 plus RAX as well as XMM0 to
+ XMM7. */
+# define REGISTER_SAVE_AREA (8 * 7 + 16 * 8)
+/* Align XMM register save area to 16 bytes. */
+# define REGISTER_SAVE_XMM0 0
# define PRESERVE_BND_REGS_PREFIX
#else
-/* X86-64 saves RCX, RDX, RSI, RDI, R8 and R9 plus RAX as well as BND0,
- BND1, BND2, BND3. */
-# define REGISTER_SAVE_AREA (8 * 7 + 16 * 4)
+/* X86-64 saves RCX, RDX, RSI, RDI, R8 and R9 plus RAX as well as
+ BND0, BND1, BND2, BND3 and XMM0 to XMM7. */
+# define REGISTER_SAVE_AREA (8 * 7 + 16 * 4 + 16 * 8)
/* Align bound register save area to 16 bytes. */
# define REGISTER_SAVE_BND0 0
# define REGISTER_SAVE_BND1 (REGISTER_SAVE_BND0 + 16)
# define REGISTER_SAVE_BND2 (REGISTER_SAVE_BND1 + 16)
# define REGISTER_SAVE_BND3 (REGISTER_SAVE_BND2 + 16)
-# define REGISTER_SAVE_RAX (REGISTER_SAVE_BND3 + 16)
+# define REGISTER_SAVE_XMM0 (REGISTER_SAVE_BND3 + 16)
# ifdef HAVE_MPX_SUPPORT
# define PRESERVE_BND_REGS_PREFIX bnd
# else
# define PRESERVE_BND_REGS_PREFIX .byte 0xf2
# endif
#endif
+#define REGISTER_SAVE_XMM1 (REGISTER_SAVE_XMM0 + 16)
+#define REGISTER_SAVE_XMM2 (REGISTER_SAVE_XMM1 + 16)
+#define REGISTER_SAVE_XMM3 (REGISTER_SAVE_XMM2 + 16)
+#define REGISTER_SAVE_XMM4 (REGISTER_SAVE_XMM3 + 16)
+#define REGISTER_SAVE_XMM5 (REGISTER_SAVE_XMM4 + 16)
+#define REGISTER_SAVE_XMM6 (REGISTER_SAVE_XMM5 + 16)
+#define REGISTER_SAVE_XMM7 (REGISTER_SAVE_XMM6 + 16)
+#define REGISTER_SAVE_RAX (REGISTER_SAVE_XMM7 + 16)
#define REGISTER_SAVE_RCX (REGISTER_SAVE_RAX + 8)
#define REGISTER_SAVE_RDX (REGISTER_SAVE_RCX + 8)
#define REGISTER_SAVE_RSI (REGISTER_SAVE_RDX + 8)
@@ -54,6 +64,10 @@
#define REGISTER_SAVE_R8 (REGISTER_SAVE_RDI + 8)
#define REGISTER_SAVE_R9 (REGISTER_SAVE_R8 + 8)
+#if (REGISTER_SAVE_AREA % 16) != 8
+# error REGISTER_SAVE_AREA must be odd multples of 8
+#endif
+
.text
.globl _dl_runtime_resolve
.type _dl_runtime_resolve, @function
@@ -71,6 +85,15 @@ _dl_runtime_resolve:
movq %rdi, REGISTER_SAVE_RDI(%rsp)
movq %r8, REGISTER_SAVE_R8(%rsp)
movq %r9, REGISTER_SAVE_R9(%rsp)
+ # movaps is 1-byte shorter.
+ movaps %xmm0, REGISTER_SAVE_XMM0(%rsp)
+ movaps %xmm1, REGISTER_SAVE_XMM1(%rsp)
+ movaps %xmm2, REGISTER_SAVE_XMM2(%rsp)
+ movaps %xmm3, REGISTER_SAVE_XMM3(%rsp)
+ movaps %xmm4, REGISTER_SAVE_XMM4(%rsp)
+ movaps %xmm5, REGISTER_SAVE_XMM5(%rsp)
+ movaps %xmm6, REGISTER_SAVE_XMM6(%rsp)
+ movaps %xmm7, REGISTER_SAVE_XMM7(%rsp)
#ifndef __ILP32__
# We also have to preserve bound registers. These are nops if
# Intel MPX isn't available or disabled.
@@ -123,6 +146,15 @@ _dl_runtime_resolve:
movq REGISTER_SAVE_RDX(%rsp), %rdx
movq REGISTER_SAVE_RCX(%rsp), %rcx
movq REGISTER_SAVE_RAX(%rsp), %rax
+ # movaps is 1-byte shorter.
+ movaps REGISTER_SAVE_XMM0(%rsp), %xmm0
+ movaps REGISTER_SAVE_XMM1(%rsp), %xmm1
+ movaps REGISTER_SAVE_XMM2(%rsp), %xmm2
+ movaps REGISTER_SAVE_XMM3(%rsp), %xmm3
+ movaps REGISTER_SAVE_XMM4(%rsp), %xmm4
+ movaps REGISTER_SAVE_XMM5(%rsp), %xmm5
+ movaps REGISTER_SAVE_XMM6(%rsp), %xmm6
+ movaps REGISTER_SAVE_XMM7(%rsp), %xmm7
# Adjust stack(PLT did 2 pushes)
addq $(REGISTER_SAVE_AREA + 16), %rsp
cfi_adjust_cfa_offset(-(REGISTER_SAVE_AREA + 16))
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=568bd0a08f7383197b338f3f40a57b7b9cdc02ab
commit 568bd0a08f7383197b338f3f40a57b7b9cdc02ab
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sun Jul 12 14:41:20 2015 -0700
Align the stack before calling __errno_location
diff --git a/sysdeps/x86_64/fpu/s_cosf.S b/sysdeps/x86_64/fpu/s_cosf.S
index b7868ce..bea10ef 100644
--- a/sysdeps/x86_64/fpu/s_cosf.S
+++ b/sysdeps/x86_64/fpu/s_cosf.S
@@ -310,8 +310,14 @@ L(arg_inf_or_nan):
/* Here if |x| is Inf or NAN */
jne L(skip_errno_setting) /* in case of x is NaN */
+ /* Align stack to 16 bytes. */
+ subq $8, %rsp
+ cfi_adjust_cfa_offset (8)
/* Here if x is Inf. Set errno to EDOM. */
call JUMPTARGET(__errno_location)
+ addq $8, %rsp
+ cfi_adjust_cfa_offset (-8)
+
movl $EDOM, (%rax)
.p2align 4
diff --git a/sysdeps/x86_64/fpu/s_sincosf.S b/sysdeps/x86_64/fpu/s_sincosf.S
index 21db70a..a2f3133 100644
--- a/sysdeps/x86_64/fpu/s_sincosf.S
+++ b/sysdeps/x86_64/fpu/s_sincosf.S
@@ -354,8 +354,14 @@ L(arg_inf_or_nan):
/* Here if |x| is Inf or NAN */
jne L(skip_errno_setting) /* in case of x is NaN */
+ /* Align stack to 16 bytes. */
+ subq $8, %rsp
+ cfi_adjust_cfa_offset (8)
/* Here if x is Inf. Set errno to EDOM. */
call JUMPTARGET(__errno_location)
+ addq $8, %rsp
+ cfi_adjust_cfa_offset (-8)
+
movl $EDOM, (%rax)
.p2align 4
diff --git a/sysdeps/x86_64/fpu/s_sinf.S b/sysdeps/x86_64/fpu/s_sinf.S
index dc92164..90afbe8 100644
--- a/sysdeps/x86_64/fpu/s_sinf.S
+++ b/sysdeps/x86_64/fpu/s_sinf.S
@@ -336,8 +336,14 @@ L(arg_inf_or_nan):
/* Here if |x| is Inf or NAN */
jne L(skip_errno_setting) /* in case of x is NaN */
+ /* Align stack to 16 bytes. */
+ subq $8, %rsp
+ cfi_adjust_cfa_offset (8)
/* Here if x is Inf. Set errno to EDOM. */
call JUMPTARGET(__errno_location)
+ addq $8, %rsp
+ cfi_adjust_cfa_offset (-8)
+
movl $EDOM, (%rax)
.p2align 4
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a1cb3d630d9a28458220464f3935aef1157f69a2
commit a1cb3d630d9a28458220464f3935aef1157f69a2
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sun Jul 12 14:40:25 2015 -0700
Align the stack before calling __gettimeofday
diff --git a/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
index 0935db5..23f3def 100644
--- a/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
+++ b/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
@@ -394,8 +394,8 @@ __lll_timedwait_tid:
movq %rdi, %r12
movq %rsi, %r13
- subq $16, %rsp
- cfi_adjust_cfa_offset(16)
+ subq $24, %rsp
+ cfi_adjust_cfa_offset(24)
/* Get current time. */
2: movq %rsp, %rdi
@@ -441,8 +441,8 @@ __lll_timedwait_tid:
jne 1f
4: xorl %eax, %eax
-8: addq $16, %rsp
- cfi_adjust_cfa_offset(-16)
+8: addq $24, %rsp
+ cfi_adjust_cfa_offset(-24)
popq %r13
cfi_adjust_cfa_offset(-8)
cfi_restore(%r13)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1fc73512dcc30036ffa9ef7363a9eb3442972e27
commit 1fc73512dcc30036ffa9ef7363a9eb3442972e27
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sun Jul 12 14:38:58 2015 -0700
Align stack before calling __setcontext
diff --git a/sysdeps/unix/sysv/linux/x86_64/__start_context.S b/sysdeps/unix/sysv/linux/x86_64/__start_context.S
index 52a5afa..57ee2b9 100644
--- a/sysdeps/unix/sysv/linux/x86_64/__start_context.S
+++ b/sysdeps/unix/sysv/linux/x86_64/__start_context.S
@@ -33,6 +33,11 @@ ENTRY(__start_context)
popq %rdi /* This is the next context. */
cfi_adjust_cfa_offset(-8)
+
+ /* Align stack to 16 bytes. */
+ subq $8, %rsp
+ cfi_adjust_cfa_offset (8)
+
testq %rdi, %rdi
je 2f /* If it is zero exit. */
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources