• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂09038062534606ef9100b5474d136f7d2e543de4 (tree)
時間2018-12-14 01:37:40
作者Sam Tebbs <sam.tebbs@arm....>
CommiterThomas Preud'homme

Log Message

Move aarch64 CIE code to aarch64 backend

This commit moves all aarch64-specific code to deal with CIE structure
introduced in 3a67e1a6b4430374f3073e51bb19347d4c421cfe from
target-independent files to the aarch64 backend.

2018-12-13 Sam Tebbs <sam.tebbs@arm.com>

binutils/
* dwarf.c (read_cie): Add check for 'B'.

gas/
* config/tc-aarch64.h (enum pointer_auth_key,
tc_fde_entry_extras, tc_cie_entry_extras, tc_fde_entry_init_extra,
tc_output_cie_extra, tc_cie_fde_equivalent_extra,
tc_cie_entry_init_extra): Define.
* dw2gencfi.c (struct cie_entry): Add tc_cie_entry_extras invocation.
(alloc_fde_entry, select_cie_for_fde): Add tc_fde_entry_init_extra
invocation.
(output_cie): Add tc_output_cie_extra invocation.
(select_cie_for_fde): Add tc_cie_fde_equivalent_extra invocation.
* dw2gencfi.h (enum pointer_auth_key): Move to config/tc-aarch64.h.
(struct fde_entry): Add tc_fde_entry_extras invocation

Change Summary

差異

