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 | |
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')
-rw-r--r-- | gcc/lto/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lto/lang.opt | 23 | ||||
-rw-r--r-- | gcc/lto/lto-lang.c | 29 |
3 files changed, 58 insertions, 0 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 4aae740..1ddacfa 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2015-11-25 Jan Hubicka <jh@suse.cz> + + * lto-lang.c (lto_post_options): Process flag_lto_linker_output. + * lang.opt (lto_linker_output): New enum. + (flinker_output): New flag. + 2015-11-24 Jan Hubicka <hubicka@ucw.cz> * lto-symtab.c: Include alias.h diff --git a/gcc/lto/lang.opt b/gcc/lto/lang.opt index f7aedc4..c4216b3 100644 --- a/gcc/lto/lang.opt +++ b/gcc/lto/lang.opt @@ -24,6 +24,29 @@ Language LTO +Enum +Name(lto_linker_output) Type(enum lto_linker_output) UnknownError(unknown linker output %qs) + +EnumValue +Enum(lto_linker_output) String(unknown) Value(LTO_LINKER_OUTPUT_UNKNOWN) + +EnumValue +Enum(lto_linker_output) String(rel) Value(LTO_LINKER_OUTPUT_REL) + +EnumValue +Enum(lto_linker_output) String(dyn) Value(LTO_LINKER_OUTPUT_DYN) + +EnumValue +Enum(lto_linker_output) String(pie) Value(LTO_LINKER_OUTPUT_PIE) + +EnumValue +Enum(lto_linker_output) String(exec) Value(LTO_LINKER_OUTPUT_EXEC) + +flinker-output= +LTO Report Driver Joined RejectNegative Enum(lto_linker_output) Var(flag_lto_linker_output) Init(LTO_LINKER_OUTPUT_UNKNOWN) +Set linker output type (used internally during LTO optimization) + + fltrans LTO Report Var(flag_ltrans) Run the link-time optimizer in local transformation (LTRANS) mode. 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; |