• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GCC with patches for OS216


Commit MetaInfo

Revision5269b24605b17211f34dd40df2d18ba7a7f481e2 (tree)
Time2020-05-05 19:42:22
AuthorEric Botcazou <ebotcazou@gcc....>
CommiterEric Botcazou

Log Message

Silence warning in LTO mode on VxWorks

The link phase is always partial (-r) for VxWorks in kernel mode, which
means that it uses incremental LTO linking by default (-flinker-output=rel).
But in this mode the LTO plugin outputs a warning if one of the object files
involved in the link does not contain LTO bytecode, before switching to
nolto-rel mode. We do not do repeated incremental linking for VxWorks so
silence the warning.

lto-plugin/
* lto-plugin.c: Document -linker-output-auto-notlo-rel option.
(linker_output_set): Change type to bool.
(linker_output_known): Likewise.
(linker_output_auto_nolto_rel): New variable.
(all_symbols_read_handler): Take it into account.
<LDPO_REL>: Do not issue the warning if it is set.
(process_option): Process -linker-output-auto-notlo-rel.
(cleanup_handler): Remove unused variable.
(onload) <LDPT_LINKER_OUTPUT>: Adjust to above type change.
gcc/
* gcc.c (LTO_PLUGIN_SPEC): Define if not already.
(LINK_PLUGIN_SPEC): Execute LTO_PLUGIN_SPEC.
* config/vxworks.h (LTO_PLUGIN_SPEC): Define.

Change Summary

Incremental Difference

