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.
This commit is contained in:
parent
2badc98853
commit
5269b24605
5 changed files with 49 additions and 10 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2020-05-05 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
|
* gcc.c (LTO_PLUGIN_SPEC): Define if not already.
|
||||||
|
(LINK_PLUGIN_SPEC): Execute LTO_PLUGIN_SPEC.
|
||||||
|
* config/vxworks.h (LTO_PLUGIN_SPEC): Define.
|
||||||
|
|
||||||
2020-05-05 Eric Botcazou <ebotcazou@adacore.com>
|
2020-05-05 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
* gimplify.c (gimplify_init_constructor): Do not put the constructor
|
* gimplify.c (gimplify_init_constructor): Do not put the constructor
|
||||||
|
|
|
@ -273,3 +273,11 @@ extern void vxworks_asm_out_destructor (rtx symbol, int priority);
|
||||||
#undef DWARF_GNAT_ENCODINGS_DEFAULT
|
#undef DWARF_GNAT_ENCODINGS_DEFAULT
|
||||||
#define DWARF_GNAT_ENCODINGS_DEFAULT \
|
#define DWARF_GNAT_ENCODINGS_DEFAULT \
|
||||||
(TARGET_VXWORKS7 ? DWARF_GNAT_ENCODINGS_MINIMAL : DWARF_GNAT_ENCODINGS_ALL)
|
(TARGET_VXWORKS7 ? DWARF_GNAT_ENCODINGS_MINIMAL : DWARF_GNAT_ENCODINGS_ALL)
|
||||||
|
|
||||||
|
/* The default configuration of incremental LTO linking (-flinker-output=rel)
|
||||||
|
warns if an object file included in the link does not contain LTO bytecode,
|
||||||
|
because in this case the output will not contain it either, thus preventing
|
||||||
|
further incremental LTO linking. We do not do repeated incremental linking
|
||||||
|
so silence the warning (instead of passing -flinker-output=nolto-rel). */
|
||||||
|
#undef LTO_PLUGIN_SPEC
|
||||||
|
#define LTO_PLUGIN_SPEC "%{!mrtp:-plugin-opt=-linker-output-auto-notlo-rel}"
|
||||||
|
|
|
@ -944,6 +944,10 @@ proper position among the other output files. */
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef LTO_PLUGIN_SPEC
|
||||||
|
#define LTO_PLUGIN_SPEC ""
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Conditional to test whether the LTO plugin is used or not.
|
/* Conditional to test whether the LTO plugin is used or not.
|
||||||
FIXME: For slim LTO we will need to enable plugin unconditionally. This
|
FIXME: For slim LTO we will need to enable plugin unconditionally. This
|
||||||
still cause problems with PLUGIN_LD != LD and when plugin is built but
|
still cause problems with PLUGIN_LD != LD and when plugin is built but
|
||||||
|
@ -968,6 +972,7 @@ proper position among the other output files. */
|
||||||
-plugin %(linker_plugin_file) \
|
-plugin %(linker_plugin_file) \
|
||||||
-plugin-opt=%(lto_wrapper) \
|
-plugin-opt=%(lto_wrapper) \
|
||||||
-plugin-opt=-fresolution=%u.res \
|
-plugin-opt=-fresolution=%u.res \
|
||||||
|
" LTO_PLUGIN_SPEC "\
|
||||||
%{flinker-output=*:-plugin-opt=-linker-output-known} \
|
%{flinker-output=*:-plugin-opt=-linker-output-known} \
|
||||||
%{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} \
|
%{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} \
|
||||||
}" PLUGIN_COND_CLOSE
|
}" PLUGIN_COND_CLOSE
|
||||||
|
|
|
@ -1,3 +1,15 @@
|
||||||
|
2020-05-05 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2020-04-28 H.J. Lu <hongjiu.lu@intel.com>
|
2020-04-28 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
PR bootstrap/94739
|
PR bootstrap/94739
|
||||||
|
|
|
@ -32,6 +32,9 @@ along with this program; see the file COPYING3. If not see
|
||||||
-nop: Instead of running lto-wrapper, pass the original to the plugin. This
|
-nop: Instead of running lto-wrapper, pass the original to the plugin. This
|
||||||
only works if the input files are hybrid.
|
only works if the input files are hybrid.
|
||||||
-linker-output-known: Do not determine linker output
|
-linker-output-known: Do not determine linker output
|
||||||
|
-linker-output-auto-notlo-rel: Switch from rel to nolto-rel mode without
|
||||||
|
warning. This is used on systems like VxWorks (kernel) where the link is
|
||||||
|
always partial and repeated incremental linking is generally not used.
|
||||||
-sym-style={none,win32,underscore|uscore}
|
-sym-style={none,win32,underscore|uscore}
|
||||||
-pass-through */
|
-pass-through */
|
||||||
|
|
||||||
|
@ -195,8 +198,9 @@ static bool verbose;
|
||||||
static char nop;
|
static char nop;
|
||||||
static char *resolution_file = NULL;
|
static char *resolution_file = NULL;
|
||||||
static enum ld_plugin_output_file_type linker_output;
|
static enum ld_plugin_output_file_type linker_output;
|
||||||
static int linker_output_set;
|
static bool linker_output_set;
|
||||||
static int linker_output_known;
|
static bool linker_output_known;
|
||||||
|
static bool linker_output_auto_nolto_rel;
|
||||||
static const char *link_output_name = NULL;
|
static const char *link_output_name = NULL;
|
||||||
|
|
||||||
/* The version of gold being used, or -1 if not gold. The number is
|
/* The version of gold being used, or -1 if not gold. The number is
|
||||||
|
@ -709,9 +713,10 @@ use_original_files (void)
|
||||||
static enum ld_plugin_status
|
static enum ld_plugin_status
|
||||||
all_symbols_read_handler (void)
|
all_symbols_read_handler (void)
|
||||||
{
|
{
|
||||||
|
const unsigned num_lto_args
|
||||||
|
= num_claimed_files + lto_wrapper_num_args + 2
|
||||||
|
+ !linker_output_known + !linker_output_auto_nolto_rel;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned num_lto_args = num_claimed_files + lto_wrapper_num_args + 2
|
|
||||||
+ !linker_output_known;
|
|
||||||
char **lto_argv;
|
char **lto_argv;
|
||||||
const char *linker_output_str = NULL;
|
const char *linker_output_str = NULL;
|
||||||
const char **lto_arg_ptr;
|
const char **lto_arg_ptr;
|
||||||
|
@ -743,9 +748,10 @@ all_symbols_read_handler (void)
|
||||||
case LDPO_REL:
|
case LDPO_REL:
|
||||||
if (non_claimed_files)
|
if (non_claimed_files)
|
||||||
{
|
{
|
||||||
message (LDPL_WARNING, "incremental linking of LTO and non-LTO "
|
if (!linker_output_auto_nolto_rel)
|
||||||
"objects; using -flinker-output=nolto-rel which will "
|
message (LDPL_WARNING, "incremental linking of LTO and non-LTO"
|
||||||
"bypass whole program optimization");
|
" objects; using -flinker-output=nolto-rel which will"
|
||||||
|
" bypass whole program optimization");
|
||||||
linker_output_str = "-flinker-output=nolto-rel";
|
linker_output_str = "-flinker-output=nolto-rel";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1291,8 +1297,10 @@ static void
|
||||||
process_option (const char *option)
|
process_option (const char *option)
|
||||||
{
|
{
|
||||||
if (strcmp (option, "-linker-output-known") == 0)
|
if (strcmp (option, "-linker-output-known") == 0)
|
||||||
linker_output_known = 1;
|
linker_output_known = true;
|
||||||
if (strcmp (option, "-debug") == 0)
|
else if (strcmp (option, "-linker-output-auto-notlo-rel") == 0)
|
||||||
|
linker_output_auto_nolto_rel = true;
|
||||||
|
else if (strcmp (option, "-debug") == 0)
|
||||||
debug = true;
|
debug = true;
|
||||||
else if ((strcmp (option, "-v") == 0)
|
else if ((strcmp (option, "-v") == 0)
|
||||||
|| (strcmp (option, "--verbose") == 0))
|
|| (strcmp (option, "--verbose") == 0))
|
||||||
|
@ -1390,7 +1398,7 @@ onload (struct ld_plugin_tv *tv)
|
||||||
break;
|
break;
|
||||||
case LDPT_LINKER_OUTPUT:
|
case LDPT_LINKER_OUTPUT:
|
||||||
linker_output = (enum ld_plugin_output_file_type) p->tv_u.tv_val;
|
linker_output = (enum ld_plugin_output_file_type) p->tv_u.tv_val;
|
||||||
linker_output_set = 1;
|
linker_output_set = true;
|
||||||
break;
|
break;
|
||||||
case LDPT_OUTPUT_NAME:
|
case LDPT_OUTPUT_NAME:
|
||||||
/* We only use this to make user-friendly temp file names. */
|
/* We only use this to make user-friendly temp file names. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue