passes.c (ipa_write_summaries): Only modify statements if body is in memory.
authorJan Hubicka <hubicka@ucw.cz>
Wed, 30 May 2018 16:42:41 +0000 (18:42 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 30 May 2018 16:42:41 +0000 (16:42 +0000)
* passes.c (ipa_write_summaries): Only modify statements if body
is in memory.
* cgraphunit.c (ipa_passes): Also produce intermeidate code when
incrementally linking.
(ipa_passes): Likewise.
* lto-cgraph.c (lto_output_node): When incrementally linking do not
pass down resolution info.
* common.opt (flag_incremental_link): Update info.
* gcc.c (plugin specs): Turn flinker-output=* to
-plugin-opt=-linker-output-known
* toplev.c (compile_file): Also cut compilation when doing incremental
link.
* flag-types. (enum lto_partition_model): Add
LTO_LINKER_OUTPUT_NOLTOREL.
(invoke.texi): Add -flinker-output docs.
* ipa.c (symbol_table::remove_unreachable_nodes): Handle LTO incremental
link same way as WPA; do not stream in dead initializers.

* dwarf2out.c (dwarf2out_die_ref_for_decl,
darf2out_register_external_decl): Support incremental link.

* lang.opt (lto_linker_output): Add nolto-rel.
* lto-lang.c (lto_post_options): Handle LTO_LINKER_OUTPUT_REL
and LTO_LINKER_OUTPUT_NOLTOREL.
(lto_init): Generate lto when doing incremental link.
* lto.c (lto_precess_name): Add lto1-inclink.

* testsuite/g++.dg/lto/20081109-1_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20081118_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20081119-1_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20081120-1_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20081120-2_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20081123_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20081204-1_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20081219_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20090302_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20090313_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20091002-2_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20091002-3_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20091026-1_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20100724-1_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20101010-4_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20101015-2_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/20110311-1_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/pr45621_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/pr48042_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/pr48354-1_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/pr54625-1_0.c: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/pr54625-2_0.c: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/lto/pr68811_0.C: Add -flinker-output=nolto-rel.
* testsuite/g++.dg/torture/pr43760.C: New test. Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20081120-1_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20081120-2_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20081126_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20081204-1_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20081204-2_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20081212-1_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20081224_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20090116_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20090126-1_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20090126-2_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20090206-1_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20090219_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20091013-1_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20091014-1_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20091015-1_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20091016-1_0.c: Add -flinker-output=nolto-rel.
* testsuite/gcc.dg/lto/20091020-1_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/20091020-2_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/20091027-1_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/20100426_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/20100430-1_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/20100603-1_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/20100603-2_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/20100603-3_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/20111213-1_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/pr45736_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/pr52634_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/pr54702_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/pr59323-2_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/pr59323_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/pr60820_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/pr81406_0.c: Add -flinker-output-nolto-rel.
* testsuite/gcc.dg/lto/pr83388_0.c: Add -flinker-output-nolto-rel.
* testsuite/gfortran.dg/lto/20091016-1_0.f90: Add -flinker-output-nolto-rel.
* testsuite/gfortran.dg/lto/20091028-1_0.f90: Add -flinker-output-nolto-rel.
* testsuite/gfortran.dg/lto/20091028-2_0.f90: Add -flinker-output-nolto-rel.
* testsuite/gfortran.dg/lto/pr46911_0.f: Add -flinker-output-nolto-rel.
* testsuite/gfortran.dg/lto/pr47839_0.f90: Add -flinker-output-nolto-rel.

From-SVN: r260963

77 files changed:
gcc/ChangeLog
gcc/cgraphunit.c
gcc/common.opt
gcc/dwarf2out.c
gcc/flag-types.h
gcc/gcc.c
gcc/ipa.c
gcc/lto-cgraph.c
gcc/lto/ChangeLog
gcc/lto/lang.opt
gcc/lto/lto-lang.c
gcc/lto/lto.c
gcc/passes.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lto/20081109-1_0.C
gcc/testsuite/g++.dg/lto/20081118_0.C
gcc/testsuite/g++.dg/lto/20081119-1_0.C
gcc/testsuite/g++.dg/lto/20081120-1_0.C
gcc/testsuite/g++.dg/lto/20081120-2_0.C
gcc/testsuite/g++.dg/lto/20081123_0.C
gcc/testsuite/g++.dg/lto/20081204-1_0.C
gcc/testsuite/g++.dg/lto/20081219_0.C
gcc/testsuite/g++.dg/lto/20090302_0.C
gcc/testsuite/g++.dg/lto/20090313_0.C
gcc/testsuite/g++.dg/lto/20091002-2_0.C
gcc/testsuite/g++.dg/lto/20091002-3_0.C
gcc/testsuite/g++.dg/lto/20091026-1_0.C
gcc/testsuite/g++.dg/lto/20100724-1_0.C
gcc/testsuite/g++.dg/lto/20101010-4_0.C
gcc/testsuite/g++.dg/lto/20101015-2_0.C
gcc/testsuite/g++.dg/lto/20110311-1_0.C
gcc/testsuite/g++.dg/lto/pr45621_0.C
gcc/testsuite/g++.dg/lto/pr48042_0.C
gcc/testsuite/g++.dg/lto/pr48354-1_0.C
gcc/testsuite/g++.dg/lto/pr54625-1_0.c
gcc/testsuite/g++.dg/lto/pr54625-2_0.c
gcc/testsuite/g++.dg/lto/pr68811_0.C
gcc/testsuite/g++.dg/torture/pr85583.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/20081120-1_0.c
gcc/testsuite/gcc.dg/lto/20081120-2_0.c
gcc/testsuite/gcc.dg/lto/20081126_0.c
gcc/testsuite/gcc.dg/lto/20081204-1_0.c
gcc/testsuite/gcc.dg/lto/20081204-2_0.c
gcc/testsuite/gcc.dg/lto/20081212-1_0.c
gcc/testsuite/gcc.dg/lto/20081224_0.c
gcc/testsuite/gcc.dg/lto/20090116_0.c
gcc/testsuite/gcc.dg/lto/20090126-1_0.c
gcc/testsuite/gcc.dg/lto/20090126-2_0.c
gcc/testsuite/gcc.dg/lto/20090206-1_0.c
gcc/testsuite/gcc.dg/lto/20090219_0.c
gcc/testsuite/gcc.dg/lto/20091013-1_0.c
gcc/testsuite/gcc.dg/lto/20091014-1_0.c
gcc/testsuite/gcc.dg/lto/20091015-1_0.c
gcc/testsuite/gcc.dg/lto/20091016-1_0.c
gcc/testsuite/gcc.dg/lto/20091020-1_0.c
gcc/testsuite/gcc.dg/lto/20091020-2_0.c
gcc/testsuite/gcc.dg/lto/20091027-1_0.c
gcc/testsuite/gcc.dg/lto/20100426_0.c
gcc/testsuite/gcc.dg/lto/20100430-1_0.c
gcc/testsuite/gcc.dg/lto/20100603-1_0.c
gcc/testsuite/gcc.dg/lto/20100603-2_0.c
gcc/testsuite/gcc.dg/lto/20100603-3_0.c
gcc/testsuite/gcc.dg/lto/20111213-1_0.c
gcc/testsuite/gcc.dg/lto/pr45736_0.c
gcc/testsuite/gcc.dg/lto/pr52634_0.c
gcc/testsuite/gcc.dg/lto/pr54702_0.c
gcc/testsuite/gcc.dg/lto/pr59323-2_0.c
gcc/testsuite/gcc.dg/lto/pr59323_0.c
gcc/testsuite/gcc.dg/lto/pr60820_0.c
gcc/testsuite/gcc.dg/lto/pr81406_0.c
gcc/testsuite/gcc.dg/lto/pr83388_0.c
gcc/testsuite/gfortran.dg/lto/20091016-1_0.f90
gcc/testsuite/gfortran.dg/lto/20091028-1_0.f90
gcc/testsuite/gfortran.dg/lto/20091028-2_0.f90
gcc/testsuite/gfortran.dg/lto/pr46911_0.f
gcc/testsuite/gfortran.dg/lto/pr47839_0.f90
gcc/toplev.c

index f25b7ef97af52cc76763e0835f3146984e9ffd74..15034d21629b5c3388899047262ab387e6cf01d6 100644 (file)
@@ -1,3 +1,26 @@
+2018-05-30  Jan Hubicka  <hubicka@ucw.cz>
+
+       * passes.c (ipa_write_summaries): Only modify statements if body
+       is in memory.
+       * cgraphunit.c (ipa_passes): Also produce intermeidate code when
+       incrementally linking.
+       (ipa_passes): Likewise.
+       * lto-cgraph.c (lto_output_node): When incrementally linking do not
+       pass down resolution info.
+       * common.opt (flag_incremental_link): Update info.
+       * gcc.c (plugin specs): Turn flinker-output=* to
+       -plugin-opt=-linker-output-known
+       * toplev.c (compile_file): Also cut compilation when doing incremental
+       link.
+       * flag-types. (enum lto_partition_model): Add
+       LTO_LINKER_OUTPUT_NOLTOREL.
+       (invoke.texi): Add -flinker-output docs.
+       * ipa.c (symbol_table::remove_unreachable_nodes): Handle LTO incremental
+       link same way as WPA; do not stream in dead initializers.
+
+       * dwarf2out.c (dwarf2out_die_ref_for_decl,
+       darf2out_register_external_decl): Support incremental link.
+
 2018-05-30  Jan Hubicka  <hubicka@ucw.cz>
 
        * lto-opts.c (lto_write_options): Skip OPT_dumpdir, OPT_fresolution_.
index 212ee7b83403d69b308d3e1ec6e98d16f2f8fb80..b2dafc669dde8aeea294e5afd4f19e8acfe5c843 100644 (file)
@@ -2452,8 +2452,11 @@ ipa_passes (void)
   if (flag_generate_lto || flag_generate_offload)
     targetm.asm_out.lto_start ();
 
-  if (!in_lto_p)
+  if (!in_lto_p
+      || flag_incremental_link == INCREMENTAL_LINK_LTO)
     {
+      if (!quiet_flag)
+       fprintf (stderr, "Streaming LTO\n");
       if (g->have_offload)
        {
          section_name_prefix = OFFLOAD_SECTION_NAME_PREFIX;
@@ -2472,7 +2475,9 @@ ipa_passes (void)
   if (flag_generate_lto || flag_generate_offload)
     targetm.asm_out.lto_end ();
 
-  if (!flag_ltrans && (in_lto_p || !flag_lto || flag_fat_lto_objects))
+  if (!flag_ltrans
+      && ((in_lto_p && flag_incremental_link != INCREMENTAL_LINK_LTO)
+         || !flag_lto || flag_fat_lto_objects))
     execute_ipa_pass_list (passes->all_regular_ipa_passes);
   invoke_plugin_callbacks (PLUGIN_ALL_IPA_PASSES_END, NULL);
 
@@ -2559,7 +2564,8 @@ symbol_table::compile (void)
 
   /* Do nothing else if any IPA pass found errors or if we are just streaming LTO.  */
   if (seen_error ()
-      || (!in_lto_p && flag_lto && !flag_fat_lto_objects))
+      || ((!in_lto_p || flag_incremental_link == INCREMENTAL_LINK_LTO)
+         && flag_lto && !flag_fat_lto_objects))
     {
       timevar_pop (TV_CGRAPHOPT);
       return;
index 13ab5c65d436955edf4095746bfdce7735890b85..4aebcaf0656e731a1f1a4ad857bfbe5b0a8ba727 100644 (file)
@@ -48,9 +48,10 @@ bool in_lto_p = false
 
 ; This variable is set to non-0 only by LTO front-end.  1 indicates that
 ; the output produced will be used for incrmeental linking (thus weak symbols
-; can still be bound).
+; can still be bound) and 2 indicates that the IL is going to be linked and
+; and output to LTO object file.
 Variable
-int flag_incremental_link = 0
+enum incremental_link flag_incremental_link = INCREMENTAL_LINK_NONE
 
 ; 0 means straightforward implementation of complex divide acceptable.
 ; 1 means wide ranges of inputs must work for complex divide.
index c05bfe43c443f4a6caf77299342378313f21ad5f..3a24225690de1b054ac2ca850176205a7d648154 100644 (file)
@@ -5860,7 +5860,8 @@ dwarf2out_die_ref_for_decl (tree decl, const char **sym,
 {
   dw_die_ref die;
 
-  if (flag_wpa && !decl_die_table)
+  if ((flag_wpa || flag_incremental_link == INCREMENTAL_LINK_LTO)
+      && !decl_die_table)
     return false;
 
   if (TREE_CODE (decl) == BLOCK)
@@ -5870,10 +5871,11 @@ dwarf2out_die_ref_for_decl (tree decl, const char **sym,
   if (!die)
     return false;
 
-  /* During WPA stage we currently use DIEs to store the
-     decl <-> label + offset map.  That's quite inefficient but it
-     works for now.  */
-  if (flag_wpa)
+  /* During WPA stage and incremental linking we currently use DIEs
+     to store the decl <-> label + offset map.  That's quite inefficient
+     but it works for now.  */
+  if (flag_wpa
+      || flag_incremental_link == INCREMENTAL_LINK_LTO)
     {
       dw_die_ref ref = get_AT_ref (die, DW_AT_abstract_origin);
       if (!ref)
@@ -5924,7 +5926,8 @@ dwarf2out_register_external_die (tree decl, const char *sym,
   if (debug_info_level == DINFO_LEVEL_NONE)
     return;
 
-  if (flag_wpa && !decl_die_table)
+  if ((flag_wpa
+       || flag_incremental_link == INCREMENTAL_LINK_LTO) && !decl_die_table)
     decl_die_table = hash_table<decl_die_hasher>::create_ggc (1000);
 
   dw_die_ref die
@@ -5959,7 +5962,8 @@ dwarf2out_register_external_die (tree decl, const char *sym,
        parent = BLOCK_DIE (ctx);
       else if (TREE_CODE (ctx) == TRANSLATION_UNIT_DECL
               /* Keep the 1:1 association during WPA.  */
-              && !flag_wpa)
+              && !flag_wpa
+              && flag_incremental_link != INCREMENTAL_LINK_LTO)
        /* Otherwise all late annotations go to the main CU which
           imports the original CUs.  */
        parent = comp_unit_die ();
@@ -5980,7 +5984,7 @@ dwarf2out_register_external_die (tree decl, const char *sym,
   switch (TREE_CODE (decl))
     {
     case TRANSLATION_UNIT_DECL:
-      if (! flag_wpa)
+      if (! flag_wpa && flag_incremental_link != INCREMENTAL_LINK_LTO)
        {
          die = comp_unit_die ();
          dw_die_ref import = new_die (DW_TAG_imported_unit, die, NULL_TREE);
index 7f79da79db01d556a6b93e64ed80b11aaa3e0c88..500f6638f36ac3e244a1df6c16871b0e584fc2d4 100644 (file)
@@ -261,6 +261,15 @@ enum sanitize_code {
                                  | SANITIZE_BOUNDS_STRICT
 };
 
+/* Settings of flag_incremental_link.  */
+enum incremental_link {
+  INCREMENTAL_LINK_NONE,
+  /* Do incremental linking and produce binary.  */
+  INCREMENTAL_LINK_NOLTO,
+  /* Do incremental linking and produce IL.  */
+  INCREMENTAL_LINK_LTO
+};
+
 /* Different trace modes.  */
 enum sanitize_coverage_code {
   /* Trace PC.  */
@@ -289,6 +298,7 @@ enum lto_partition_model {
 enum lto_linker_output {
   LTO_LINKER_OUTPUT_UNKNOWN,
   LTO_LINKER_OUTPUT_REL,
+  LTO_LINKER_OUTPUT_NOLTOREL,
   LTO_LINKER_OUTPUT_DYN,
   LTO_LINKER_OUTPUT_PIE,
   LTO_LINKER_OUTPUT_EXEC
index a716f7082591d105c69f6970eb7856671b15c319..2c597ec086a3bf470572694a06f8962c67101721 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -961,6 +961,7 @@ proper position among the other output files.  */
     -plugin %(linker_plugin_file) \
     -plugin-opt=%(lto_wrapper) \
     -plugin-opt=-fresolution=%u.res \
+    %{flinker-output=*:-plugin-opt=-linker-output-known} \
     %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} \
     }" PLUGIN_COND_CLOSE
 #else
index 9330de59c72b628c8b59af0d5e7a9c2fc8bd7913..634c69c2b5ce2c1657241514ac859c6651ca648b 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -130,9 +130,11 @@ process_references (symtab_node *snode,
                     constant folding.  Keep references alive so partitioning
                     knows about potential references.  */
                  || (VAR_P (node->decl)
-                     && flag_wpa
-                     && ctor_for_folding (node->decl)
-                        != error_mark_node))))
+                     && (flag_wpa
+                         || flag_incremental_link
+                                == INCREMENTAL_LINK_LTO)
+                     && dyn_cast <varpool_node *> (node)
+                          ->ctor_useable_for_folding_p ()))))
        {
          /* Be sure that we will not optimize out alias target
             body.  */
@@ -622,7 +624,7 @@ symbol_table::remove_unreachable_nodes (FILE *file)
            fprintf (file, " %s", vnode->dump_name ());
           vnext = next_variable (vnode);
          /* Signal removal to the debug machinery.  */
-         if (! flag_wpa)
+         if (! flag_wpa || flag_incremental_link == INCREMENTAL_LINK_LTO)
            {
              vnode->definition = false;
              (*debug_hooks->late_global_decl) (vnode->decl);
@@ -640,8 +642,9 @@ symbol_table::remove_unreachable_nodes (FILE *file)
              changed = true;
            }
          /* Keep body if it may be useful for constant folding.  */
-         if ((init = ctor_for_folding (vnode->decl)) == error_mark_node
-             && !POINTER_BOUNDS_P (vnode->decl))
+         if ((flag_wpa || flag_incremental_link == INCREMENTAL_LINK_LTO)
+             || ((init = ctor_for_folding (vnode->decl)) == error_mark_node
+                 && !POINTER_BOUNDS_P (vnode->decl)))
            vnode->remove_initializer ();
          else
            DECL_INITIAL (vnode->decl) = init;
index 40baf858ca5c274755769cf8b2433b551a392b2a..b23d1890fc0cea8d844df7e20ceb728e167a6842 100644 (file)
@@ -540,7 +540,10 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
   bp_pack_value (&bp, node->thunk.thunk_p, 1);
   bp_pack_value (&bp, node->parallelized_function, 1);
   bp_pack_enum (&bp, ld_plugin_symbol_resolution,
-               LDPR_NUM_KNOWN, node->resolution);
+               LDPR_NUM_KNOWN,
+               /* When doing incremental link, we will get new resolution
+                  info next time we process the file.  */
+               flag_incremental_link ? LDPR_UNKNOWN : node->resolution);
   bp_pack_value (&bp, node->instrumentation_clone, 1);
   bp_pack_value (&bp, node->split_part, 1);
   streamer_write_bitpack (&bp);
index cd976fa66bb1b623d0825f8a67527aa1311b9ba8..5e1e0a9d8ee7b2a0450afde320e21c576565f751 100644 (file)
@@ -1,3 +1,11 @@
+2018-05-30  Jan Hubicka  <hubicka@ucw.cz>
+
+       * lang.opt (lto_linker_output): Add nolto-rel.
+       * lto-lang.c (lto_post_options): Handle LTO_LINKER_OUTPUT_REL
+       and LTO_LINKER_OUTPUT_NOLTOREL.
+       (lto_init): Generate lto when doing incremental link.
+       * lto.c (lto_precess_name): Add lto1-inclink.
+
 2018-05-18  Jan Hubicka  <jh@suse.cz>
 
        PR lto/85583
index 0a408d30ce2debf00609de39b919322ac1e8cd3f..1d280a8e97d9b53baa0f468eec12aa8e5b84d313 100644 (file)
@@ -33,6 +33,9 @@ Enum(lto_linker_output) String(unknown) Value(LTO_LINKER_OUTPUT_UNKNOWN)
 EnumValue
 Enum(lto_linker_output) String(rel) Value(LTO_LINKER_OUTPUT_REL)
 
+EnumValue
+Enum(lto_linker_output) String(nolto-rel) Value(LTO_LINKER_OUTPUT_NOLTOREL)
+
 EnumValue
 Enum(lto_linker_output) String(dyn) Value(LTO_LINKER_OUTPUT_DYN)
 
index a310d699a1949c3e7d2f8cddec9412b800d54d01..1a70f4f1eeca04c0adc1c71d75c606d38900d1f2 100644 (file)
@@ -879,8 +879,28 @@ lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
   switch (flag_lto_linker_output)
     {
     case LTO_LINKER_OUTPUT_REL: /* .o: incremental link producing LTO IL  */
+      /* Configure compiler same way as normal frontend would do with -flto:
+        this way we read the trees (declarations & types), symbol table,
+        optimization summaries and link them. Subsequently we output new LTO
+        file.  */
+      flag_lto = "";
+      flag_incremental_link = INCREMENTAL_LINK_LTO;
       flag_whole_program = 0;
-      flag_incremental_link = 1;
+      flag_wpa = 0;
+      flag_generate_lto = 1;
+      /* It would be cool to produce .o file directly, but our current
+        simple objects does not contain the lto symbol markers.  Go the slow
+        way through the asm file.  */
+      lang_hooks.lto.begin_section = lhd_begin_section;
+      lang_hooks.lto.append_data = lhd_append_data;
+      lang_hooks.lto.end_section = lhd_end_section;
+      if (flag_ltrans)
+       error ("-flinker-output=rel and -fltrans are mutually exclussive");
+      break;
+
+    case LTO_LINKER_OUTPUT_NOLTOREL: /* .o: incremental link producing asm  */
+      flag_whole_program = 0;
+      flag_incremental_link = INCREMENTAL_LINK_NOLTO;
       break;
 
     case LTO_LINKER_OUTPUT_DYN: /* .so: PID library */
@@ -1269,7 +1289,8 @@ lto_init (void)
   in_lto_p = true;
 
   /* We need to generate LTO if running in WPA mode.  */
-  flag_generate_lto = (flag_wpa != NULL);
+  flag_generate_lto = (flag_incremental_link == INCREMENTAL_LINK_LTO
+                      || flag_wpa != NULL);
 
   /* Create the basic integer types.  */
   build_common_tree_nodes (flag_signed_char);
index d2ccaf676893785a60c31c58f13163d2e1b9c1ca..86f3fe49a68b46218e883fc457e831832a9b10f3 100644 (file)
@@ -3257,7 +3257,8 @@ static void
 lto_process_name (void)
 {
   if (flag_lto)
-    setproctitle ("lto1-lto");
+    setproctitle (flag_incremental_link == INCREMENTAL_LINK_LTO
+                 ? "lto1-inclink" : "lto1-lto");
   if (flag_wpa)
     setproctitle ("lto1-wpa");
   if (flag_ltrans)
index ad0a912e134e33f7f36a30d130ffc31e80695668..2c711f0c0b0f2a41472801a357ce962920e8c0c4 100644 (file)
@@ -2708,7 +2708,7 @@ ipa_write_summaries (void)
     {
       struct cgraph_node *node = order[i];
 
-      if (node->has_gimple_body_p ())
+      if (gimple_has_body_p (node->decl))
        {
          /* When streaming out references to statements as part of some IPA
             pass summary, the statements need to have uids assigned and the
index ae89ac891c76991f88664cb91d01404390857491..1d2af0a36bb6edeb867faf865f772ea60e027c80 100644 (file)
@@ -1,3 +1,68 @@
+2018-05-30  Jan Hubicka  <hubicka@ucw.cz>
+
+       * testsuite/g++.dg/lto/20081109-1_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20081118_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20081119-1_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20081120-1_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20081120-2_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20081123_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20081204-1_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20081219_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20090302_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20090313_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20091002-2_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20091002-3_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20091026-1_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20100724-1_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20101010-4_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20101015-2_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/20110311-1_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/pr45621_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/pr48042_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/pr48354-1_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/pr54625-1_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/pr54625-2_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/lto/pr68811_0.C: Add -flinker-output=nolto-rel.
+       * testsuite/g++.dg/torture/pr43760.C: New test. Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20081120-1_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20081120-2_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20081126_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20081204-1_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20081204-2_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20081212-1_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20081224_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20090116_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20090126-1_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20090126-2_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20090206-1_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20090219_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20091013-1_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20091014-1_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20091015-1_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20091016-1_0.c: Add -flinker-output=nolto-rel.
+       * testsuite/gcc.dg/lto/20091020-1_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/20091020-2_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/20091027-1_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/20100426_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/20100430-1_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/20100603-1_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/20100603-2_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/20100603-3_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/20111213-1_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/pr45736_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/pr52634_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/pr54702_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/pr59323-2_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/pr59323_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/pr60820_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/pr81406_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gcc.dg/lto/pr83388_0.c: Add -flinker-output-nolto-rel.
+       * testsuite/gfortran.dg/lto/20091016-1_0.f90: Add -flinker-output-nolto-rel.
+       * testsuite/gfortran.dg/lto/20091028-1_0.f90: Add -flinker-output-nolto-rel.
+       * testsuite/gfortran.dg/lto/20091028-2_0.f90: Add -flinker-output-nolto-rel.
+       * testsuite/gfortran.dg/lto/pr46911_0.f: Add -flinker-output-nolto-rel.
+       * testsuite/gfortran.dg/lto/pr47839_0.f90: Add -flinker-output-nolto-rel.
+
 2018-05-30  Andre Vieira  <andre.simoesdiasvieira@arm.com>
 
        Revert:
index 711533600ed327e251dea5ec92353b4d4f59b18a..3b5860011db7e03674189232654232db1623e20c 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-lto-do link }
 // { dg-require-effective-target fpic }
 // { dg-lto-options {{-fPIC -flto -flto-partition=1to1}} }
-// { dg-extra-ld-options "-fPIC -flto -flto-partition=1to1 -r -nostdlib -fno-exceptions" }
+// { dg-extra-ld-options "-fPIC -flto -flto-partition=1to1 -r -nostdlib -fno-exceptions -flinker-output=nolto-rel" }
 void func(); class Foo { };
 void bar() { try { func(); } catch (Foo) { } };
index c1f9dfc97a48f203ac1160c924c0042cf5f898a1..f49157bfbfd91f8a138be27a9494a3cc1aeb77d1 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-fPIC -flto -flto-partition=1to1 -r -nostdlib}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 /* We used to ICE because of dangling pointers.  */
 
index ca1455e49e775373a08768c7a236e2e66d450604..2fd320192d5193bd795763fc2bb027f2a06a2227 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-fPIC -flto -flto-partition=1to1 -r -nostdlib}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 #include "20081119-1.h"
 
index 03a9740c09110f4faa06d427d5e33429f4255368..c78e5d97dc3800e6abd54a7f4efc19289fbac39f 100644 (file)
@@ -1,5 +1,6 @@
 // { dg-lto-do link }
 // { dg-lto-options {{-flto -r -nostdlib}} }
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 extern "C"
 {
  extern __inline __attribute__((__gnu_inline__)) int pthread_equal(int, int)
index 3efe26c0197d0a55ab36d96a22f7d93ffa10570f..8deae1bb6bab5e55a2eea3b3f41baba67c27d6a5 100644 (file)
@@ -1,5 +1,6 @@
 // { dg-lto-do link }
 // { dg-lto-options {{-flto -r -nostdlib}} }
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 template < typename > struct Foo
 {
  inline void rdstate() {
index 4cbc25338dd472657354364a2cb26920cac09d34..3bbe69d0874f50985ba22c6fc9832dedc9f6adf4 100644 (file)
@@ -1,6 +1,7 @@
 // { dg-lto-do link }
 // { dg-require-effective-target fpic }
 // { dg-lto-options {{-flto -flto-partition=1to1 -r -nostdlib -fPIC}} }
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 int
 f(void)
index b87006a6bad2f07d82c84e88f5781ff36a3c27f7..e3b4cead8c640595d4189c28102a8c7ce053b29e 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-flto -flto-partition=1to1 -fPIC -r -nostdlib}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 /* Tests for the absence during linking of:
    lto1: error: type of '_ZTVN10__cxxabiv120__si_class_type_infoE' does
index 8f2c2e07edd8718ea0185166112dfc06dbe628c9..627deeb0376f8a7b7883afac8c38ba3671999f2c 100644 (file)
@@ -1,7 +1,7 @@
 // { dg-lto-do link }
 // { dg-require-effective-target fpic }
 // { dg-lto-options {{-fPIC -flto -flto-partition=1to1 -O2}} }
-// { dg-extra-ld-options "-O2 -fPIC -flto -flto-partition=1to1 -r -nostdlib" }
+// { dg-extra-ld-options "-O2 -fPIC -flto -flto-partition=1to1 -r -nostdlib -flinker-output=nolto-rel" }
 
 typedef long int ptrdiff_t;
 extern "C"
index d65d490d3e5a9044d2dd0ddc0925fb0a67405287..3a617879e19f362731d3eed7408a4c70fe53986d 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-fPIC -flto -flto-partition=1to1 -r -nostdlib}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 struct Foo {
   bool Mumble();
   static void Bar() { if (foo_->Mumble()) foo_ = 0; }
index cba9d054fcb6cc12fbb751045f30b2087253f2fe..c883cefe5b6195a3931660f8e6c60a96dd571484 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-lto-do link }
 // { dg-require-effective-target fpic }
 // { dg-lto-options {{-flto -flto-partition=1to1 -fPIC}} }
-// { dg-extra-ld-options "-flto -flto-partition=1to1 -r -nostdlib" }
+// { dg-extra-ld-options "-flto -flto-partition=1to1 -r -nostdlib -flinker-output=nolto-rel" }
 
 int X;
index 12a1596b3e2dd2f7b75b4a4a2871d308364b61be..06b75298338ecd3b7130c0ac4bc3a959663a206b 100644 (file)
@@ -1,7 +1,7 @@
 // { dg-lto-do link }
 // { dg-require-effective-target fpic }
 // { dg-lto-options {{-fPIC}} }
-// { dg-extra-ld-options "-fPIC -r -nostdlib" }
+// { dg-extra-ld-options "-fPIC -r -nostdlib -flinker-output=nolto-rel" }
 
 class DataArray {
     int max() const    { return 0; }
index 0d9afc44c281888617daa5c27fbbc6bed42686be..b49fc67e8f437dad656ab4ca282b7acf4ad004e8 100644 (file)
@@ -1,7 +1,7 @@
 // { dg-lto-do link }
 // { dg-require-effective-target fpic }
 // { dg-lto-options {{-fPIC}} }
-// { dg-extra-ld-options "-fPIC -r -nostdlib" }
+// { dg-extra-ld-options "-fPIC -r -nostdlib -flinker-output=nolto-rel" }
 
 template < class T > 
 class DataArray {
index 5c74f29cc4ca7c26d0c359b0fd51937343c5ee2e..06eff292cb610d0c56db5276da5f3bc6c47091f1 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-lto-do link }
-// { dg-extra-ld-options "-r -nostdlib" }
+// { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" }
 
 #include "20091026-1_a.h"
 cObject *cHead::find(const char *objname) const
index 084c07f0814d26d70f53acdd621e3e3aa3bb534b..f4f7e72b885810b5ad8626a1d690d4bb94fed8f0 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options {{-ftoplevel-reorder -flto -flto-partition=none} {-ftoplevel-reorder -flto -flto-partition=1to1}} } */
-/* { dg-extra-ld-options {-r -nostdlib} } */
+/* { dg-extra-ld-options {-r -nostdlib -flinker-output=nolto-rel} } */
 
 struct Foo { virtual ~Foo(); };
 struct Bar:public Foo { Bar() { } };
index 01beb2167c0425459d6314f427681e481004135e..83499947da72a84048de22293f121d054084c75b 100644 (file)
@@ -1,5 +1,6 @@
 // { dg-lto-do link }
 // { dg-lto-options { { -std=c++0x -flto -r -nostdlib } { -std=c++0x -flto -g -r -nostdlib } } }
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 typedef decltype(nullptr) nullptr_t;
 class shared_ptr {
index 9015f53a498f2217250bc6a11d28bea6517c8916..fa0e934d49a263d3a7fc2187358c2557508de606 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-lto-do link }
 // { dg-lto-options { { -flto } { -g -flto } } }
-// { dg-extra-ld-options "-r -nostdlib" }
+// { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" }
 
 struct Base { ~Base (); };
 void fun(void) { struct Deriv : Base { } x; }
index c63951e5bd8ae01efe0cf0259a86cc02056e186c..331c9ed28dc585606b43c9dfb0d98359942ef7d7 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-lto-do link } */
-/* { dg-extra-ld-options "-r -nostdlib" } */
+/* { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" } */
 
 struct NullType {};
 
index 746079cdcebf60b9431448b1b2481b11173735cd..f34b3b70fa7b4d682ed2ba9098faa03c3f81093f 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-lto-do assemble }
-// { dg-extra-ld-options "-O2 -fipa-cp-clone -flto -nostdlib -r" }
+// { dg-extra-ld-options "-O2 -fipa-cp-clone -flto -nostdlib -r -flinker-output=nolto-rel" }
 #include "pr45621.h"
 
 void
index 4ca1a0cebfe4f46823df44ae165b38316906fdf7..7754e7ec64fdf764965ce301f01a907c526c2fd9 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-lto-do link }
-// { dg-extra-ld-options "-r -nostdlib -g" }
+// { dg-extra-ld-options "-r -nostdlib -g -flinker-output=nolto-rel" }
 
 class A {
     virtual int x() = 0;
index b2ae97709dfd109aeb95c277087ccb6f677a7611..f1000657b4a101b26e52e7a18fdf70144e38aee9 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-lto-do link }
 // { dg-lto-options { { -g -flto } } }
-// { dg-extra-ld-options "-r -nostdlib" }
+// { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" }
 
 template<typename T> struct Identity { typedef T type; };
 struct S {
index 48bbdf02de76ae5f764626bde8db8a5c317651f3..43cba36a30f853ba03c409a6ce79374149fe18e8 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-lto-do link } */
-/* { dg-extra-ld-options { -r -nostdlib } } */
+/* { dg-extra-ld-options { -r -nostdlib -flinker-output=nolto-rel } } */
 
 float a;
 double sin ();
index 3e67d4f5b4e8071d35a4bceaacff8ab77e8f3a16..5873b793c4fe31ccecea6d092a1a90bdad39e427 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-lto-do link } */
-/* { dg-extra-ld-options { -r -nostdlib } } */
+/* { dg-extra-ld-options { -r -nostdlib -flinker-output=nolto-rel } } */
 
 float a;
 double sin ();
index 807c803b3473fda2f3911415a5bbde54500fef32..a18dc26eb8e8b30402e58c7c555df1a7b66a3862 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-lto-do link }
 /* { dg-lto-options { { -O2 -w } { -w } } } */
-// { dg-extra-ld-options "-r -nostdlib" }
+// { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" }
 extern "C" char *strcpy(char *, const char *);
 char InitXPCOMGlue_lastSlash;
 void InitXPCOMGlue() { strcpy(&InitXPCOMGlue_lastSlash, ".so"); }
diff --git a/gcc/testsuite/g++.dg/torture/pr85583.C b/gcc/testsuite/g++.dg/torture/pr85583.C
new file mode 100644 (file)
index 0000000..eae8c5e
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do link } */
+class b {
+public:
+  virtual ~b();
+};
+template <typename> class c : b {};
+class B {
+  c<char> d;
+};
+extern template class c<char>;
+int
+main(void) { B a; return 0; }
+
index e842b37f6631bfea498b27c7434a6e95e9044e6b..c426fd2f74a5d57aaa94fa464c3ee54457b6ef6d 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options {{-flto -r -nostdlib}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 extern int stat(void) __asm__("" "stat64");
 extern inline int stat(void) { }
 static void foo(void) { stat(); }
index e2e11d64b6364a731a6ce825feec5c49f100d2ec..762e0ffc742a0d41247cb623a6497d2142465450 100644 (file)
@@ -1,3 +1,4 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options {{-flto -flto-partition=1to1 -r -nostdlib}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 void bar(void) {}
index f610d097ed68d025d5f819dde65927954cc97ce3..ce65562167dae4c3d20e6d6638ed4d3d584de392 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } } */
 /* { dg-lto-options {{-flto -r -nostdlib}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 int f(void) {
   register int ri asm("edi");
index 0c3849f6182793c91bbd3a42f6f09ed0f9bbdbfb..b8909310657566471f64150c7961f7883f5518a7 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-flto -flto-partition=1to1 -fPIC -r -nostdlib}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 /* Tests for the absence during linking of:
    lto1: error: type of 'i' does not match original declaration  */
index c08da1791d16af34b94d46bff53230e58fed8243..0770567067830685fb099749241670ddd027f056 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } } */
 /* { dg-lto-options {{-w -flto -fPIC -r -nostdlib}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 register int ri asm("edi");
index acc00186840b7d278a3b74c331df0a8111b5a5e8..327821a73cf05cb2b5830e96efe03415b39c6f50 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options {{-r -nostdlib}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 int exported_var = 42;
 /* { dg-final { scan-symbol "exported_var" } } */
index 9f9afdf85c7dbb1a86f8c56eae6831b93680f9c4..b319acb562e06e7b0a76214e9bff6f180e36881f 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-flto -flto-partition=1to1 -r -nostdlib -fPIC}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 #include "20081224_0.h"
 
 extern struct foo x;
index 4a865969901e364d10407bbcb7aaa835d00fa7ee..dc8043c368aa0277fb83daefbdc7d144bebcf157 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-O1 -flto -flto-partition=1to1 -fPIC}} } */
-/* { dg-extra-ld-options {-r -nostdlib -O0} } */
+/* { dg-extra-ld-options {-r -nostdlib -O0 -flinker-output=nolto-rel} } */
 
 int foo(void) {
  int ret, i;
index 01a12994021836cb4b9ccc424f5a7a5d9ec85477..6e8f741671969ac428d5ad8df7632f28e514b547 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options {{-O0 -flto -flto-partition=1to1}} } */
-/* { dg-extra-ld-options {-r -nostdlib -O2 -flto -flto-partition=1to1} } */
+/* { dg-extra-ld-options {-r -nostdlib -O2 -flto -flto-partition=1to1 -flinker-output=nolto-rel} } */
 
 int main(int argc, char **argv) {
   return 0;
index f75a05fec624c075b86d291ab0e471c74ac3735a..1ffa7aedd5039d9f75d19254513ba69b3667628d 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-fPIC -O2 -flto -flto-partition=1to1}} } */
-/* { dg-extra-ld-options {-fno-PIC -r -nostdlib -O2 -flto -flto-partition=1to1} } */
+/* { dg-extra-ld-options {-fno-PIC -r -nostdlib -O2 -flto -flto-partition=1to1 -flinker-output=nolto-rel} } */
 
 int main(int argc, char **argv) {
   return 0;
index 3fbfb23843da1452c44a9e7a946819edbbb153c0..1361042f29739a619ac80b53978fae7f90e9642e 100644 (file)
@@ -3,6 +3,7 @@
 /* { dg-lto-options {{-fPIC -r -nostdlib -flto -flto-partition=1to1 -msse2}} } */
 /* { dg-require-effective-target sse2 } */
 /* { dg-suppress-ld-options {-fPIC -msse2} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 typedef short v8hi __attribute__((__vector_size__(16)));
 void func (void) {
index 985c884cecd7f2a61ecdea6959607b8cd7099992..66fbcd11bcafc3742fe34deb655fa419a4180f67 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-O3 -flto -flto-partition=1to1 -fPIC -r -nostdlib}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 struct Foo { int f1, f2, f3, f4, f5; };
 
index 83de8d3223bd1b1574bf307f024c1404986d9447..979677088ba1d662c6180da2e6d515e27df212e1 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-fPIC -r -nostdlib -flto} {-fPIC -r -nostdlib -O2 -flto}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 void * HeapAlloc(void*,unsigned int,unsigned long);
 
index be327aaff908ec5030b8e1cd2017d88970c906a5..99295d3d95c0f5deaf9fc9b1b92521d8089ab11c 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-fPIC -r -nostdlib -flto}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 /* Empty file.  See PR41173.  */
index 1c11f644888d4f04ce59cd25fe951eb3ff43c803..698a7d9a4896cc905ea75ef5afa9a814f58e9695 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-fPIC -r -nostdlib -O2 -flto} {-fPIC -r -nostdlib -O2 -flto -flto-partition=1to1}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 #include "20091015-1_b.h"
 void diagnostic_initialize (FILE **stream) { *stream = stderr; }
