diff options
Diffstat (limited to 'scripts/gcc-plugins')
-rw-r--r-- | scripts/gcc-plugins/arm_ssp_per_task_plugin.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/scripts/gcc-plugins/arm_ssp_per_task_plugin.c b/scripts/gcc-plugins/arm_ssp_per_task_plugin.c index de70b8470971..89c47f57d1ce 100644 --- a/scripts/gcc-plugins/arm_ssp_per_task_plugin.c +++ b/scripts/gcc-plugins/arm_ssp_per_task_plugin.c | |||
@@ -13,7 +13,7 @@ static unsigned int arm_pertask_ssp_rtl_execute(void) | |||
13 | for (insn = get_insns(); insn; insn = NEXT_INSN(insn)) { | 13 | for (insn = get_insns(); insn; insn = NEXT_INSN(insn)) { |
14 | const char *sym; | 14 | const char *sym; |
15 | rtx body; | 15 | rtx body; |
16 | rtx masked_sp; | 16 | rtx mask, masked_sp; |
17 | 17 | ||
18 | /* | 18 | /* |
19 | * Find a SET insn involving a SYMBOL_REF to __stack_chk_guard | 19 | * Find a SET insn involving a SYMBOL_REF to __stack_chk_guard |
@@ -33,12 +33,13 @@ static unsigned int arm_pertask_ssp_rtl_execute(void) | |||
33 | * produces the address of the copy of the stack canary value | 33 | * produces the address of the copy of the stack canary value |
34 | * stored in struct thread_info | 34 | * stored in struct thread_info |
35 | */ | 35 | */ |
36 | mask = GEN_INT(sext_hwi(sp_mask, GET_MODE_PRECISION(Pmode))); | ||
36 | masked_sp = gen_reg_rtx(Pmode); | 37 | masked_sp = gen_reg_rtx(Pmode); |
37 | 38 | ||
38 | emit_insn_before(gen_rtx_SET(masked_sp, | 39 | emit_insn_before(gen_rtx_SET(masked_sp, |
39 | gen_rtx_AND(Pmode, | 40 | gen_rtx_AND(Pmode, |
40 | stack_pointer_rtx, | 41 | stack_pointer_rtx, |
41 | GEN_INT(sp_mask))), | 42 | mask)), |
42 | insn); | 43 | insn); |
43 | 44 | ||
44 | SET_SRC(body) = gen_rtx_PLUS(Pmode, masked_sp, | 45 | SET_SRC(body) = gen_rtx_PLUS(Pmode, masked_sp, |
@@ -52,6 +53,19 @@ static unsigned int arm_pertask_ssp_rtl_execute(void) | |||
52 | #define NO_GATE | 53 | #define NO_GATE |
53 | #include "gcc-generate-rtl-pass.h" | 54 | #include "gcc-generate-rtl-pass.h" |
54 | 55 | ||
56 | #if BUILDING_GCC_VERSION >= 9000 | ||
57 | static bool no(void) | ||
58 | { | ||
59 | return false; | ||
60 | } | ||
61 | |||
62 | static void arm_pertask_ssp_start_unit(void *gcc_data, void *user_data) | ||
63 | { | ||
64 | targetm.have_stack_protect_combined_set = no; | ||
65 | targetm.have_stack_protect_combined_test = no; | ||
66 | } | ||
67 | #endif | ||
68 | |||
55 | __visible int plugin_init(struct plugin_name_args *plugin_info, | 69 | __visible int plugin_init(struct plugin_name_args *plugin_info, |
56 | struct plugin_gcc_version *version) | 70 | struct plugin_gcc_version *version) |
57 | { | 71 | { |
@@ -99,5 +113,10 @@ __visible int plugin_init(struct plugin_name_args *plugin_info, | |||
99 | register_callback(plugin_info->base_name, PLUGIN_PASS_MANAGER_SETUP, | 113 | register_callback(plugin_info->base_name, PLUGIN_PASS_MANAGER_SETUP, |
100 | NULL, &arm_pertask_ssp_rtl_pass_info); | 114 | NULL, &arm_pertask_ssp_rtl_pass_info); |
101 | 115 | ||
116 | #if BUILDING_GCC_VERSION >= 9000 | ||
117 | register_callback(plugin_info->base_name, PLUGIN_START_UNIT, | ||
118 | arm_pertask_ssp_start_unit, NULL); | ||
119 | #endif | ||
120 | |||
102 | return 0; | 121 | return 0; |
103 | } | 122 | } |