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 (!__libc_enable_secure \
35 && memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0) \
36 GLRO(dl_x86_cpu_features).feature[index_arch_Prefer_MAP_32BIT_EXEC] \
37 |= bit_arch_Prefer_MAP_32BIT_EXEC; \
38 break;
39
40/* Extra unsecure variables. The names are all stuffed in a single
41 string which means they have to be terminated with a '\0' explicitly. */
42#define EXTRA_UNSECURE_ENVVARS \
43 "LD_PREFER_MAP_32BIT_EXEC\0"
44
45#endif /* dl-librecon.h */
46