|
Packit |
6c4009 |
/* PLT trampolines. x86-64 version.
|
|
Packit |
6c4009 |
Copyright (C) 2004-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <config.h>
|
|
Packit |
6c4009 |
#include <sysdep.h>
|
|
Packit Service |
8bbac7 |
#include <cpu-features.h>
|
|
Packit |
6c4009 |
#include <link-defines.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef DL_STACK_ALIGNMENT
|
|
Packit |
6c4009 |
/* Due to GCC bug:
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
__tls_get_addr may be called with 8-byte stack alignment. Although
|
|
Packit |
6c4009 |
this bug has been fixed in GCC 4.9.4, 5.3 and 6, we can't assume
|
|
Packit |
6c4009 |
that stack will be always aligned at 16 bytes. We use unaligned
|
|
Packit |
6c4009 |
16-byte move to load and store SSE registers, which has no penalty
|
|
Packit |
6c4009 |
on modern processors if stack is 16-byte aligned. */
|
|
Packit |
6c4009 |
# define DL_STACK_ALIGNMENT 8
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* True if _dl_runtime_resolve should align stack for STATE_SAVE or align
|
|
Packit |
6c4009 |
stack to 16 bytes before calling _dl_fixup. */
|
|
Packit |
6c4009 |
#define DL_RUNTIME_RESOLVE_REALIGN_STACK \
|
|
Packit |
6c4009 |
(STATE_SAVE_ALIGNMENT > DL_STACK_ALIGNMENT \
|
|
Packit |
6c4009 |
|| 16 > DL_STACK_ALIGNMENT)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Area on stack to save and restore registers used for parameter
|
|
Packit |
6c4009 |
passing when calling _dl_fixup. */
|
|
Packit |
6c4009 |
#ifdef __ILP32__
|
|
Packit |
6c4009 |
# define PRESERVE_BND_REGS_PREFIX
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# ifdef HAVE_MPX_SUPPORT
|
|
Packit |
6c4009 |
# define PRESERVE_BND_REGS_PREFIX bnd
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define PRESERVE_BND_REGS_PREFIX .byte 0xf2
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#define REGISTER_SAVE_RAX 0
|
|
Packit |
6c4009 |
#define REGISTER_SAVE_RCX (REGISTER_SAVE_RAX + 8)
|
|
Packit |
6c4009 |
#define REGISTER_SAVE_RDX (REGISTER_SAVE_RCX + 8)
|
|
Packit |
6c4009 |
#define REGISTER_SAVE_RSI (REGISTER_SAVE_RDX + 8)
|
|
Packit |
6c4009 |
#define REGISTER_SAVE_RDI (REGISTER_SAVE_RSI + 8)
|
|
Packit |
6c4009 |
#define REGISTER_SAVE_R8 (REGISTER_SAVE_RDI + 8)
|
|
Packit |
6c4009 |
#define REGISTER_SAVE_R9 (REGISTER_SAVE_R8 + 8)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define RESTORE_AVX
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define VEC_SIZE 64
|
|
Packit |
6c4009 |
#define VMOVA vmovdqa64
|
|
Packit |
6c4009 |
#define VEC(i) zmm##i
|
|
Packit |
6c4009 |
#define _dl_runtime_profile _dl_runtime_profile_avx512
|
|
Packit |
6c4009 |
#include "dl-trampoline.h"
|
|
Packit |
6c4009 |
#undef _dl_runtime_profile
|
|
Packit |
6c4009 |
#undef VEC
|
|
Packit |
6c4009 |
#undef VMOVA
|
|
Packit |
6c4009 |
#undef VEC_SIZE
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define VEC_SIZE 32
|
|
Packit |
6c4009 |
#define VMOVA vmovdqa
|
|
Packit |
6c4009 |
#define VEC(i) ymm##i
|
|
Packit |
6c4009 |
#define _dl_runtime_profile _dl_runtime_profile_avx
|
|
Packit |
6c4009 |
#include "dl-trampoline.h"
|
|
Packit |
6c4009 |
#undef _dl_runtime_profile
|
|
Packit |
6c4009 |
#undef VEC
|
|
Packit |
6c4009 |
#undef VMOVA
|
|
Packit |
6c4009 |
#undef VEC_SIZE
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* movaps/movups is 1-byte shorter. */
|
|
Packit |
6c4009 |
#define VEC_SIZE 16
|
|
Packit |
6c4009 |
#define VMOVA movaps
|
|
Packit |
6c4009 |
#define VEC(i) xmm##i
|
|
Packit |
6c4009 |
#define _dl_runtime_profile _dl_runtime_profile_sse
|
|
Packit |
6c4009 |
#undef RESTORE_AVX
|
|
Packit |
6c4009 |
#include "dl-trampoline.h"
|
|
Packit |
6c4009 |
#undef _dl_runtime_profile
|
|
Packit |
6c4009 |
#undef VEC
|
|
Packit |
6c4009 |
#undef VMOVA
|
|
Packit |
6c4009 |
#undef VEC_SIZE
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define USE_FXSAVE
|
|
Packit |
6c4009 |
#define STATE_SAVE_ALIGNMENT 16
|
|
Packit |
6c4009 |
#define _dl_runtime_resolve _dl_runtime_resolve_fxsave
|
|
Packit |
6c4009 |
#include "dl-trampoline.h"
|
|
Packit |
6c4009 |
#undef _dl_runtime_resolve
|
|
Packit |
6c4009 |
#undef USE_FXSAVE
|
|
Packit |
6c4009 |
#undef STATE_SAVE_ALIGNMENT
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define USE_XSAVE
|
|
Packit |
6c4009 |
#define STATE_SAVE_ALIGNMENT 64
|
|
Packit |
6c4009 |
#define _dl_runtime_resolve _dl_runtime_resolve_xsave
|
|
Packit |
6c4009 |
#include "dl-trampoline.h"
|
|
Packit |
6c4009 |
#undef _dl_runtime_resolve
|
|
Packit |
6c4009 |
#undef USE_XSAVE
|
|
Packit |
6c4009 |
#undef STATE_SAVE_ALIGNMENT
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define USE_XSAVEC
|
|
Packit |
6c4009 |
#define STATE_SAVE_ALIGNMENT 64
|
|
Packit |
6c4009 |
#define _dl_runtime_resolve _dl_runtime_resolve_xsavec
|
|
Packit |
6c4009 |
#include "dl-trampoline.h"
|
|
Packit |
6c4009 |
#undef _dl_runtime_resolve
|
|
Packit |
6c4009 |
#undef USE_XSAVEC
|
|
Packit |
6c4009 |
#undef STATE_SAVE_ALIGNMENT
|