lto-streamer.h (LTO_major_version): Bump to 5.
[gcc.git] / gcc / gcc.c
index 8f01e4202b04dc797d81257ecaada1d3bcbee4d0..0f29b7870fb0ca07059a5a905f1e4694121b548e 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -41,7 +41,6 @@ compilation is specified by a string called a "spec".  */
 #include "flags.h"
 #include "opts.h"
 #include "params.h"
-#include "vec.h"
 #include "filenames.h"
 
 /* By default there is no special suffix for target executables.  */
@@ -737,12 +736,57 @@ proper position among the other output files.  */
 #endif
 #endif
 
+#ifdef ENABLE_DEFAULT_PIE
+#define NO_PIE_SPEC            "no-pie|static"
+#define PIE_SPEC               NO_PIE_SPEC "|r|shared:;"
+#define NO_FPIE1_SPEC          "fno-pie"
+#define FPIE1_SPEC             NO_FPIE1_SPEC ":;"
+#define NO_FPIE2_SPEC          "fno-PIE"
+#define FPIE2_SPEC             NO_FPIE2_SPEC ":;"
+#define NO_FPIE_SPEC           NO_FPIE1_SPEC "|" NO_FPIE2_SPEC
+#define FPIE_SPEC              NO_FPIE_SPEC ":;"
+#define NO_FPIC1_SPEC          "fno-pic"
+#define FPIC1_SPEC             NO_FPIC1_SPEC ":;"
+#define NO_FPIC2_SPEC          "fno-PIC"
+#define FPIC2_SPEC             NO_FPIC2_SPEC ":;"
+#define NO_FPIC_SPEC           NO_FPIC1_SPEC "|" NO_FPIC2_SPEC
+#define FPIC_SPEC              NO_FPIC_SPEC ":;"
+#define NO_FPIE1_AND_FPIC1_SPEC        NO_FPIE1_SPEC "|" NO_FPIC1_SPEC
+#define FPIE1_OR_FPIC1_SPEC    NO_FPIE1_AND_FPIC1_SPEC ":;"
+#define NO_FPIE2_AND_FPIC2_SPEC        NO_FPIE2_SPEC "|" NO_FPIC2_SPEC
+#define FPIE2_OR_FPIC2_SPEC    NO_FPIE2_AND_FPIC2_SPEC ":;"
+#define NO_FPIE_AND_FPIC_SPEC  NO_FPIE_SPEC "|" NO_FPIC_SPEC
+#define FPIE_OR_FPIC_SPEC      NO_FPIE_AND_FPIC_SPEC ":;"
+#else
+#define PIE_SPEC               "pie"
+#define NO_PIE_SPEC            PIE_SPEC "|r|shared:;"
+#define FPIE1_SPEC             "fpie"
+#define NO_FPIE1_SPEC          FPIE1_SPEC ":;"
+#define FPIE2_SPEC             "fPIE"
+#define NO_FPIE2_SPEC          FPIE2_SPEC ":;"
+#define FPIE_SPEC              FPIE1_SPEC "|" FPIE2_SPEC
+#define NO_FPIE_SPEC           FPIE_SPEC ":;"
+#define FPIC1_SPEC             "fpic"
+#define NO_FPIC1_SPEC          FPIC1_SPEC ":;"
+#define FPIC2_SPEC             "fPIC"
+#define NO_FPIC2_SPEC          FPIC2_SPEC ":;"
+#define FPIC_SPEC              FPIC1_SPEC "|" FPIC2_SPEC
+#define NO_FPIC_SPEC           FPIC_SPEC ":;"
+#define FPIE1_OR_FPIC1_SPEC    FPIE1_SPEC "|" FPIC1_SPEC
+#define NO_FPIE1_AND_FPIC1_SPEC        FPIE1_OR_FPIC1_SPEC ":;"
+#define FPIE2_OR_FPIC2_SPEC    FPIE2_SPEC "|" FPIC2_SPEC
+#define NO_FPIE2_AND_FPIC2_SPEC        FPIE1_OR_FPIC2_SPEC ":;"
+#define FPIE_OR_FPIC_SPEC      FPIE_SPEC "|" FPIC_SPEC
+#define NO_FPIE_AND_FPIC_SPEC  FPIE_OR_FPIC_SPEC ":;"
+#endif
+
 #ifndef LINK_PIE_SPEC
 #ifdef HAVE_LD_PIE
-#define LINK_PIE_SPEC "%{pie:-pie} "
+#define LD_PIE_SPEC "-pie"
 #else
-#define LINK_PIE_SPEC "%{pie:} "
+#define LD_PIE_SPEC ""
 #endif
+#define LINK_PIE_SPEC "%{no-pie:} " "%{" PIE_SPEC ":" LD_PIE_SPEC "} "
 #endif
 
 #ifndef LINK_BUILDID_SPEC
@@ -1131,12 +1175,14 @@ static const struct compiler default_compilers[] =
                %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
                    cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
                        %(cc1_options)\
-                        %{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\
-                        %W{o*:--output-pch=%*}}%V}\
+                       %{!fsyntax-only:-o %g.s \
+                           %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\
+                                              %W{o*:--output-pch=%*}}%V}}\
          %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
                cc1 %(cpp_unique_options) %(cc1_options)\
-                    %{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\
-                    %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
+                   %{!fsyntax-only:-o %g.s \
+                       %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\
+                                          %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
   {".i", "@cpp-output", 0, 0, 0},
   {"@cpp-output",
    "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
@@ -3847,6 +3893,11 @@ driver_handle_option (struct gcc_options *opts,
       save_switch ("-o", 1, &arg, validated, true);
       return true;
 
+#ifdef ENABLE_DEFAULT_PIE
+    case OPT_pie:
+      /* -pie is turned on by default.  */
+#endif
+
     case OPT_static_libgcc:
     case OPT_shared_libgcc:
     case OPT_static_libgfortran: