Re: [PATCH][PR lto/79042] Propagate node->dynamically_initialized bit for varpool node to LTRANS stage.
On Wed, Jan 11, 2017 at 12:21 PM, Maxim Ostapenkowrote: > On 11/01/17 14:17, Richard Biener wrote: >> >> On Wed, Jan 11, 2017 at 10:00 AM, Maxim Ostapenko >> wrote: >>> >>> Hi, >>> >>> as mentioned in PR, LTO doesn't propagate node->dynamically_initialized >>> bit >>> for varpool nodes that leads to ASan fails to detect initialization order >>> fiasco even for trivial example (e.g. from here: >>> >>> https://github.com/google/sanitizers/wiki/AddressSanitizerExampleInitOrderFiasco). >>> This trivial patch fixes the issue. Regtested on >>> x86_64-unknown-linux-gnu, >>> OK for mainline? >> >> Ok. This is also needed on branches, correct? > > > Yes, branches also need this. gcc-5-branch and gcc-6-branch, right? Yes. Please bump lto-streamer.h:LTO_minor_version on the branches with such change as the LTO binary format will be incompatible. (not that we always remember to do that...) Thanks, Richard. > Thanks, > -Maxim > >> >> Richard. >> >>> -Maxim >> >> >
Re: [PATCH][PR lto/79042] Propagate node->dynamically_initialized bit for varpool node to LTRANS stage.
On 11/01/17 14:17, Richard Biener wrote: On Wed, Jan 11, 2017 at 10:00 AM, Maxim Ostapenkowrote: Hi, as mentioned in PR, LTO doesn't propagate node->dynamically_initialized bit for varpool nodes that leads to ASan fails to detect initialization order fiasco even for trivial example (e.g. from here: https://github.com/google/sanitizers/wiki/AddressSanitizerExampleInitOrderFiasco). This trivial patch fixes the issue. Regtested on x86_64-unknown-linux-gnu, OK for mainline? Ok. This is also needed on branches, correct? Yes, branches also need this. gcc-5-branch and gcc-6-branch, right? Thanks, -Maxim Richard. -Maxim
Re: [PATCH][PR lto/79042] Propagate node->dynamically_initialized bit for varpool node to LTRANS stage.
On Wed, Jan 11, 2017 at 10:00 AM, Maxim Ostapenkowrote: > Hi, > > as mentioned in PR, LTO doesn't propagate node->dynamically_initialized bit > for varpool nodes that leads to ASan fails to detect initialization order > fiasco even for trivial example (e.g. from here: > https://github.com/google/sanitizers/wiki/AddressSanitizerExampleInitOrderFiasco). > This trivial patch fixes the issue. Regtested on x86_64-unknown-linux-gnu, > OK for mainline? Ok. This is also needed on branches, correct? Richard. > -Maxim
[PATCH][PR lto/79042] Propagate node->dynamically_initialized bit for varpool node to LTRANS stage.
Hi, as mentioned in PR, LTO doesn't propagate node->dynamically_initialized bit for varpool nodes that leads to ASan fails to detect initialization order fiasco even for trivial example (e.g. from here: https://github.com/google/sanitizers/wiki/AddressSanitizerExampleInitOrderFiasco). This trivial patch fixes the issue. Regtested on x86_64-unknown-linux-gnu, OK for mainline? -Maxim gcc/ChangeLog: 2017-01-11 Maxim OstapenkoPR lto/79042 * lto-cgraph.c (lto_output_varpool_node): Pack dynamically_initialized bit. (input_varpool_node): Unpack dynamically_initialized bit. diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index c0321f7..77605f7 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -626,6 +626,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node, } bp_pack_value (, node->tls_model, 3); bp_pack_value (, node->used_by_single_function, 1); + bp_pack_value (, node->dynamically_initialized, 1); bp_pack_value (, node->need_bounds_init, 1); streamer_write_bitpack (); @@ -1400,6 +1401,7 @@ input_varpool_node (struct lto_file_decl_data *file_data, node->alias_target = get_alias_symbol (node->decl); node->tls_model = (enum tls_model)bp_unpack_value (, 3); node->used_by_single_function = (enum tls_model)bp_unpack_value (, 1); + node->dynamically_initialized = bp_unpack_value (, 1); node->need_bounds_init = bp_unpack_value (, 1); group = read_identifier (ib); if (group)