index b44c75a97c487743ae65cd9bdbb8111f76029730..e7a2915cd5a9aa6ac89c451b7e493f00239368c4 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-fPIC -r -nostdlib -O2 -flto}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 typedef struct VEC_constructor_elt_gc { } VEC_constructor_elt_gc;
 #include "20091016-1_a.h"
index f9d8bf87de60f7d90df894fcee4a03f686cb26aa..110d3e10e0511b35959b4f214fd9286a16427726 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-fPIC -r -nostdlib -flto}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 typedef struct {
     int NumPackStreams;
index 21e5967873230358e79749dbc8ef83fb34bfccff..e0b3839c5106902ad5adbc72c0952350d68157c5 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-fPIC -r -nostdlib -flto}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 typedef struct {
     int NumPackStreams;
index f2669fe0f00eb9ee6c5e7c4e8edbc79f0c646786..c9a867bc924e5f1c83ae95037dcd41a8d15163d6 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-lto-do link } */
-/* { dg-extra-ld-options "-r -nostdlib" } */
+/* { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" } */
 
 typedef struct _xmlDict xmlDict;
 struct _xmlDict {
index e1dc06f960bd019397a86306b3ebacc243a40d6b..49f7122e13cf0f017a79d8f67c78b45731bde1d0 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options {{-r -nostdlib -flto -g}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 long Perl_my_htonl (long l)
 {
index d2e79c6291451f801488bfb62b7df363add1df96..1ccfc9ac1ca726136ce789c4ac4662c461179681 100644 (file)
@@ -1,5 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options {{-O2 -fprofile-arcs -flto -r -nostdlib}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
+
 
 void
 expand_stmt_with_iterators_1 (void)
index cc35c78cfae90e767b59e1166dc50b479b58c159..3cba481fe93fac07302a92d733ff1ee470935718 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-lto-do link } */
 /* { dg-extra-ld-options {-r -nostdlib} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 /* This file intentionally left empty.  */
index 11bee496d9c0103dbfb7537f0a11b2e870b660c9..94c6d007ef02a079ba4da29e42675f81dd002c0e 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-extra-ld-options {-r -nostdlib} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 int foo;
 int *i = &foo;
index 3fc08fdbf6bb400f1f8f34732323c8e680032156..09d5b26e2305c96ce7e1e8dce185411e297d2cce 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-lto-do link } */
 /* { dg-extra-ld-options {-r -nostdlib} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 int i = 42;
index e6f54748a80361626b38fcfb5fe497287b28fee8..779c12d1def7dcfe4ffc530d11539473def84cc2 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options { { -flto -g } } } */
 /* { dg-extra-ld-options {-r -nostdlib} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 void gfc_be_parse_file (void)
 {
index 860e239b53256e28be1756648eccdfc391dad51f..d481c453d08fddcfd5018325209de96099ee380d 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options {{-flto -r -nostdlib -O}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 
 extern void baz (void);
 
index a858cc1a5cff73c152e393b8efb380fbceaaabe0..7aba0cd3caf03e86d25c8fc021dfe758b8f9fb6d 100644 (file)
@@ -2,6 +2,7 @@
 /* { dg-require-alias "" } */
 /* { dg-lto-do link } */
 /* { dg-lto-options {{-flto -r -nostdlib -flto-partition=1to1}} */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 extern int cfliteValueCallBacks;
 void baz (int *);
 int main () { baz(&cfliteValueCallBacks); }
index 2242f50b6def63465f4ed27e0c1e3ab17e997d6a..2713d225dda5ba7eb31b7f83eb6a51d6d7e726b3 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options { { -O2 -flto -w } } } */
-/* { dg-extra-ld-options { -r -nostdlib } } */
+/* { dg-extra-ld-options { -r -nostdlib -flinker-output=nolto-rel } } */
 
 #include <stdlib.h>
 void* f ()
index 938a89d6a2807dd38c19cea37908aa47a95d826e..61872dd5f75d7f8bcf853fafb298a3b2bc6626ea 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options { { -O2 -g -flto } } } */
-/* { dg-extra-ld-options { -r -nostdlib } } */
+/* { dg-extra-ld-options { -r -nostdlib -flinker-output=nolto-rel } } */
 
 extern void bar(void);
 
