summaryrefslogtreecommitdiffstats
path: root/lto-plugin
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2020-05-05 12:33:11 +0200
committerEric Botcazou <ebotcazou@gcc.gnu.org>2020-05-05 12:42:22 +0200
commit5269b24605b17211f34dd40df2d18ba7a7f481e2 (patch)
tree8837eee81dbd7ff67d62c12f8dacc61f95c4995f /lto-plugin
parentDo not put incomplete CONSTRUCTORs into static memory (diff)
downloadgcc-5269b24605b17211f34dd40df2d18ba7a7f481e2.tar.gz
gcc-5269b24605b17211f34dd40df2d18ba7a7f481e2.tar.bz2
gcc-5269b24605b17211f34dd40df2d18ba7a7f481e2.tar.xz
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.
Diffstat (limited to 'lto-plugin')
-rw-r--r--lto-plugin/ChangeLog12
-rw-r--r--lto-plugin/lto-plugin.c28
2 files changed, 30 insertions, 10 deletions
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index 4ffbf122ebd..9ce708dfb30 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -1,3 +1,15 @@
12020-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
12020-04-28 H.J. Lu <hongjiu.lu@intel.com> 132020-04-28 H.J. Lu <hongjiu.lu@intel.com>
2 14
3 PR bootstrap/94739 15 PR bootstrap/94739
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index ca6c84a1ffd..37f4bda742a 100644
--- 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
32 -nop: Instead of running lto-wrapper, pass the original to the plugin. This 32 -nop: Instead of running lto-wrapper, pass the original to the plugin. This
33 only works if the input files are hybrid. 33 only works if the input files are hybrid.
34 -linker-output-known: Do not determine linker output 34 -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.
35 -sym-style={none,win32,underscore|uscore} 38 -sym-style={none,win32,underscore|uscore}
36 -pass-through */ 39 -pass-through */
37 40
@@ -195,8 +198,9 @@ static bool verbose;
195static char nop; 198static char nop;
196static char *resolution_file = NULL; 199static char *resolution_file = NULL;
197static enum ld_plugin_output_file_type linker_output; 200static enum ld_plugin_output_file_type linker_output;
198static int linker_output_set; 201static bool linker_output_set;
199static int linker_output_known; 202static bool linker_output_known;
203static bool linker_output_auto_nolto_rel;
200static const char *link_output_name = NULL; 204static const char *link_output_name = NULL;
201 205
202/* The version of gold being used, or -1 if not gold. The number is 206/* The version of gold being used, or -1 if not gold. The number is
@@ -709,9 +713,10 @@ use_original_files (void)
709static enum ld_plugin_status 713static enum ld_plugin_status
710all_symbols_read_handler (void) 714all_symbols_read_handler (void)
711{ 715{
716 const unsigned num_lto_args
717 = num_claimed_files + lto_wrapper_num_args + 2
718 + !linker_output_known + !linker_output_auto_nolto_rel;
712 unsigned i; 719 unsigned i;
713 unsigned num_lto_args = num_claimed_files + lto_wrapper_num_args + 2
714 + !linker_output_known;
715 char **lto_argv; 720 char **lto_argv;
716 const char *linker_output_str = NULL; 721 const char *linker_output_str = NULL;
717 const char **lto_arg_ptr; 722 const char **lto_arg_ptr;
@@ -743,9 +748,10 @@ all_symbols_read_handler (void)
743 case LDPO_REL: 748 case LDPO_REL:
744 if (non_claimed_files) 749 if (non_claimed_files)
745 { 750 {
746 message (LDPL_WARNING, "incremental linking of LTO and non-LTO " 751 if (!linker_output_auto_nolto_rel)
747 "objects; using -flinker-output=nolto-rel which will " 752 message (LDPL_WARNING, "incremental linking of LTO and non-LTO"
748 "bypass whole program optimization"); 753 " objects; using -flinker-output=nolto-rel which will"
754 " bypass whole program optimization");
749 linker_output_str = "-flinker-output=nolto-rel"; 755 linker_output_str = "-flinker-output=nolto-rel";
750 } 756 }
751 else 757 else
@@ -1291,8 +1297,10 @@ static void
1291process_option (const char *option) 1297process_option (const char *option)
1292{ 1298{
1293 if (strcmp (option, "-linker-output-known") == 0) 1299 if (strcmp (option, "-linker-output-known") == 0)
1294 linker_output_known = 1; 1300 linker_output_known = true;
1295 if (strcmp (option, "-debug") == 0) 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)
1296 debug = true; 1304 debug = true;
1297 else if ((strcmp (option, "-v") == 0) 1305 else if ((strcmp (option, "-v") == 0)
1298 || (strcmp (option, "--verbose") == 0)) 1306 || (strcmp (option, "--verbose") == 0))
@@ -1390,7 +1398,7 @@ onload (struct ld_plugin_tv *tv)
1390 break; 1398 break;
1391 case LDPT_LINKER_OUTPUT: 1399 case LDPT_LINKER_OUTPUT:
1392 linker_output = (enum ld_plugin_output_file_type) p->tv_u.tv_val; 1400 linker_output = (enum ld_plugin_output_file_type) p->tv_u.tv_val;
1393 linker_output_set = 1; 1401 linker_output_set = true;
1394 break; 1402 break;
1395 case LDPT_OUTPUT_NAME: 1403 case LDPT_OUTPUT_NAME:
1396 /* We only use this to make user-friendly temp file names. */ 1404 /* We only use this to make user-friendly temp file names. */