public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] [PR target/81861] Save target specific options after ix86_stack_protector_guard_reg was changed
       [not found] <CGME20170817113752eucas1p1a3219e47207322297719884324cfaafd@eucas1p1.samsung.com>
@ 2017-08-17 12:25 ` Maxim Ostapenko
  2017-08-17 12:32   ` Uros Bizjak
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Ostapenko @ 2017-08-17 12:25 UTC (permalink / raw)
  To: GCC Patches; +Cc: Uros Bizjak

[-- Attachment #1: Type: text/plain, Size: 447 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pr81861.diff --]
[-- Type: text/x-diff; name="pr81861.diff", Size: 1286 bytes --]

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;
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [PR target/81861] Save target specific options after ix86_stack_protector_guard_reg was changed
  2017-08-17 12:25 ` [PATCH] [PR target/81861] Save target specific options after ix86_stack_protector_guard_reg was changed Maxim Ostapenko
@ 2017-08-17 12:32   ` Uros Bizjak
  0 siblings, 0 replies; 2+ messages in thread
From: Uros Bizjak @ 2017-08-17 12:32 UTC (permalink / raw)
  To: Maxim Ostapenko; +Cc: GCC Patches

On Thu, Aug 17, 2017 at 1:37 PM, Maxim Ostapenko
<m.ostapenko@samsung.com> wrote:
> 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?

OK.

I'll take care to backport the patch to other release branches.

Thanks,
Uros.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-17 11:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170817113752eucas1p1a3219e47207322297719884324cfaafd@eucas1p1.samsung.com>
2017-08-17 12:25 ` [PATCH] [PR target/81861] Save target specific options after ix86_stack_protector_guard_reg was changed Maxim Ostapenko
2017-08-17 12:32   ` Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).