--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,7 @@
1+2018-12-13 Sam Tebbs <sam.tebbs@arm.com>
2+
3+ * dwarf.c (read_cie): Add check for 'B'.
4+
15 2018-12-11 Nick Clifton <nickc@redhat.com>
26
37 * NEWS: Note that recursion limit has increased to 2048.
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -7401,6 +7401,8 @@ read_cie (unsigned char *start, unsigned char *end,
74017401 fc->fde_encoding = *q++;
74027402 else if (*p == 'S')
74037403 ;
7404+ else if (*p == 'B')
7405+ ;
74047406 else
74057407 break;
74067408 p++;
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,17 @@
1+2018-12-13 Sam Tebbs <sam.tebbs@arm.com>
2+
3+ * config/tc-aarch64.h (enum pointer_auth_key,
4+ tc_fde_entry_extras, tc_cie_entry_extras, tc_fde_entry_init_extra,
5+ tc_output_cie_extra, tc_cie_fde_equivalent_extra,
6+ tc_cie_entry_init_extra): Define.
7+ * dw2gencfi.c (struct cie_entry): Add tc_cie_entry_extras invocation.
8+ (alloc_fde_entry, select_cie_for_fde): Add tc_fde_entry_init_extra
9+ invocation.
10+ (output_cie): Add tc_output_cie_extra invocation.
11+ (select_cie_for_fde): Add tc_cie_fde_equivalent_extra invocation.
12+ * dw2gencfi.h (enum pointer_auth_key): Move to config/tc-aarch64.h.
13+ (struct fde_entry): Add tc_fde_entry_extras invocation
14+
115 2018-12-12 Andre Vieira <andre.simoesdiasvieira@arm.com>
216
317 * testsuite/gas/arm/blx-local-thumb.d: Skip arm-nto and
--- a/gas/config/tc-aarch64.h
+++ b/gas/config/tc-aarch64.h
@@ -80,6 +80,43 @@ struct aarch64_fix
8080
8181 #define tc_frob_section(S) aarch64_frob_section (S)
8282
83+/* The key used to sign a function's return address. */
84+enum pointer_auth_key {
85+ AARCH64_PAUTH_KEY_A,
86+ AARCH64_PAUTH_KEY_B
87+};
88+
89+/* The extra fields required by AArch64 in fde_entry and cie_entry. Currently
90+ only used to store the key used to sign the frame's return address. */
91+#define tc_fde_entry_extras enum pointer_auth_key pauth_key;
92+#define tc_cie_entry_extras enum pointer_auth_key pauth_key;
93+
94+/* The extra initialisation steps needed by AArch64 in alloc_fde_entry.
95+ Currently only used to initialise the key used to sign the return
96+ address. */
97+#define tc_fde_entry_init_extra(fde) fde->pauth_key = AARCH64_PAUTH_KEY_A;
98+
99+/* Extra checks required by AArch64 when outputting the current cie_entry.
100+ Currently only used to output a 'B' if the return address is signed with the
101+ B key. */
102+#define tc_output_cie_extra(cie) \
103+ do \
104+ { \
105+ if (cie->pauth_key == AARCH64_PAUTH_KEY_B) \
106+ out_one ('B'); \
107+ } \
108+ while (0)
109+
110+/* Extra equivalence checks required by AArch64 when selecting the correct cie
111+ for some fde. Currently only used to check for quivalence between keys used
112+ to sign ther return address. */
113+#define tc_cie_fde_equivalent_extra(cie, fde) (cie->pauth_key == fde->pauth_key)
114+
115+/* The extra initialisation steps needed by AArch64 in select_cie_for_fde.
116+ Currently only used to initialise the key used to sign the return
117+ address. */
118+#define tc_cie_entry_init_extra(cie, fde) cie->pauth_key = fde->pauth_key;
119+
83120 #define TC_FIX_TYPE struct aarch64_fix
84121 #define TC_INIT_FIX_DATA(FIX) { (FIX)->tc_fix_data.inst = NULL; \
85122 (FIX)->tc_fix_data.opnd = AARCH64_OPND_NIL; }
--- a/gas/dw2gencfi.c
+++ b/gas/dw2gencfi.c
@@ -403,7 +403,9 @@ struct cie_entry
403403 unsigned char per_encoding;
404404 unsigned char lsda_encoding;
405405 expressionS personality;
406- enum pointer_auth_key pauth_key;
406+#ifdef tc_cie_entry_extras
407+ tc_cie_entry_extras
408+#endif
407409 struct cfi_insn_data *first, *last;
408410 };
409411
@@ -433,7 +435,9 @@ alloc_fde_entry (void)
433435 fde->per_encoding = DW_EH_PE_omit;
434436 fde->lsda_encoding = DW_EH_PE_omit;
435437 fde->eh_header_type = EH_COMPACT_UNKNOWN;
436- fde->pauth_key = AARCH64_PAUTH_KEY_A;
438+#ifdef tc_fde_entry_init_extra
439+ tc_fde_entry_init_extra (fde)
440+#endif
437441
438442 return fde;
439443 }
@@ -1858,8 +1862,9 @@ output_cie (struct cie_entry *cie, bfd_boolean eh_frame, int align)
18581862 if (cie->lsda_encoding != DW_EH_PE_omit)
18591863 out_one ('L');
18601864 out_one ('R');
1861- if (cie->pauth_key == AARCH64_PAUTH_KEY_B)
1862- out_one ('B');
1865+#ifdef tc_output_cie_extra
1866+ tc_output_cie_extra (cie)
1867+#endif
18631868 }
18641869 if (cie->signal_frame)
18651870 out_one ('S');
@@ -2039,8 +2044,11 @@ select_cie_for_fde (struct fde_entry *fde, bfd_boolean eh_frame,
20392044 {
20402045 if (CUR_SEG (cie) != CUR_SEG (fde))
20412046 continue;
2047+#ifdef tc_cie_fde_equivalent_extra
2048+ if (!tc_cie_fde_equivalent_extra (cie, fde))
2049+ continue;
2050+#endif
20422051 if (cie->return_column != fde->return_column
2043- || cie->pauth_key != fde->pauth_key
20442052 || cie->signal_frame != fde->signal_frame
20452053 || cie->per_encoding != fde->per_encoding
20462054 || cie->lsda_encoding != fde->lsda_encoding)
@@ -2147,7 +2155,9 @@ select_cie_for_fde (struct fde_entry *fde, bfd_boolean eh_frame,
21472155 cie->lsda_encoding = fde->lsda_encoding;
21482156 cie->personality = fde->personality;
21492157 cie->first = fde->data;
2150- cie->pauth_key = fde->pauth_key;
2158+#ifdef tc_cie_entry_init_extra
2159+ tc_cie_entry_init_extra (cie, fde)
2160+#endif
21512161
21522162 for (i = cie->first; i ; i = i->next)
21532163 if (i->insn == DW_CFA_advance_loc
--- a/gas/dw2gencfi.h
+++ b/gas/dw2gencfi.h
@@ -135,11 +135,6 @@ enum {
135135 EH_COMPACT_HAS_LSDA
136136 };
137137
138-enum pointer_auth_key {
139- AARCH64_PAUTH_KEY_A,
140- AARCH64_PAUTH_KEY_B
141-};
142-
143138 /* Stack of old CFI data, for save/restore. */
144139 struct cfa_save_data
145140 {
@@ -183,8 +178,9 @@ struct fde_entry
183178 /* For out of line tables and FDEs. */
184179 symbolS *eh_loc;
185180 int sections;
186- /* The pointer authentication key used. Only used for AArch64. */
187- enum pointer_auth_key pauth_key;
181+#ifdef tc_fde_entry_extras
182+ tc_fde_entry_extras
183+#endif
188184 };
189185
190186 /* The list of all FDEs that have been collected. */