]>
Commit | Line | Data |
---|---|---|
9dcafc55 | 1 | /* PLT trampolines. x86-64 version. |
688903eb | 2 | Copyright (C) 2004-2018 Free Software Foundation, Inc. |
9dcafc55 UD |
3 | This file is part of the GNU C Library. |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
9dcafc55 | 18 | |
b0ecde3a | 19 | #include <config.h> |
9dcafc55 | 20 | #include <sysdep.h> |
fb0f7a67 | 21 | #include <cpu-features.h> |
b0ecde3a | 22 | #include <link-defines.h> |
9dcafc55 | 23 | |
f3dcae82 L |
24 | #ifndef DL_STACK_ALIGNMENT |
25 | /* Due to GCC bug: | |
26 | ||
27 | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066 | |
28 | ||
29 | __tls_get_addr may be called with 8-byte stack alignment. Although | |
30 | this bug has been fixed in GCC 4.9.4, 5.3 and 6, we can't assume | |
31 | that stack will be always aligned at 16 bytes. We use unaligned | |
32 | 16-byte move to load and store SSE registers, which has no penalty | |
33 | on modern processors if stack is 16-byte aligned. */ | |
34 | # define DL_STACK_ALIGNMENT 8 | |
35 | #endif | |
36 | ||
b52b0d79 L |
37 | /* True if _dl_runtime_resolve should align stack for STATE_SAVE or align |
38 | stack to 16 bytes before calling _dl_fixup. */ | |
8d9c9201 | 39 | #define DL_RUNTIME_RESOLVE_REALIGN_STACK \ |
b52b0d79 L |
40 | (STATE_SAVE_ALIGNMENT > DL_STACK_ALIGNMENT \ |
41 | || 16 > DL_STACK_ALIGNMENT) | |
f3dcae82 | 42 | |
a4c75cfd IZ |
43 | /* Area on stack to save and restore registers used for parameter |
44 | passing when calling _dl_fixup. */ | |
45 | #ifdef __ILP32__ | |
b97eb2bd | 46 | # define PRESERVE_BND_REGS_PREFIX |
a4c75cfd | 47 | #else |
b97eb2bd L |
48 | # ifdef HAVE_MPX_SUPPORT |
49 | # define PRESERVE_BND_REGS_PREFIX bnd | |
50 | # else | |
51 | # define PRESERVE_BND_REGS_PREFIX .byte 0xf2 | |
52 | # endif | |
a4c75cfd | 53 | #endif |
b52b0d79 | 54 | #define REGISTER_SAVE_RAX 0 |
a4c75cfd IZ |
55 | #define REGISTER_SAVE_RCX (REGISTER_SAVE_RAX + 8) |
56 | #define REGISTER_SAVE_RDX (REGISTER_SAVE_RCX + 8) | |
57 | #define REGISTER_SAVE_RSI (REGISTER_SAVE_RDX + 8) | |
58 | #define REGISTER_SAVE_RDI (REGISTER_SAVE_RSI + 8) | |
59 | #define REGISTER_SAVE_R8 (REGISTER_SAVE_RDI + 8) | |
60 | #define REGISTER_SAVE_R9 (REGISTER_SAVE_R8 + 8) | |
61 | ||
0a5768fe L |
62 | #define RESTORE_AVX |
63 | ||
f43cb35c L |
64 | #define VEC_SIZE 64 |
65 | #define VMOVA vmovdqa64 | |
f43cb35c | 66 | #define VEC(i) zmm##i |
f43cb35c L |
67 | #define _dl_runtime_profile _dl_runtime_profile_avx512 |
68 | #include "dl-trampoline.h" | |
f43cb35c L |
69 | #undef _dl_runtime_profile |
70 | #undef VEC | |
f43cb35c L |
71 | #undef VMOVA |
72 | #undef VEC_SIZE | |
f3dcae82 L |
73 | |
74 | #define VEC_SIZE 32 | |
75 | #define VMOVA vmovdqa | |
f3dcae82 | 76 | #define VEC(i) ymm##i |
f3dcae82 L |
77 | #define _dl_runtime_profile _dl_runtime_profile_avx |
78 | #include "dl-trampoline.h" | |
f3dcae82 L |
79 | #undef _dl_runtime_profile |
80 | #undef VEC | |
f3dcae82 L |
81 | #undef VMOVA |
82 | #undef VEC_SIZE | |
83 | ||
84 | /* movaps/movups is 1-byte shorter. */ | |
85 | #define VEC_SIZE 16 | |
86 | #define VMOVA movaps | |
f3dcae82 | 87 | #define VEC(i) xmm##i |
f3dcae82 L |
88 | #define _dl_runtime_profile _dl_runtime_profile_sse |
89 | #undef RESTORE_AVX | |
90 | #include "dl-trampoline.h" | |
fb0f7a67 | 91 | #undef _dl_runtime_profile |
b52b0d79 | 92 | #undef VEC |
fb0f7a67 | 93 | #undef VMOVA |
b52b0d79 | 94 | #undef VEC_SIZE |
fb0f7a67 | 95 | |
b52b0d79 L |
96 | #define USE_FXSAVE |
97 | #define STATE_SAVE_ALIGNMENT 16 | |
98 | #define _dl_runtime_resolve _dl_runtime_resolve_fxsave | |
99 | #include "dl-trampoline.h" | |
100 | #undef _dl_runtime_resolve | |
101 | #undef USE_FXSAVE | |
102 | #undef STATE_SAVE_ALIGNMENT | |
103 | ||
104 | #define USE_XSAVE | |
105 | #define STATE_SAVE_ALIGNMENT 64 | |
106 | #define _dl_runtime_resolve _dl_runtime_resolve_xsave | |
107 | #include "dl-trampoline.h" | |
108 | #undef _dl_runtime_resolve | |
109 | #undef USE_XSAVE | |
110 | #undef STATE_SAVE_ALIGNMENT | |
111 | ||
112 | #define USE_XSAVEC | |
113 | #define STATE_SAVE_ALIGNMENT 64 | |
114 | #define _dl_runtime_resolve _dl_runtime_resolve_xsavec | |
fb0f7a67 | 115 | #include "dl-trampoline.h" |
b52b0d79 L |
116 | #undef _dl_runtime_resolve |
117 | #undef USE_XSAVEC | |
118 | #undef STATE_SAVE_ALIGNMENT |