1 /* Support for GNU properties. AArch64 version.
2 Copyright (C) 2018-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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 <https://www.gnu.org/licenses/>. */
22 extern void _dl_bti_protect (struct link_map
*, int) attribute_hidden
;
24 extern void _dl_bti_check (struct link_map
*, const char *)
27 static inline void __attribute__ ((always_inline
))
28 _rtld_main_check (struct link_map
*m
, const char *program
)
30 _dl_bti_check (m
, program
);
33 static inline void __attribute__ ((always_inline
))
34 _dl_open_check (struct link_map
*m
)
36 _dl_bti_check (m
, NULL
);
39 static inline void __attribute__ ((always_inline
))
40 _dl_process_pt_note (struct link_map
*l
, int fd
, const ElfW(Phdr
) *ph
)
45 _dl_process_gnu_property (struct link_map
*l
, int fd
, uint32_t type
,
46 uint32_t datasz
, void *data
)
48 if (!GLRO(dl_aarch64_cpu_features
).bti
)
49 /* Skip note processing. */
52 if (type
== GNU_PROPERTY_AARCH64_FEATURE_1_AND
)
54 /* Stop if the property note is ill-formed. */
58 unsigned int feature_1
= *(unsigned int *) data
;
59 if (feature_1
& GNU_PROPERTY_AARCH64_FEATURE_1_BTI
)
60 _dl_bti_protect (l
, fd
);
62 /* Stop if we processed the property note. */
69 #endif /* _DL_PROP_H */