|
Packit Service |
82fcde |
/* Stack-aligning implementation of __tls_get_addr. x86-64 version.
|
|
Packit Service |
82fcde |
Copyright (C) 2017-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
This file is part of the GNU C Library.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
82fcde |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License as published by the Free Software Foundation; either
|
|
Packit Service |
82fcde |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
82fcde |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
82fcde |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
82fcde |
Lesser General Public License for more details.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License along with the GNU C Library; if not, see
|
|
Packit Service |
82fcde |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#ifdef SHARED
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
# include <sysdep.h>
|
|
Packit Service |
82fcde |
# include "tlsdesc.h"
|
|
Packit Service |
82fcde |
# include "rtld-offsets.h"
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* See __tls_get_addr and __tls_get_addr_slow in dl-tls.c. This function
|
|
Packit Service |
82fcde |
call __tls_get_addr_slow on both slow paths. It realigns the stack
|
|
Packit Service |
82fcde |
before the call to work around GCC PR58066. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
ENTRY (__tls_get_addr)
|
|
Packit Service |
82fcde |
mov %fs:DTV_OFFSET, %RDX_LP
|
|
Packit Service |
82fcde |
mov GL_TLS_GENERATION_OFFSET+_rtld_local(%rip), %RAX_LP
|
|
Packit Service |
82fcde |
/* GL(dl_tls_generation) == dtv[0].counter */
|
|
Packit Service |
82fcde |
cmp %RAX_LP, (%rdx)
|
|
Packit Service |
82fcde |
jne 1f
|
|
Packit Service |
82fcde |
mov TI_MODULE_OFFSET(%rdi), %RAX_LP
|
|
Packit Service |
82fcde |
/* dtv[ti->ti_module] */
|
|
Packit Service |
82fcde |
# ifdef __LP64__
|
|
Packit Service |
82fcde |
salq $4, %rax
|
|
Packit Service |
82fcde |
movq (%rdx,%rax), %rax
|
|
Packit Service |
82fcde |
# else
|
|
Packit Service |
82fcde |
movl (%rdx,%rax, 8), %eax
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
cmp $-1, %RAX_LP
|
|
Packit Service |
82fcde |
je 1f
|
|
Packit Service |
82fcde |
add TI_OFFSET_OFFSET(%rdi), %RAX_LP
|
|
Packit Service |
82fcde |
ret
|
|
Packit Service |
82fcde |
1:
|
|
Packit Service |
82fcde |
/* On the slow path, align the stack. */
|
|
Packit Service |
82fcde |
pushq %rbp
|
|
Packit Service |
82fcde |
cfi_def_cfa_offset (16)
|
|
Packit Service |
82fcde |
cfi_offset (%rbp, -16)
|
|
Packit Service |
82fcde |
mov %RSP_LP, %RBP_LP
|
|
Packit Service |
82fcde |
cfi_def_cfa_register (%rbp)
|
|
Packit Service |
82fcde |
and $-16, %RSP_LP
|
|
Packit Service |
82fcde |
call __tls_get_addr_slow
|
|
Packit Service |
82fcde |
mov %RBP_LP, %RSP_LP
|
|
Packit Service |
82fcde |
popq %rbp
|
|
Packit Service |
82fcde |
cfi_def_cfa (%rsp, 8)
|
|
Packit Service |
82fcde |
ret
|
|
Packit Service |
82fcde |
END (__tls_get_addr)
|
|
Packit Service |
82fcde |
#endif /* SHARED */
|