]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
1c6705069d8349f309c557b15fc0d404acbec4cf
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / x86_64 / 64 / dl-librecon.h
1 /* Optional code to distinguish library flavours. x86-64 version.
2 Copyright (C) 2015-2016 Free Software Foundation, Inc.
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
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19 #ifndef _DL_LIBRECON_H
20
21 #include <sysdeps/unix/sysv/linux/dl-librecon.h>
22
23 /* Recognizing extra environment variables. For 64-bit applications,
24 branch prediction performance may be negatively impacted when the
25 target of a branch is more than 4GB away from the branch. Add the
26 Prefer_MAP_32BIT_EXEC bit so that mmap will try to map executable
27 pages with MAP_32BIT first. NB: MAP_32BIT will map to lower 2GB,
28 not lower 4GB, address. Prefer_MAP_32BIT_EXEC reduces bits available
29 for address space layout randomization (ASLR). Prefer_MAP_32BIT_EXEC
30 is always disabled for SUID programs and can be enabled by setting
31 environment variable, LD_PREFER_MAP_32BIT_EXEC. */
32 #define EXTRA_LD_ENVVARS \
33 case 21: \
34 if (memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0) \
35 GLRO(dl_x86_cpu_features).feature[index_arch_Prefer_MAP_32BIT_EXEC] \
36 |= bit_arch_Prefer_MAP_32BIT_EXEC; \
37 break;
38
39 /* Extra unsecure variables. The names are all stuffed in a single
40 string which means they have to be terminated with a '\0' explicitly. */
41 #define EXTRA_UNSECURE_ENVVARS \
42 "LD_PREFER_MAP_32BIT_EXEC\0"
43
44 #endif /* dl-librecon.h */