index b5910589158a4c219e4f49c8d778156bd2d9c9bb..ee780277657363ccaaedc9915cc5f296df713cf6 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options { { -O2 -g -flto } } } */
-/* { dg-extra-ld-options { -r -nostdlib } } */
+/* { dg-extra-ld-options { -r -nostdlib -flinker-output=nolto-rel } } */
 
 extern void bar(void);
 
index 57b5b6c443b53cd38c596958172c1a9ae76f1268..9fd2d2b76e42f955a8fcf01bf5d56153efae0585 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options {{-flto -r -nostdlib -O2}} } */
+/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
 /* { dg-skip-if "no alias" { *-*-darwin* } } */
 #include <stdio.h>
 struct in6_addr {int bah;};
index 44ef3c73992d79a2529fe0ea6f7068b4a8a21797..26d4195bf638d67aac64913bc0baa3a29e272f66 100644 (file)
@@ -1,7 +1,7 @@
 /* PR lto/81406 */
 /* { dg-lto-do link } */
 /* { dg-lto-options { { -O2 -g -flto } } } */
-/* { dg-extra-ld-options { -g -r -nostdlib } } */
+/* { dg-extra-ld-options { -g -r -nostdlib -flinker-output=nolto-rel } } */
 
 int a;
 int *foo (void);
