aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorMaxim Ostapenko <m.ostapenko@samsung.com>2017-01-18 16:06:31 +0000
committerMaxim Ostapenko <chefmax@gcc.gnu.org>2017-01-18 18:06:31 +0200
commit5807fb918d557400fd50431c1399cf1f131670ba (patch)
tree7bc51d9df5797da527b28b3f4b7ecb580608b1e4 /gcc/tree.c
parent0c6299bbfd50c064913bbc0e1d810848f66d8994 (diff)
downloadgcc-5807fb918d557400fd50431c1399cf1f131670ba.zip
gcc-5807fb918d557400fd50431c1399cf1f131670ba.tar.gz
gcc-5807fb918d557400fd50431c1399cf1f131670ba.tar.bz2
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 in lto mode. * tree.c (build_translation_unit_decl): Add source location for newly built TRANSLATION_UNIT_DECL. gcc/lto/ * lto.c (lto_read_decls): accept location cache for TRANSLATION_UNIT_DECL. gcc/testsuite/ * gcc.dg/cpp/mi1.c: Adjust testcase. * gcc.dg/pch/cpp-3.c: Likewise. From-SVN: r244581
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index cffa36d..59fe8d4 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4758,7 +4758,10 @@ vec<tree, va_gc> *all_translation_units;
tree
build_translation_unit_decl (tree name)
{
- tree tu = build_decl (UNKNOWN_LOCATION, TRANSLATION_UNIT_DECL,
+ linemap_add (line_table, LC_ENTER, false, main_input_filename, 1);
+ location_t loc = linemap_line_start (line_table, 1, 0);
+ linemap_add (line_table, LC_LEAVE, false, NULL, 0);
+ tree tu = build_decl (loc, TRANSLATION_UNIT_DECL,
name, NULL_TREE);
TRANSLATION_UNIT_LANGUAGE (tu) = lang_hooks.name;
vec_safe_push (all_translation_units, tu);