diff -ur eglibc-2.11.2//sysdeps/x86_64/dl-trampoline.S eglibc-2.11.2.changed//sysdeps/x86_64/dl-trampoline.S --- eglibc-2.11.2//sysdeps/x86_64/dl-trampoline.S 2009-08-26 05:17:41.000000000 +0300 +++ eglibc-2.11.2.changed//sysdeps/x86_64/dl-trampoline.S 2011-10-25 01:10:36.153062354 +0300 @@ -139,16 +139,26 @@ movl $1, %eax cpuid movq %r11,%rbx # Restore rbx - movl $1, %eax - testl $(1 << 28), %ecx + xorl %eax, %eax + // AVX and XSAVE supported? + andl $((1 << 28) | (1 << 27)), %ecx + cmpl $((1 << 28) | (1 << 27)), %ecx jne 2f - negl %eax -2: movl %eax, L(have_avx)(%rip) + xorl %ecx, %ecx + // Get XFEATURE_ENABLED_MASK + xgetbv + andl $0x6, %eax + cmpl $0x6, %eax + // Nonzero if SSE and AVX state saving is enabled. + sete %al +2: leal -1(%eax,%eax), %eax + movl %eax, L(have_avx)(%rip) cmpl $0, %eax 1: js L(no_avx) # define RESTORE_AVX +# define MORE_CODE # include "dl-trampoline.h" .align 16 @@ -176,11 +186,20 @@ movl $1, %eax cpuid movq %r11,%rbx # Restore rbx - movl $1, %eax - testl $(1 << 28), %ecx + xorl %eax, %eax + // AVX and XSAVE supported? + andl $((1 << 28) | (1 << 27)), %ecx + cmpl $((1 << 28) | (1 << 27)), %ecx jne 2f - negl %eax -2: movl %eax, L(have_avx)(%rip) + xorl %ecx, %ecx + // Get XFEATURE_ENABLED_MASK + xgetbv + andl $0x6, %eax + cmpl $0x6, %eax + // Nonzero if SSE and AVX state saving is enabled. + sete %al +2: leal -1(%eax,%eax), %eax + movl %eax, L(have_avx)(%rip) cmpl $0, %eax 1: js L(no_avx5) diff -ur eglibc-2.11.2//sysdeps/x86_64/dl-trampoline.h eglibc-2.11.2.changed//sysdeps/x86_64/dl-trampoline.h --- eglibc-2.11.2//sysdeps/x86_64/dl-trampoline.h 2009-08-09 17:33:15.000000000 +0300 +++ eglibc-2.11.2.changed//sysdeps/x86_64/dl-trampoline.h 2011-10-25 01:15:09.501060129 +0300 @@ -267,3 +267,10 @@ # (eats the reloc index and link_map) cfi_adjust_cfa_offset(-48) retq + +#ifdef MORE_CODE + cfi_adjust_cfa_offset(48) + cfi_rel_offset(%rbx, 0) + cfi_def_cfa_register(%rbx) +# undef MORE_CODE +#endif