mirror of git://gcc.gnu.org/git/gcc.git
* lto-plugin.c: (non_claimed_files): New static var.
(linker_ouput_known): New static var. (all_symbols_read_handler): When user specifies linker output do not imply it; output warning when nonlto-rel mode is forced. (claim_file_header): Record number of nonclaimed files. (process_option): Remember if linker output is known git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260960 138bc75d-0d04-0410-961f-82ee72b054a4
This commit is contained in:
parent
128e8e03b5
commit
3617d5c1dd
|
|
@ -1,3 +1,12 @@
|
||||||
|
2018-05-30 Jan Hubicka <jh@suse.cz>
|
||||||
|
|
||||||
|
* lto-plugin.c: (non_claimed_files): New static var.
|
||||||
|
(linker_ouput_known): New static var.
|
||||||
|
(all_symbols_read_handler): When user specifies linker output do not
|
||||||
|
imply it; output warning when nonlto-rel mode is forced.
|
||||||
|
(claim_file_header): Record number of nonclaimed files.
|
||||||
|
(process_option): Remember if linker output is known
|
||||||
|
|
||||||
2018-04-18 David Malcolm <dmalcolm@redhat.com>
|
2018-04-18 David Malcolm <dmalcolm@redhat.com>
|
||||||
|
|
||||||
PR jit/85384
|
PR jit/85384
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,13 @@ along with this program; see the file COPYING3. If not see
|
||||||
More information at http://gcc.gnu.org/wiki/whopr/driver.
|
More information at http://gcc.gnu.org/wiki/whopr/driver.
|
||||||
|
|
||||||
This plugin should be passed the lto-wrapper options and will forward them.
|
This plugin should be passed the lto-wrapper options and will forward them.
|
||||||
It also has 2 options of its own:
|
It also has options at his own:
|
||||||
-debug: Print the command line used to run lto-wrapper.
|
-debug: Print the command line used to run lto-wrapper.
|
||||||
-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
|
||||||
|
-sym-style={none,win32,underscore|uscore}
|
||||||
|
-pass-through */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
@ -159,6 +162,7 @@ static ld_plugin_add_symbols add_symbols;
|
||||||
|
|
||||||
static struct plugin_file_info *claimed_files = NULL;
|
static struct plugin_file_info *claimed_files = NULL;
|
||||||
static unsigned int num_claimed_files = 0;
|
static unsigned int num_claimed_files = 0;
|
||||||
|
static unsigned int non_claimed_files = 0;
|
||||||
|
|
||||||
/* List of files with offloading. */
|
/* List of files with offloading. */
|
||||||
static struct plugin_offload_file *offload_files;
|
static struct plugin_offload_file *offload_files;
|
||||||
|
|
@ -185,6 +189,7 @@ 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 int linker_output_set;
|
||||||
|
static int linker_output_known;
|
||||||
|
|
||||||
/* 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
|
||||||
MAJOR * 100 + MINOR. */
|
MAJOR * 100 + MINOR. */
|
||||||
|
|
@ -637,7 +642,8 @@ static enum ld_plugin_status
|
||||||
all_symbols_read_handler (void)
|
all_symbols_read_handler (void)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned num_lto_args = num_claimed_files + lto_wrapper_num_args + 3;
|
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;
|
||||||
|
|
@ -661,26 +667,37 @@ all_symbols_read_handler (void)
|
||||||
for (i = 0; i < lto_wrapper_num_args; i++)
|
for (i = 0; i < lto_wrapper_num_args; i++)
|
||||||
*lto_arg_ptr++ = lto_wrapper_argv[i];
|
*lto_arg_ptr++ = lto_wrapper_argv[i];
|
||||||
|
|
||||||
assert (linker_output_set);
|
if (!linker_output_known)
|
||||||
switch (linker_output)
|
|
||||||
{
|
{
|
||||||
case LDPO_REL:
|
assert (linker_output_set);
|
||||||
linker_output_str = "-flinker-output=rel";
|
switch (linker_output)
|
||||||
break;
|
{
|
||||||
case LDPO_DYN:
|
case LDPO_REL:
|
||||||
linker_output_str = "-flinker-output=dyn";
|
if (non_claimed_files)
|
||||||
break;
|
{
|
||||||
case LDPO_PIE:
|
message (LDPL_WARNING, "incremental linking of LTO and non-LTO "
|
||||||
linker_output_str = "-flinker-output=pie";
|
"objects; using -flinker-output=nolto-rel which will "
|
||||||
break;
|
"bypass whole program optimization");
|
||||||
case LDPO_EXEC:
|
linker_output_str = "-flinker-output=nolto-rel";
|
||||||
linker_output_str = "-flinker-output=exec";
|
}
|
||||||
break;
|
else
|
||||||
default:
|
linker_output_str = "-flinker-output=rel";
|
||||||
message (LDPL_FATAL, "unsupported linker output %i", linker_output);
|
break;
|
||||||
break;
|
case LDPO_DYN:
|
||||||
|
linker_output_str = "-flinker-output=dyn";
|
||||||
|
break;
|
||||||
|
case LDPO_PIE:
|
||||||
|
linker_output_str = "-flinker-output=pie";
|
||||||
|
break;
|
||||||
|
case LDPO_EXEC:
|
||||||
|
linker_output_str = "-flinker-output=exec";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
message (LDPL_FATAL, "unsupported linker output %i", linker_output);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*lto_arg_ptr++ = xstrdup (linker_output_str);
|
||||||
}
|
}
|
||||||
*lto_arg_ptr++ = xstrdup (linker_output_str);
|
|
||||||
|
|
||||||
if (num_offload_files > 0)
|
if (num_offload_files > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1108,6 +1125,7 @@ claim_file_handler (const struct ld_plugin_input_file *file, int *claimed)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
non_claimed_files++;
|
||||||
free (lto_file.name);
|
free (lto_file.name);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
@ -1122,6 +1140,8 @@ claim_file_handler (const struct ld_plugin_input_file *file, int *claimed)
|
||||||
static void
|
static void
|
||||||
process_option (const char *option)
|
process_option (const char *option)
|
||||||
{
|
{
|
||||||
|
if (strcmp (option, "-linker-output-known") == 0)
|
||||||
|
linker_output_known = 1;
|
||||||
if (strcmp (option, "-debug") == 0)
|
if (strcmp (option, "-debug") == 0)
|
||||||
debug = 1;
|
debug = 1;
|
||||||
else if (strcmp (option, "-nop") == 0)
|
else if (strcmp (option, "-nop") == 0)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue