diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-11-22 22:34:49 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-11-22 22:34:49 +0100 |
commit | a7433f32ecdfe959fc1bea8e330a73693b478d0b (patch) | |
tree | f4e53c6b666512a35f762dcbc8eda6f5acaef617 | |
parent | e4b0215585f77f78fa3aa9b1621749ce23c1d393 (diff) | |
download | gcc-a7433f32ecdfe959fc1bea8e330a73693b478d0b.zip gcc-a7433f32ecdfe959fc1bea8e330a73693b478d0b.tar.gz gcc-a7433f32ecdfe959fc1bea8e330a73693b478d0b.tar.bz2 |
i386.c (ix86_option_override_internal): For stack_protector_guard related options...
* config/i386/i386.c (ix86_option_override_internal): For
stack_protector_guard related options, use opts_set->x_ instead
of global_options_set. and prefix options with opts->x_ . Move
defaults for offset and reg into else block.
From-SVN: r266390
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 40 |
2 files changed, 28 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dd12d32..7cae52e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-11-22 Jakub Jelinek <jakub@redhat.com> + + * config/i386/i386.c (ix86_option_override_internal): For + stack_protector_guard related options, use opts_set->x_ instead + of global_options_set. and prefix options with opts->x_ . Move + defaults for offset and reg into else block. + 2018-11-22 Uros Bizjak <ubizjak@gmail.com> * config/i386/i386.c (ix86_check_avx_upper_register): diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f885232..78cee75 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4571,14 +4571,10 @@ ix86_option_override_internal (bool main_args_p, opts->x_ix86_stack_protector_guard = SSP_GLOBAL; } -#ifdef TARGET_THREAD_SSP_OFFSET - ix86_stack_protector_guard_offset = TARGET_THREAD_SSP_OFFSET; -#endif - - if (global_options_set.x_ix86_stack_protector_guard_offset_str) + if (opts_set->x_ix86_stack_protector_guard_offset_str) { char *endp; - const char *str = ix86_stack_protector_guard_offset_str; + const char *str = opts->x_ix86_stack_protector_guard_offset_str; errno = 0; int64_t offset; @@ -4598,20 +4594,16 @@ ix86_option_override_internal (bool main_args_p, error ("%qs is not a valid offset " "in -mstack-protector-guard-offset=", str); - ix86_stack_protector_guard_offset = offset; + opts->x_ix86_stack_protector_guard_offset = offset; } +#ifdef TARGET_THREAD_SSP_OFFSET + else + opts->x_ix86_stack_protector_guard_offset = TARGET_THREAD_SSP_OFFSET; +#endif - ix86_stack_protector_guard_reg = DEFAULT_TLS_SEG_REG; - - /* The kernel uses a different segment register for performance - reasons; a system call would not have to trash the userspace - segment register, which would be expensive. */ - if (ix86_cmodel == CM_KERNEL) - ix86_stack_protector_guard_reg = ADDR_SPACE_SEG_GS; - - if (global_options_set.x_ix86_stack_protector_guard_reg_str) + if (opts_set->x_ix86_stack_protector_guard_reg_str) { - const char *str = ix86_stack_protector_guard_reg_str; + const char *str = opts->x_ix86_stack_protector_guard_reg_str; addr_space_t seg = ADDR_SPACE_GENERIC; /* Discard optional register prefix. */ @@ -4629,9 +4621,19 @@ ix86_option_override_internal (bool main_args_p, if (seg == ADDR_SPACE_GENERIC) error ("%qs is not a valid base register " "in -mstack-protector-guard-reg=", - ix86_stack_protector_guard_reg_str); + opts->x_ix86_stack_protector_guard_reg_str); + + opts->x_ix86_stack_protector_guard_reg = seg; + } + else + { + opts->x_ix86_stack_protector_guard_reg = DEFAULT_TLS_SEG_REG; - ix86_stack_protector_guard_reg = seg; + /* The kernel uses a different segment register for performance + reasons; a system call would not have to trash the userspace + segment register, which would be expensive. */ + if (opts->x_ix86_cmodel == CM_KERNEL) + opts->x_ix86_stack_protector_guard_reg = ADDR_SPACE_SEG_GS; } /* Handle -mmemcpy-strategy= and -mmemset-strategy= */ |