This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] [PR target/81861] Save target specific options after ix86_stack_protector_guard_reg was changed
- From: Maxim Ostapenko <m dot ostapenko at samsung dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Uros Bizjak <ubizjak at gmail dot com>
- Date: Thu, 17 Aug 2017 14:37:49 +0300
- Subject: [PATCH] [PR target/81861] Save target specific options after ix86_stack_protector_guard_reg was changed
- Authentication-results: sourceware.org; auth=none
- Cms-type: 201P
- References: <CGME20170817113752eucas1p1a3219e47207322297719884324cfaafd@eucas1p1.samsung.com>
Hi,
as discussed in PR, currently we are missing some SSP related options
when streaming target specific options in LTO mode. This leads to
incorrect code and segfaults (e.g. in ASan's pr64820.c testcase).
This patch fixes this by moving options saving machinery down to setting
ix86_stack_protector_guard_reg thus all related options are propagated
correctly.
Tested on x86{_64}-unknown-linux-gnu and lto-bootstrapped, OK to apply?
-Maxim
gcc/ChangeLog:
2017-08-17 Maxim Ostapenko <m.ostapenko@samsung.com>
PR target/81861
* config/i386/i386.c (ix86_option_override_internal): Save target
specific options after ix86_stack_protector_guard_reg was changed.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3f85197..bd3260c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6651,12 +6651,6 @@ ix86_option_override_internal (bool main_args_p,
gcc_assert ((opts->x_target_flags & MASK_LONG_DOUBLE_64) == 0
|| (opts->x_target_flags & MASK_LONG_DOUBLE_128) == 0);
- /* Save the initial options in case the user does function specific
- options. */
- if (main_args_p)
- target_option_default_node = target_option_current_node
- = build_target_option_node (opts);
-
/* Handle stack protector */
if (!opts_set->x_ix86_stack_protector_guard)
opts->x_ix86_stack_protector_guard
@@ -6740,6 +6734,12 @@ ix86_option_override_internal (bool main_args_p,
free (str);
}
+ /* Save the initial options in case the user does function specific
+ options. */
+ if (main_args_p)
+ target_option_default_node = target_option_current_node
+ = build_target_option_node (opts);
+
return true;
}