re PR lto/79061 ([LTO][ASAN] LTO plus ASAN fails with "AddressSanitizer: initialization-order-fiasco")
PR lto/79061 gcc/ * asan.c (get_translation_unit_decl): New function. (asan_add_global): Extract modules file name from globals TRANSLATION_UNIT_DECL name. gcc/fortran/ * f95-lang.c (gfc_create_decls): Include stringpool.h. Pass main_input_filename to build_translation_unit_decl. gcc/ada/ * gcc-interface/utils.c (get_global_context): Pass main_input_filename to build_translation_unit_decl. gcc/c/ * c-decl.c (pop_scope): Pass main_input_filename to build_translation_unit_decl. gcc/cp/ * decl.c (cxx_init_decl_processing): Pass main_input_filename to build_translation_unit_decl. From-SVN: r244890
This commit is contained in:
parent
98e2075846
commit
e5e391d630
10 changed files with 64 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
|||
2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
|
||||
|
||||
PR lto/79061
|
||||
* asan.c (get_translation_unit_decl): New function.
|
||||
(asan_add_global): Extract modules file name from globals
|
||||
TRANSLATION_UNIT_DECL name.
|
||||
|
||||
2017-01-24 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
PR target/77439
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
|
||||
|
||||
PR lto/79061
|
||||
* gcc-interface/utils.c (get_global_context): Pass main_input_filename
|
||||
to build_translation_unit_decl.
|
||||
|
||||
2017-01-23 Javier Miranda <miranda@adacore.com>
|
||||
|
||||
* sem_util.adb (New_Copy_Tree): Code cleanup:
|
||||
|
|
|
@ -666,7 +666,8 @@ get_global_context (void)
|
|||
{
|
||||
if (!global_context)
|
||||
{
|
||||
global_context = build_translation_unit_decl (NULL_TREE);
|
||||
global_context
|
||||
= build_translation_unit_decl (get_identifier (main_input_filename));
|
||||
debug_hooks->register_main_translation_unit (global_context);
|
||||
}
|
||||
|
||||
|
|
25
gcc/asan.c
25
gcc/asan.c
|
@ -2373,6 +2373,22 @@ asan_needs_odr_indicator_p (tree decl)
|
|||
&& TREE_PUBLIC (decl));
|
||||
}
|
||||
|
||||
/* For given DECL return its corresponding TRANSLATION_UNIT_DECL. */
|
||||
|
||||
static const_tree
|
||||
get_translation_unit_decl (tree decl)
|
||||
{
|
||||
const_tree context = decl;
|
||||
while (context && TREE_CODE (context) != TRANSLATION_UNIT_DECL)
|
||||
{
|
||||
if (TREE_CODE (context) == BLOCK)
|
||||
context = BLOCK_SUPERCONTEXT (context);
|
||||
else
|
||||
context = get_containing_scope (context);
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
/* Append description of a single global DECL into vector V.
|
||||
TYPE is __asan_global struct type as returned by asan_global_struct. */
|
||||
|
||||
|
@ -2392,7 +2408,14 @@ asan_add_global (tree decl, tree type, vec<constructor_elt, va_gc> *v)
|
|||
pp_string (&asan_pp, "<unknown>");
|
||||
str_cst = asan_pp_string (&asan_pp);
|
||||
|
||||
pp_string (&module_name_pp, main_input_filename);
|
||||
const char *filename = main_input_filename;
|
||||
if (in_lto_p)
|
||||
{
|
||||
const_tree translation_unit_decl = get_translation_unit_decl (decl);
|
||||
if (translation_unit_decl && DECL_NAME (translation_unit_decl) != NULL)
|
||||
filename = IDENTIFIER_POINTER (DECL_NAME (translation_unit_decl));
|
||||
}
|
||||
pp_string (&module_name_pp, filename);
|
||||
module_name_cst = asan_pp_string (&module_name_pp);
|
||||
|
||||
if (asan_needs_local_alias (decl))
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
|
||||
|
||||
PR lto/79061
|
||||
* c-decl.c (pop_scope): Pass main_input_filename to
|
||||
build_translation_unit_decl.
|
||||
|
||||
2017-01-24 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* c-parser.c: Include "read-rtl-function.h" and
|
||||
|
|
|
@ -1177,7 +1177,8 @@ pop_scope (void)
|
|||
context = current_function_decl;
|
||||
else if (scope == file_scope)
|
||||
{
|
||||
tree file_decl = build_translation_unit_decl (NULL_TREE);
|
||||
tree file_decl
|
||||
= build_translation_unit_decl (get_identifier (main_input_filename));
|
||||
context = file_decl;
|
||||
debug_hooks->register_main_translation_unit (file_decl);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
|
||||
|
||||
PR lto/79061
|
||||
* decl.c (cxx_init_decl_processing): Pass main_input_filename
|
||||
to build_translation_unit_decl.
|
||||
|
||||
2017-01-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/79205
|
||||
|
|
|
@ -4071,7 +4071,8 @@ cxx_init_decl_processing (void)
|
|||
gcc_assert (global_namespace == NULL_TREE);
|
||||
global_namespace = build_lang_decl (NAMESPACE_DECL, global_scope_name,
|
||||
void_type_node);
|
||||
DECL_CONTEXT (global_namespace) = build_translation_unit_decl (NULL_TREE);
|
||||
DECL_CONTEXT (global_namespace)
|
||||
= build_translation_unit_decl (get_identifier (main_input_filename));
|
||||
debug_hooks->register_main_translation_unit
|
||||
(DECL_CONTEXT (global_namespace));
|
||||
TREE_PUBLIC (global_namespace) = 1;
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
|
||||
|
||||
PR lto/79061
|
||||
* f95-lang.c (gfc_create_decls): Include stringpool.h.
|
||||
Pass main_input_filename to build_translation_unit_decl.
|
||||
|
||||
2017-01-23 Thomas Koenig <tkoenig@netcologne.de>
|
||||
|
||||
* arith.c (arith_power): If simplifying integer power expression
|
||||
|
|
|
@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "tree.h"
|
||||
#include "gfortran.h"
|
||||
#include "trans.h"
|
||||
#include "stringpool.h"
|
||||
#include "diagnostic.h" /* For errorcount/warningcount */
|
||||
#include "langhooks.h"
|
||||
#include "langhooks-def.h"
|
||||
|
@ -190,7 +191,8 @@ gfc_create_decls (void)
|
|||
gfc_init_constants ();
|
||||
|
||||
/* Build our translation-unit decl. */
|
||||
current_translation_unit = build_translation_unit_decl (NULL_TREE);
|
||||
current_translation_unit
|
||||
= build_translation_unit_decl (get_identifier (main_input_filename));
|
||||
debug_hooks->register_main_translation_unit (current_translation_unit);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue