GNU Binutils with patches for OS216
Revisión | a8bfaadbb40406dc795d410d198a4be9d452c177 (tree) |
---|---|
Tiempo | 2019-09-23 09:57:21 |
Autor | Alan Modra <amodra@gmai...> |
Commiter | Alan Modra |
aarch64 bfd.h tidy
bfd/
* bfd-in.h: Move aarch64 declarations and defines..
* cpu-aarch64.h: ..to here, new file..
* elfxx-aarch64.h: ..and here.
* cpu-aarch64.c: Include cpu-aarch64.h.
* elfnn-aarch64.c: Likewise.
* bfd-in2.h: Regenerate.
ld/
* emultempl/aarch64elf.em: Include elfxx-aarch64.h.
@@ -1,5 +1,14 @@ | ||
1 | 1 | 2019-09-23 Alan Modra <amodra@gmail.com> |
2 | 2 | |
3 | + * bfd-in.h: Move aarch64 declarations and defines.. | |
4 | + * cpu-aarch64.h: ..to here, new file.. | |
5 | + * elfxx-aarch64.h: ..and here. | |
6 | + * cpu-aarch64.c: Include cpu-aarch64.h. | |
7 | + * elfnn-aarch64.c: Likewise. | |
8 | + * bfd-in2.h: Regenerate. | |
9 | + | |
10 | +2019-09-23 Alan Modra <amodra@gmail.com> | |
11 | + | |
3 | 12 | * bfd-in.h: Delete ticoff function declarations. |
4 | 13 | * coff-tic54x.c (bfd_ticoff_set_section_load_page), |
5 | 14 | (bfd_ticoff_get_section_load_page): Make static. |
@@ -907,89 +907,3 @@ extern bfd_boolean elf32_arm_fix_exidx_coverage | ||
907 | 907 | /* C6x unwind section editing support. */ |
908 | 908 | extern bfd_boolean elf32_tic6x_fix_exidx_coverage |
909 | 909 | (struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean); |
910 | - | |
911 | -extern void bfd_elf64_aarch64_init_maps | |
912 | - (bfd *); | |
913 | - | |
914 | -extern void bfd_elf32_aarch64_init_maps | |
915 | - (bfd *); | |
916 | - | |
917 | -/* Types of PLTs based on the level of security. This would be a | |
918 | - bit-mask to denote which of the combinations of security features | |
919 | - are enabled: | |
920 | - - No security feature PLTs | |
921 | - - PLTs with BTI instruction | |
922 | - - PLTs with PAC instruction | |
923 | -*/ | |
924 | -typedef enum | |
925 | -{ | |
926 | - PLT_NORMAL = 0x0, /* Normal plts. */ | |
927 | - PLT_BTI = 0x1, /* plts with bti. */ | |
928 | - PLT_PAC = 0x2, /* plts with pointer authentication. */ | |
929 | - PLT_BTI_PAC = PLT_BTI | PLT_PAC | |
930 | -} aarch64_plt_type; | |
931 | - | |
932 | -/* To indicate if BTI is enabled with/without warning. */ | |
933 | -typedef enum | |
934 | -{ | |
935 | - BTI_NONE = 0, /* BTI is not enabled. */ | |
936 | - BTI_WARN = 1, /* BTI is enabled with -z force-bti. */ | |
937 | -} aarch64_enable_bti_type; | |
938 | - | |
939 | -/* A structure to encompass all information coming from BTI or PAC | |
940 | - related command line options. This involves the "PLT_TYPE" to determine | |
941 | - which version of PLTs to pick and "BTI_TYPE" to determine if | |
942 | - BTI should be turned on with any warnings. */ | |
943 | -typedef struct | |
944 | -{ | |
945 | - aarch64_plt_type plt_type; | |
946 | - aarch64_enable_bti_type bti_type; | |
947 | -} aarch64_bti_pac_info; | |
948 | - | |
949 | -/* An enum to define what kind of erratum fixes we should apply. This gives the | |
950 | - user a bit more control over the sequences we generate. */ | |
951 | -typedef enum | |
952 | -{ | |
953 | - ERRAT_NONE = (1 << 0), /* No erratum workarounds allowed. */ | |
954 | - ERRAT_ADR = (1 << 1), /* Erratum workarounds using ADR allowed. */ | |
955 | - ERRAT_ADRP = (1 << 2), /* Erratum workarounds using ADRP are allowed. */ | |
956 | -} erratum_84319_opts; | |
957 | - | |
958 | -extern void bfd_elf64_aarch64_set_options | |
959 | - (bfd *, struct bfd_link_info *, int, int, int, int, erratum_84319_opts, int, | |
960 | - aarch64_bti_pac_info); | |
961 | - | |
962 | -extern void bfd_elf32_aarch64_set_options | |
963 | - (bfd *, struct bfd_link_info *, int, int, int, int, erratum_84319_opts, int, | |
964 | - aarch64_bti_pac_info); | |
965 | - | |
966 | -/* ELF AArch64 mapping symbol support. */ | |
967 | -#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) | |
968 | -#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG (1 << 1) | |
969 | -#define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER (1 << 2) | |
970 | -#define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY (~0) | |
971 | -extern bfd_boolean bfd_is_aarch64_special_symbol_name | |
972 | - (const char * name, int type); | |
973 | - | |
974 | -/* AArch64 stub generation support for ELF64. Called from the linker. */ | |
975 | -extern int elf64_aarch64_setup_section_lists | |
976 | - (bfd *, struct bfd_link_info *); | |
977 | -extern void elf64_aarch64_next_input_section | |
978 | - (struct bfd_link_info *, struct bfd_section *); | |
979 | -extern bfd_boolean elf64_aarch64_size_stubs | |
980 | - (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, | |
981 | - struct bfd_section * (*) (const char *, struct bfd_section *), | |
982 | - void (*) (void)); | |
983 | -extern bfd_boolean elf64_aarch64_build_stubs | |
984 | - (struct bfd_link_info *); | |
985 | -/* AArch64 stub generation support for ELF32. Called from the linker. */ | |
986 | -extern int elf32_aarch64_setup_section_lists | |
987 | - (bfd *, struct bfd_link_info *); | |
988 | -extern void elf32_aarch64_next_input_section | |
989 | - (struct bfd_link_info *, struct bfd_section *); | |
990 | -extern bfd_boolean elf32_aarch64_size_stubs | |
991 | - (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, | |
992 | - struct bfd_section * (*) (const char *, struct bfd_section *), | |
993 | - void (*) (void)); | |
994 | -extern bfd_boolean elf32_aarch64_build_stubs | |
995 | - (struct bfd_link_info *); |
@@ -914,92 +914,6 @@ extern bfd_boolean elf32_arm_fix_exidx_coverage | ||
914 | 914 | /* C6x unwind section editing support. */ |
915 | 915 | extern bfd_boolean elf32_tic6x_fix_exidx_coverage |
916 | 916 | (struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean); |
917 | - | |
918 | -extern void bfd_elf64_aarch64_init_maps | |
919 | - (bfd *); | |
920 | - | |
921 | -extern void bfd_elf32_aarch64_init_maps | |
922 | - (bfd *); | |
923 | - | |
924 | -/* Types of PLTs based on the level of security. This would be a | |
925 | - bit-mask to denote which of the combinations of security features | |
926 | - are enabled: | |
927 | - - No security feature PLTs | |
928 | - - PLTs with BTI instruction | |
929 | - - PLTs with PAC instruction | |
930 | -*/ | |
931 | -typedef enum | |
932 | -{ | |
933 | - PLT_NORMAL = 0x0, /* Normal plts. */ | |
934 | - PLT_BTI = 0x1, /* plts with bti. */ | |
935 | - PLT_PAC = 0x2, /* plts with pointer authentication. */ | |
936 | - PLT_BTI_PAC = PLT_BTI | PLT_PAC | |
937 | -} aarch64_plt_type; | |
938 | - | |
939 | -/* To indicate if BTI is enabled with/without warning. */ | |
940 | -typedef enum | |
941 | -{ | |
942 | - BTI_NONE = 0, /* BTI is not enabled. */ | |
943 | - BTI_WARN = 1, /* BTI is enabled with -z force-bti. */ | |
944 | -} aarch64_enable_bti_type; | |
945 | - | |
946 | -/* A structure to encompass all information coming from BTI or PAC | |
947 | - related command line options. This involves the "PLT_TYPE" to determine | |
948 | - which version of PLTs to pick and "BTI_TYPE" to determine if | |
949 | - BTI should be turned on with any warnings. */ | |
950 | -typedef struct | |
951 | -{ | |
952 | - aarch64_plt_type plt_type; | |
953 | - aarch64_enable_bti_type bti_type; | |
954 | -} aarch64_bti_pac_info; | |
955 | - | |
956 | -/* An enum to define what kind of erratum fixes we should apply. This gives the | |
957 | - user a bit more control over the sequences we generate. */ | |
958 | -typedef enum | |
959 | -{ | |
960 | - ERRAT_NONE = (1 << 0), /* No erratum workarounds allowed. */ | |
961 | - ERRAT_ADR = (1 << 1), /* Erratum workarounds using ADR allowed. */ | |
962 | - ERRAT_ADRP = (1 << 2), /* Erratum workarounds using ADRP are allowed. */ | |
963 | -} erratum_84319_opts; | |
964 | - | |
965 | -extern void bfd_elf64_aarch64_set_options | |
966 | - (bfd *, struct bfd_link_info *, int, int, int, int, erratum_84319_opts, int, | |
967 | - aarch64_bti_pac_info); | |
968 | - | |
969 | -extern void bfd_elf32_aarch64_set_options | |
970 | - (bfd *, struct bfd_link_info *, int, int, int, int, erratum_84319_opts, int, | |
971 | - aarch64_bti_pac_info); | |
972 | - | |
973 | -/* ELF AArch64 mapping symbol support. */ | |
974 | -#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) | |
975 | -#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG (1 << 1) | |
976 | -#define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER (1 << 2) | |
977 | -#define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY (~0) | |
978 | -extern bfd_boolean bfd_is_aarch64_special_symbol_name | |
979 | - (const char * name, int type); | |
980 | - | |
981 | -/* AArch64 stub generation support for ELF64. Called from the linker. */ | |
982 | -extern int elf64_aarch64_setup_section_lists | |
983 | - (bfd *, struct bfd_link_info *); | |
984 | -extern void elf64_aarch64_next_input_section | |
985 | - (struct bfd_link_info *, struct bfd_section *); | |
986 | -extern bfd_boolean elf64_aarch64_size_stubs | |
987 | - (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, | |
988 | - struct bfd_section * (*) (const char *, struct bfd_section *), | |
989 | - void (*) (void)); | |
990 | -extern bfd_boolean elf64_aarch64_build_stubs | |
991 | - (struct bfd_link_info *); | |
992 | -/* AArch64 stub generation support for ELF32. Called from the linker. */ | |
993 | -extern int elf32_aarch64_setup_section_lists | |
994 | - (bfd *, struct bfd_link_info *); | |
995 | -extern void elf32_aarch64_next_input_section | |
996 | - (struct bfd_link_info *, struct bfd_section *); | |
997 | -extern bfd_boolean elf32_aarch64_size_stubs | |
998 | - (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, | |
999 | - struct bfd_section * (*) (const char *, struct bfd_section *), | |
1000 | - void (*) (void)); | |
1001 | -extern bfd_boolean elf32_aarch64_build_stubs | |
1002 | - (struct bfd_link_info *); | |
1003 | 917 | /* Extracted from init.c. */ |
1004 | 918 | unsigned int bfd_init (void); |
1005 | 919 |
@@ -22,6 +22,7 @@ | ||
22 | 22 | #include "bfd.h" |
23 | 23 | #include "libbfd.h" |
24 | 24 | #include "libiberty.h" |
25 | +#include "cpu-aarch64.h" | |
25 | 26 | |
26 | 27 | /* This routine is provided two arch_infos and works out which Aarch64 |
27 | 28 | machine which would be compatible with both and returns a pointer |
@@ -0,0 +1,25 @@ | ||
1 | +/* ELF AArch64 mapping symbol support | |
2 | + Copyright (C) 2019 Free Software Foundation, Inc. | |
3 | + | |
4 | + This file is part of BFD, the Binary File Descriptor library. | |
5 | + | |
6 | + This program is free software; you can redistribute it and/or modify | |
7 | + it under the terms of the GNU General Public License as published by | |
8 | + the Free Software Foundation; either version 3 of the License, or | |
9 | + (at your option) any later version. | |
10 | + | |
11 | + This program is distributed in the hope that it will be useful, | |
12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | + GNU General Public License for more details. | |
15 | + | |
16 | + You should have received a copy of the GNU General Public License | |
17 | + along with this program; see the file COPYING3. If not, | |
18 | + see <http://www.gnu.org/licenses/>. */ | |
19 | + | |
20 | +#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) | |
21 | +#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG (1 << 1) | |
22 | +#define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER (1 << 2) | |
23 | +#define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY (~0) | |
24 | +extern bfd_boolean bfd_is_aarch64_special_symbol_name | |
25 | + (const char * name, int type); |
@@ -144,6 +144,7 @@ | ||
144 | 144 | #include "objalloc.h" |
145 | 145 | #include "elf/aarch64.h" |
146 | 146 | #include "elfxx-aarch64.h" |
147 | +#include "cpu-aarch64.h" | |
147 | 148 | |
148 | 149 | #define ARCH_SIZE NN |
149 | 150 |
@@ -18,6 +18,84 @@ | ||
18 | 18 | along with this program; see the file COPYING3. If not, |
19 | 19 | see <http://www.gnu.org/licenses/>. */ |
20 | 20 | |
21 | +extern void bfd_elf64_aarch64_init_maps | |
22 | + (bfd *); | |
23 | + | |
24 | +extern void bfd_elf32_aarch64_init_maps | |
25 | + (bfd *); | |
26 | + | |
27 | +/* Types of PLTs based on the level of security. This would be a | |
28 | + bit-mask to denote which of the combinations of security features | |
29 | + are enabled: | |
30 | + - No security feature PLTs | |
31 | + - PLTs with BTI instruction | |
32 | + - PLTs with PAC instruction | |
33 | +*/ | |
34 | +typedef enum | |
35 | +{ | |
36 | + PLT_NORMAL = 0x0, /* Normal plts. */ | |
37 | + PLT_BTI = 0x1, /* plts with bti. */ | |
38 | + PLT_PAC = 0x2, /* plts with pointer authentication. */ | |
39 | + PLT_BTI_PAC = PLT_BTI | PLT_PAC | |
40 | +} aarch64_plt_type; | |
41 | + | |
42 | +/* To indicate if BTI is enabled with/without warning. */ | |
43 | +typedef enum | |
44 | +{ | |
45 | + BTI_NONE = 0, /* BTI is not enabled. */ | |
46 | + BTI_WARN = 1, /* BTI is enabled with -z force-bti. */ | |
47 | +} aarch64_enable_bti_type; | |
48 | + | |
49 | +/* A structure to encompass all information coming from BTI or PAC | |
50 | + related command line options. This involves the "PLT_TYPE" to determine | |
51 | + which version of PLTs to pick and "BTI_TYPE" to determine if | |
52 | + BTI should be turned on with any warnings. */ | |
53 | +typedef struct | |
54 | +{ | |
55 | + aarch64_plt_type plt_type; | |
56 | + aarch64_enable_bti_type bti_type; | |
57 | +} aarch64_bti_pac_info; | |
58 | + | |
59 | +/* An enum to define what kind of erratum fixes we should apply. This gives the | |
60 | + user a bit more control over the sequences we generate. */ | |
61 | +typedef enum | |
62 | +{ | |
63 | + ERRAT_NONE = (1 << 0), /* No erratum workarounds allowed. */ | |
64 | + ERRAT_ADR = (1 << 1), /* Erratum workarounds using ADR allowed. */ | |
65 | + ERRAT_ADRP = (1 << 2), /* Erratum workarounds using ADRP are allowed. */ | |
66 | +} erratum_84319_opts; | |
67 | + | |
68 | +extern void bfd_elf64_aarch64_set_options | |
69 | + (bfd *, struct bfd_link_info *, int, int, int, int, erratum_84319_opts, int, | |
70 | + aarch64_bti_pac_info); | |
71 | + | |
72 | +extern void bfd_elf32_aarch64_set_options | |
73 | + (bfd *, struct bfd_link_info *, int, int, int, int, erratum_84319_opts, int, | |
74 | + aarch64_bti_pac_info); | |
75 | + | |
76 | +/* AArch64 stub generation support for ELF64. Called from the linker. */ | |
77 | +extern int elf64_aarch64_setup_section_lists | |
78 | + (bfd *, struct bfd_link_info *); | |
79 | +extern void elf64_aarch64_next_input_section | |
80 | + (struct bfd_link_info *, struct bfd_section *); | |
81 | +extern bfd_boolean elf64_aarch64_size_stubs | |
82 | + (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, | |
83 | + struct bfd_section * (*) (const char *, struct bfd_section *), | |
84 | + void (*) (void)); | |
85 | +extern bfd_boolean elf64_aarch64_build_stubs | |
86 | + (struct bfd_link_info *); | |
87 | +/* AArch64 stub generation support for ELF32. Called from the linker. */ | |
88 | +extern int elf32_aarch64_setup_section_lists | |
89 | + (bfd *, struct bfd_link_info *); | |
90 | +extern void elf32_aarch64_next_input_section | |
91 | + (struct bfd_link_info *, struct bfd_section *); | |
92 | +extern bfd_boolean elf32_aarch64_size_stubs | |
93 | + (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, | |
94 | + struct bfd_section * (*) (const char *, struct bfd_section *), | |
95 | + void (*) (void)); | |
96 | +extern bfd_boolean elf32_aarch64_build_stubs | |
97 | + (struct bfd_link_info *); | |
98 | + | |
21 | 99 | /* Take the PAGE component of an address or offset. */ |
22 | 100 | #define PG(x) ((x) & ~ (bfd_vma) 0xfff) |
23 | 101 | #define PG_OFFSET(x) ((x) & (bfd_vma) 0xfff) |
@@ -1,5 +1,9 @@ | ||
1 | 1 | 2019-09-23 Alan Modra <amodra@gmail.com> |
2 | 2 | |
3 | + * emultempl/aarch64elf.em: Include elfxx-aarch64.h. | |
4 | + | |
5 | +2019-09-23 Alan Modra <amodra@gmail.com> | |
6 | + | |
3 | 7 | * emultempl/ia64elf.em: Include elfxx-ia64.h. |
4 | 8 | |
5 | 9 | 2019-09-23 Alan Modra <amodra@gmail.com> |
@@ -26,6 +26,7 @@ fragment <<EOF | ||
26 | 26 | |
27 | 27 | #include "ldctor.h" |
28 | 28 | #include "elf/aarch64.h" |
29 | +#include "elfxx-aarch64.h" | |
29 | 30 | |
30 | 31 | static int no_enum_size_warning = 0; |
31 | 32 | static int no_wchar_size_warning = 0; |