diff options
author | Jan Hubicka <jh@suse.cz> | 2015-11-26 00:05:07 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2015-11-25 23:05:07 +0000 |
commit | 1ff9ed6fb282ab8a6f1b2aa1655b577cdc2f0e41 (patch) | |
tree | 695e737710e979a37c3a6c8eac41f4786c766cad /lto-plugin/lto-plugin.c | |
parent | c9d82fb023ac0bfb69a3835491ddb47268bef09b (diff) | |
download | gcc-1ff9ed6fb282ab8a6f1b2aa1655b577cdc2f0e41.zip gcc-1ff9ed6fb282ab8a6f1b2aa1655b577cdc2f0e41.tar.gz gcc-1ff9ed6fb282ab8a6f1b2aa1655b577cdc2f0e41.tar.bz2 |
re PR lto/67548 (LTO drops weak binding with "ld -r")
PR lto/67548
* lto-plugin.c (linker_output, linker_output_set): New statics.
(all_symbols_read_handler): Add -flinker-output option.
(onload): Record linker_output info.
* ipa-visibility.c (cgraph_externally_visible_p,
varpool_node::externally_visible_p): When doing incremental linking,
hidden symbols may be still used later.
(update_visibility_by_resolution_info): Do not drop weak during
incremental link.
(function_and_variable_visibility): Fix formating.
* flag-types.h (lto_linker_output): Declare.
* common.opt 9flag_incremental_link): New flag.
* lto-lang.c (lto_post_options): Process flag_lto_linker_output.
* lang.opt (lto_linker_output): New enum.
(flinker_output): New flag.
From-SVN: r230915
Diffstat (limited to 'lto-plugin/lto-plugin.c')
-rw-r--r-- | lto-plugin/lto-plugin.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c index 8d957402..0a6a767 100644 --- a/lto-plugin/lto-plugin.c +++ b/lto-plugin/lto-plugin.c @@ -167,6 +167,8 @@ static unsigned int num_pass_through_items; static char debug; static char nop; static char *resolution_file = NULL; +static enum ld_plugin_output_file_type linker_output; +static int linker_output_set; /* The version of gold being used, or -1 if not gold. The number is MAJOR * 100 + MINOR. */ @@ -624,8 +626,9 @@ all_symbols_read_handler (void) { unsigned i; unsigned num_lto_args - = num_claimed_files + num_offload_files + lto_wrapper_num_args + 1; + = num_claimed_files + num_offload_files + lto_wrapper_num_args + 2; char **lto_argv; + const char *linker_output_str; const char **lto_arg_ptr; if (num_claimed_files + num_offload_files == 0) return LDPS_OK; @@ -648,6 +651,26 @@ all_symbols_read_handler (void) for (i = 0; i < lto_wrapper_num_args; i++) *lto_arg_ptr++ = lto_wrapper_argv[i]; + assert (linker_output_set); + switch (linker_output) + { + case LDPO_REL: + linker_output_str = "-flinker-output=rel"; + 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); for (i = 0; i < num_claimed_files; i++) { struct plugin_file_info *info = &claimed_files[i]; @@ -1100,6 +1123,10 @@ onload (struct ld_plugin_tv *tv) case LDPT_GOLD_VERSION: gold_version = p->tv_u.tv_val; break; + case LDPT_LINKER_OUTPUT: + linker_output = (enum ld_plugin_output_file_type) p->tv_u.tv_val; + linker_output_set = 1; + break; default: break; } |