--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
11 2020-05-05 Eric Botcazou <ebotcazou@adacore.com>
22
3+ * gcc.c (LTO_PLUGIN_SPEC): Define if not already.
4+ (LINK_PLUGIN_SPEC): Execute LTO_PLUGIN_SPEC.
5+ * config/vxworks.h (LTO_PLUGIN_SPEC): Define.
6+
7+2020-05-05 Eric Botcazou <ebotcazou@adacore.com>
8+
39 * gimplify.c (gimplify_init_constructor): Do not put the constructor
410 into static memory if it is not complete.
511
--- a/gcc/config/vxworks.h
+++ b/gcc/config/vxworks.h
@@ -273,3 +273,11 @@ extern void vxworks_asm_out_destructor (rtx symbol, int priority);
273273 #undef DWARF_GNAT_ENCODINGS_DEFAULT
274274 #define DWARF_GNAT_ENCODINGS_DEFAULT \
275275 (TARGET_VXWORKS7 ? DWARF_GNAT_ENCODINGS_MINIMAL : DWARF_GNAT_ENCODINGS_ALL)
276+
277+/* The default configuration of incremental LTO linking (-flinker-output=rel)
278+ warns if an object file included in the link does not contain LTO bytecode,
279+ because in this case the output will not contain it either, thus preventing
280+ further incremental LTO linking. We do not do repeated incremental linking
281+ so silence the warning (instead of passing -flinker-output=nolto-rel). */
282+#undef LTO_PLUGIN_SPEC
283+#define LTO_PLUGIN_SPEC "%{!mrtp:-plugin-opt=-linker-output-auto-notlo-rel}"
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -944,6 +944,10 @@ proper position among the other output files. */
944944 # endif
945945 #endif
946946
947+#ifndef LTO_PLUGIN_SPEC
948+#define LTO_PLUGIN_SPEC ""
949+#endif
950+
947951 /* Conditional to test whether the LTO plugin is used or not.
948952 FIXME: For slim LTO we will need to enable plugin unconditionally. This
949953 still cause problems with PLUGIN_LD != LD and when plugin is built but
@@ -968,6 +972,7 @@ proper position among the other output files. */
968972 -plugin %(linker_plugin_file) \
969973 -plugin-opt=%(lto_wrapper) \
970974 -plugin-opt=-fresolution=%u.res \
975+ " LTO_PLUGIN_SPEC "\
971976 %{flinker-output=*:-plugin-opt=-linker-output-known} \
972977 %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} \
973978 }" PLUGIN_COND_CLOSE
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -1,3 +1,15 @@
1+2020-05-05 Eric Botcazou <ebotcazou@adacore.com>
2+
3+ * lto-plugin.c: Document -linker-output-auto-notlo-rel option.
4+ (linker_output_set): Change type to bool.
5+ (linker_output_known): Likewise.
6+ (linker_output_auto_nolto_rel): New variable.
7+ (all_symbols_read_handler): Take it into account.
8+ <LDPO_REL>: Do not issue the warning if it is set.
9+ (process_option): Process -linker-output-auto-notlo-rel.
10+ (cleanup_handler): Remove unused variable.
11+ (onload) <LDPT_LINKER_OUTPUT>: Adjust to above type change.
12+
113 2020-04-28 H.J. Lu <hongjiu.lu@intel.com>
214
315 PR bootstrap/94739
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -32,6 +32,9 @@ along with this program; see the file COPYING3. If not see
3232 -nop: Instead of running lto-wrapper, pass the original to the plugin. This
3333 only works if the input files are hybrid.
3434 -linker-output-known: Do not determine linker output
35+ -linker-output-auto-notlo-rel: Switch from rel to nolto-rel mode without
36+ warning. This is used on systems like VxWorks (kernel) where the link is
37+ always partial and repeated incremental linking is generally not used.
3538 -sym-style={none,win32,underscore|uscore}
3639 -pass-through */
3740
@@ -195,8 +198,9 @@ static bool verbose;
195198 static char nop;
196199 static char *resolution_file = NULL;
197200 static enum ld_plugin_output_file_type linker_output;
198-static int linker_output_set;
199-static int linker_output_known;
201+static bool linker_output_set;
202+static bool linker_output_known;
203+static bool linker_output_auto_nolto_rel;
200204 static const char *link_output_name = NULL;
201205
202206 /* The version of gold being used, or -1 if not gold. The number is
@@ -709,9 +713,10 @@ use_original_files (void)
709713 static enum ld_plugin_status
710714 all_symbols_read_handler (void)
711715 {
716+ const unsigned num_lto_args
717+ = num_claimed_files + lto_wrapper_num_args + 2
718+ + !linker_output_known + !linker_output_auto_nolto_rel;
712719 unsigned i;
713- unsigned num_lto_args = num_claimed_files + lto_wrapper_num_args + 2
714- + !linker_output_known;
715720 char **lto_argv;
716721 const char *linker_output_str = NULL;
717722 const char **lto_arg_ptr;
@@ -743,9 +748,10 @@ all_symbols_read_handler (void)
743748 case LDPO_REL:
744749 if (non_claimed_files)
745750 {
746- message (LDPL_WARNING, "incremental linking of LTO and non-LTO "
747- "objects; using -flinker-output=nolto-rel which will "
748- "bypass whole program optimization");
751+ if (!linker_output_auto_nolto_rel)
752+ message (LDPL_WARNING, "incremental linking of LTO and non-LTO"
753+ " objects; using -flinker-output=nolto-rel which will"
754+ " bypass whole program optimization");
749755 linker_output_str = "-flinker-output=nolto-rel";
750756 }
751757 else
@@ -1291,8 +1297,10 @@ static void
12911297 process_option (const char *option)
12921298 {
12931299 if (strcmp (option, "-linker-output-known") == 0)
1294- linker_output_known = 1;
1295- if (strcmp (option, "-debug") == 0)
1300+ linker_output_known = true;
1301+ else if (strcmp (option, "-linker-output-auto-notlo-rel") == 0)
1302+ linker_output_auto_nolto_rel = true;
1303+ else if (strcmp (option, "-debug") == 0)
12961304 debug = true;
12971305 else if ((strcmp (option, "-v") == 0)
12981306 || (strcmp (option, "--verbose") == 0))
@@ -1390,7 +1398,7 @@ onload (struct ld_plugin_tv *tv)
13901398 break;
13911399 case LDPT_LINKER_OUTPUT:
13921400 linker_output = (enum ld_plugin_output_file_type) p->tv_u.tv_val;
1393- linker_output_set = 1;
1401+ linker_output_set = true;
13941402 break;
13951403 case LDPT_OUTPUT_NAME:
13961404 /* We only use this to make user-friendly temp file names. */