This is the mail archive of the glibc-cvs@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]

GNU C Library master sources branch hjl/pr18661 updated. glibc-2.21-662-g811a974


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 updated
       via  811a974a1d234620d2e897f0554fbf42fda2ffcc (commit)
       via  b7d23a05ae704fc0b8c4a418197bb6e84cebe7ab (commit)
      from  e52b127fe28fce951cab0bcc55904b68dd39a6c3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=811a974a1d234620d2e897f0554fbf42fda2ffcc

commit 811a974a1d234620d2e897f0554fbf42fda2ffcc
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jul 28 06:55:09 2015 -0700

    Use avx_usable, avx512f_usable

diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 7ec39dc..920ec45 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -72,26 +72,34 @@ 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;
+      bool avx_usable, avx512f_usable;
+      static int has_avx;
+      static int 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;
+	  avx512f_usable = (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;
+	  avx_usable = (eax & 6) == 6;
+	  if (avx512f_usable)
+	    avx512f_usable = (eax & 0xe6) == 0xe6;
 	}
       else
 	{
-	  has_avx = false;
-	  has_avx512f = false;
+	  avx_usable = false;
+	  avx512f_usable = false;
 	}
 
+      has_avx = avx_usable;
+      has_avx512f = avx512f_usable;
+
+      (void) has_avx;
+      (void) has_avx512f;
+
       /* 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],
@@ -116,9 +124,9 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 	 end in this function.  */
       if (__glibc_unlikely (profile))
 	{
-	  if (has_avx)
+	  if (avx_usable)
 	    *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_profile;
-	  else if (has_avx512f)
+	  else if (avx512f_usable)
 	    *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_profile;
 	  else
 	    *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_profile;
@@ -134,9 +142,9 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 	  /* 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)
+	  if (avx_usable)
 	    *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve;
-	  else if (has_avx512f)
+	  else if (avx512f_usable)
 	    *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve;
 	  else
 	    *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve;
diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S
index c527881..7c8e83b 100644
--- a/sysdeps/x86_64/dl-trampoline.S
+++ b/sysdeps/x86_64/dl-trampoline.S
@@ -469,3 +469,20 @@ L(no_avx6):
 	cfi_endproc
 	.size _dl_x86_64_restore_sse, .-_dl_x86_64_restore_sse
 #endif
+
+#if 0
+	.data
+	.type	has_avx, @object
+	.globl	has_avx
+	.hidden	has_avx
+has_avx:
+	.zero 4
+	.size	has_avx, 4
+	.type	has_avx512f, @object
+	.globl	has_avx512f
+	.hidden	 has_avx512f
+has_avx512f:
+	.zero 4
+	.hidden	has_avx512f
+	.size	has_avx512f, 4
+#endif

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b7d23a05ae704fc0b8c4a418197bb6e84cebe7ab

commit b7d23a05ae704fc0b8c4a418197bb6e84cebe7ab
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jul 28 06:31:24 2015 -0700

    Add dl-resolve.h

diff --git a/sysdeps/x86_64/dl-resolve.h b/sysdeps/x86_64/dl-resolve.h
new file mode 100644
index 0000000..58af4a8
--- /dev/null
+++ b/sysdeps/x86_64/dl-resolve.h
@@ -0,0 +1,111 @@
+/* PLT trampolines.  x86-64 version.
+   Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+	.text
+	.globl _dl_runtime_resolve
+	.type _dl_runtime_resolve, @function
+	.align 16
+	cfi_startproc
+_dl_runtime_resolve:
+	cfi_adjust_cfa_offset(16) # Incorporate PLT
+	subq $REGISTER_SAVE_AREA,%rsp
+	cfi_adjust_cfa_offset(REGISTER_SAVE_AREA)
+	# Preserve registers otherwise clobbered.
+	movq %rax, REGISTER_SAVE_RAX(%rsp)
+	movq %rcx, REGISTER_SAVE_RCX(%rsp)
+	movq %rdx, REGISTER_SAVE_RDX(%rsp)
+	movq %rsi, REGISTER_SAVE_RSI(%rsp)
+	movq %rdi, REGISTER_SAVE_RDI(%rsp)
+	movq %r8, REGISTER_SAVE_R8(%rsp)
+	movq %r9, REGISTER_SAVE_R9(%rsp)
+	VMOV %VEC(0), REGISTER_SAVE_VEC(0)(%rsp)
+	VMOV %VEC(1), REGISTER_SAVE_VEC(1)(%rsp)
+	VMOV %VEC(2), REGISTER_SAVE_VEC(2)(%rsp)
+	VMOV %VEC(3), REGISTER_SAVE_VEC(3)(%rsp)
+	VMOV %VEC(4), REGISTER_SAVE_VEC(4)(%rsp)
+	VMOV %VEC(5), REGISTER_SAVE_VEC(5)(%rsp)
+	VMOV %VEC(6), REGISTER_SAVE_VEC(6)(%rsp)
+	VMOV %VEC(7), REGISTER_SAVE_VEC(7)(%rsp)
+#ifndef __ILP32__
+	# We also have to preserve bound registers.  These are nops if
+	# Intel MPX isn't available or disabled.
+# ifdef HAVE_MPX_SUPPORT
+	bndmov %bnd0, REGISTER_SAVE_BND0(%rsp)
+	bndmov %bnd1, REGISTER_SAVE_BND1(%rsp)
+	bndmov %bnd2, REGISTER_SAVE_BND2(%rsp)
+	bndmov %bnd3, REGISTER_SAVE_BND3(%rsp)
+# else
+#  if REGISTER_SAVE_BND0 == 0
+	.byte 0x66,0x0f,0x1b,0x04,0x24
+#  else
+	.byte 0x66,0x0f,0x1b,0x44,0x24,REGISTER_SAVE_BND0
+#  endif
+	.byte 0x66,0x0f,0x1b,0x4c,0x24,REGISTER_SAVE_BND1
+	.byte 0x66,0x0f,0x1b,0x54,0x24,REGISTER_SAVE_BND2
+	.byte 0x66,0x0f,0x1b,0x5c,0x24,REGISTER_SAVE_BND3
+# endif
+#endif
+	# Copy args pushed by PLT in register.
+	# %rdi: link_map, %rsi: reloc_index
+	movq (REGISTER_SAVE_AREA + 8)(%rsp), %rsi
+	movq REGISTER_SAVE_AREA(%rsp), %rdi
+	call _dl_fixup		# Call resolver.
+	movq %rax, %r11		# Save return value
+#ifndef __ILP32__
+	# Restore bound registers.  These are nops if Intel MPX isn't
+	# avaiable or disabled.
+# ifdef HAVE_MPX_SUPPORT
+	bndmov REGISTER_SAVE_BND3(%rsp), %bnd3
+	bndmov REGISTER_SAVE_BND2(%rsp), %bnd2
+	bndmov REGISTER_SAVE_BND1(%rsp), %bnd1
+	bndmov REGISTER_SAVE_BND0(%rsp), %bnd0
+# else
+	.byte 0x66,0x0f,0x1a,0x5c,0x24,REGISTER_SAVE_BND3
+	.byte 0x66,0x0f,0x1a,0x54,0x24,REGISTER_SAVE_BND2
+	.byte 0x66,0x0f,0x1a,0x4c,0x24,REGISTER_SAVE_BND1
+#  if REGISTER_SAVE_BND0 == 0
+	.byte 0x66,0x0f,0x1a,0x04,0x24
+#  else
+	.byte 0x66,0x0f,0x1a,0x44,0x24,REGISTER_SAVE_BND0
+#  endif
+# endif
+#endif
+	# Get register content back.
+	movq REGISTER_SAVE_R9(%rsp), %r9
+	movq REGISTER_SAVE_R8(%rsp), %r8
+	movq REGISTER_SAVE_RDI(%rsp), %rdi
+	movq REGISTER_SAVE_RSI(%rsp), %rsi
+	movq REGISTER_SAVE_RDX(%rsp), %rdx
+	movq REGISTER_SAVE_RCX(%rsp), %rcx
+	movq REGISTER_SAVE_RAX(%rsp), %rax
+	VMOV REGISTER_SAVE_VEC(0)(%rsp), %VEC(0)
+	VMOV REGISTER_SAVE_VEC(1)(%rsp), %VEC(1)
+	VMOV REGISTER_SAVE_VEC(2)(%rsp), %VEC(2)
+	VMOV REGISTER_SAVE_VEC(3)(%rsp), %VEC(3)
+	VMOV REGISTER_SAVE_VEC(4)(%rsp), %VEC(4)
+	VMOV REGISTER_SAVE_VEC(5)(%rsp), %VEC(5)
+	VMOV REGISTER_SAVE_VEC(6)(%rsp), %VEC(6)
+	VMOV REGISTER_SAVE_VEC(7)(%rsp), %VEC(7)
+	# Adjust stack(PLT did 2 pushes)
+	addq $(REGISTER_SAVE_AREA + 16), %rsp
+	cfi_adjust_cfa_offset(-(REGISTER_SAVE_AREA + 16))
+	# Preserve bound registers.
+	PRESERVE_BND_REGS_PREFIX
+	jmp *%r11		# Jump to function address.
+	cfi_endproc
+	.size _dl_runtime_resolve, .-_dl_runtime_resolve

-----------------------------------------------------------------------

Summary of changes:
 sysdeps/x86_64/dl-machine.h    |   30 +++++++----
 sysdeps/x86_64/dl-resolve.h    |  111 ++++++++++++++++++++++++++++++++++++++++
 sysdeps/x86_64/dl-trampoline.S |   17 ++++++
 3 files changed, 147 insertions(+), 11 deletions(-)
 create mode 100644 sysdeps/x86_64/dl-resolve.h


hooks/post-receive
-- 
GNU C Library master sources


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