Add -fprofile-update option juggling
authorMartin Liska <mliska@suse.cz>
Thu, 6 Oct 2016 07:34:23 +0000 (09:34 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 6 Oct 2016 07:34:23 +0000 (07:34 +0000)
* gcc.c: Set -fprofile-update=atomic when profiling is
enabled and -pthread is set.  Warn when one combines
-pthread and -fprofile-update=single for an app using
profiling code.

From-SVN: r240828

gcc/ChangeLog
gcc/gcc.c

index 965f54d..aa41f37 100644 (file)
@@ -1,5 +1,12 @@
 2016-10-06  Martin Liska  <mliska@suse.cz>
 
+       * gcc.c: Set -fprofile-update=atomic when profiling is
+       enabled and -pthread is set.  Warn when one combines
+       -pthread and -fprofile-update=single for an app using
+       profiling code.
+
+2016-10-06  Martin Liska  <mliska@suse.cz>
+
        PR bootstrap/77788
        * expmed.h (mul_highpart_cost_ptr): Add an gcc_assert.
        * gimple-ssa-strength-reduction.c (slsr_process_cast):
index fd2b182..5213cb0 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1141,7 +1141,14 @@ static const char *cc1_options =
  %{-help=*:--help=%*}\
  %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
  %{fsyntax-only:-o %j} %{-param*}\
- %{coverage:-fprofile-arcs -ftest-coverage}";
+ %{coverage:-fprofile-arcs -ftest-coverage}\
+ %{fprofile-arcs|fprofile-generate*|coverage:\
+   %{!fprofile-update=single:\
+     %{pthread:-fprofile-update=atomic}}}\
+ %{fprofile-update=single:\
+   %{fprofile-arcs|fprofile-generate*|coverage:\
+     %{pthread:%n-fprofile-update=atomic should be used\
+ for a multithreaded application}}}";
 
 static const char *asm_options =
 "%{-target-help:%:print-asm-header()} "