index 4febbac06da05a53548f611ded1cd8f625ece959..eb60b0e17745ef6418919a08b70e20b4278bebc5 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options { { -O2 -flto -fsanitize=null } { -O0 -flto -fsanitize=null } } } */
-/* { dg-extra-ld-options { -fno-sanitize=null -r -nostdlib } } */
+/* { dg-extra-ld-options { -fno-sanitize=null -r -nostdlib -flinker-output=nolto-rel } } */
 
 enum { a } e(void);
 struct C {
index a882da042cd9aed8ab44d0dee9bfa75602b0057c..5e96e88731ff0041b83d208bfcb0274069ec5bc6 100644 (file)
@@ -1,5 +1,6 @@
 ! { dg-lto-do link }
 ! { dg-lto-options {{-flto -g -fPIC -r -nostdlib} {-O -flto -g -fPIC -r -nostdlib}} }
+! { dg-extra-ld-options "-flinker-output=nolto-rel" }
 
       FUNCTION makenumberstring(x)
       IMPLICIT NONE
index 57c1b1f60287285ad04a5471159d38034b4d25ed..3b32432f81d3385df66d9488b3ae3b42da1d979b 100644 (file)
@@ -1,5 +1,5 @@
 ! { dg-lto-do link }
-! { dg-extra-ld-options "-r -nostdlib -finline-functions" }
+! { dg-extra-ld-options "-r -nostdlib -finline-functions -flinker-output=nolto-rel" }
 
 SUBROUTINE int_gen_ti_header_char( hdrbuf, hdrbufsize, itypesize, &
                               DataHandle, Element, VarName, Data, code )
index 57c1b1f60287285ad04a5471159d38034b4d25ed..3b32432f81d3385df66d9488b3ae3b42da1d979b 100644 (file)
@@ -1,5 +1,5 @@
 ! { dg-lto-do link }
-! { dg-extra-ld-options "-r -nostdlib -finline-functions" }
+! { dg-extra-ld-options "-r -nostdlib -finline-functions -flinker-output=nolto-rel" }
 
 SUBROUTINE int_gen_ti_header_char( hdrbuf, hdrbufsize, itypesize, &
                               DataHandle, Element, VarName, Data, code )
index fce959750aea7915cc5324bee5552eaebd5b1658..1ee938d8c6ca4f01770f37f624d9d4b19409a9b9 100644 (file)
@@ -1,6 +1,6 @@
 ! { dg-lto-do link }
 ! { dg-lto-options {{ -O2 -flto -g }} }
-! { dg-extra-ld-options "-r -nostdlib" }
+! { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" }
       common/main1/ eps(2)
       call dalie6s(iqmod6,1,wx,cor6d)
       end
index 9ea9315284a1aa67dc0070b49efda13f7665f9b3..dcc4223d80cab992f1c41580d607875c234489ca 100644 (file)
@@ -1,6 +1,6 @@
 ! { dg-lto-do link }
 ! { dg-lto-options {{ -g -flto }} }
-! { dg-extra-ld-options "-r -nostdlib" }
+! { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" }
 
 MODULE globalvar_mod
 integer        :: xstop
index b066bcc72297fad53dcea3f5e605a0c87c6402a2..8f812c2a475dda61d5eb3e1e61e2011c634329f3 100644 (file)
@@ -495,7 +495,8 @@ compile_file (void)
 
   /* Compilation unit is finalized.  When producing non-fat LTO object, we are
      basically finished.  */
-  if (in_lto_p || !flag_lto || flag_fat_lto_objects)
+  if ((in_lto_p && flag_incremental_link != INCREMENTAL_LINK_LTO)
+      || !flag_lto || flag_fat_lto_objects)
     {
       /* File-scope initialization for AddressSanitizer.  */
       if (flag_sanitize & SANITIZE_ADDRESS)