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 /gcc/lto/lto-lang.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 'gcc/lto/lto-lang.c')
-rw-r--r-- | gcc/lto/lto-lang.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c index 53dd8f6..90bacde 100644 --- a/gcc/lto/lto-lang.c +++ b/gcc/lto/lto-lang.c @@ -819,6 +819,35 @@ lto_post_options (const char **pfilename ATTRIBUTE_UNUSED) if (flag_wpa) flag_generate_lto = 1; + /* Initialize the codegen flags according to the output type. */ + switch (flag_lto_linker_output) + { + case LTO_LINKER_OUTPUT_REL: /* .o: incremental link producing LTO IL */ + flag_whole_program = 0; + flag_incremental_link = 1; + break; + + case LTO_LINKER_OUTPUT_DYN: /* .so: PID library */ + /* On some targets, like i386 it makes sense to build PIC library wihout + -fpic for performance reasons. So no need to adjust flags. */ + break; + + case LTO_LINKER_OUTPUT_PIE: /* PIE binary */ + /* If -fPIC or -fPIE was used at compile time, be sure that + flag_pie is 2. */ + flag_pie = MAX (flag_pie, flag_pic); + flag_pic = 0; + break; + + case LTO_LINKER_OUTPUT_EXEC: /* Normal executable */ + flag_pic = 0; + flag_pie = 0; + break; + + case LTO_LINKER_OUTPUT_UNKNOWN: + break; + } + /* Excess precision other than "fast" requires front-end support. */ flag_excess_precision_cmdline = EXCESS_PRECISION_FAST; |