This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v3][PR lto/79061] Fix LTO plus ASAN fails with "AddressSanitizer: initialization-order-fiasco".
- From: Maxim Ostapenko <m dot ostapenko at samsung dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>
- Date: Thu, 02 Feb 2017 18:02:07 +0300
- Subject: Re: [PATCH v3][PR lto/79061] Fix LTO plus ASAN fails with "AddressSanitizer: initialization-order-fiasco".
- Authentication-results: sourceware.org; auth=none
- Cms-type: 201P
- References: <CGME20170118075439eucas1p1f216c219e19fc0e5f19832a382b15af7@eucas1p1.samsung.com> <587F1F3A.6050208@samsung.com> <alpine.LSU.2.20.1701181400140.14052@zhemvz.fhfr.qr> <587F9508.7030102@samsung.com> <alpine.LSU.2.20.1701231002030.12993@r111.fhfr.qr> <58872826.1050301@samsung.com> <20170124102420.GB1867@tucnak> <588F5730.9080202@samsung.com> <20170130151837.GF13290@tucnak>
Hi,
PR lto/79061 actually affects gcc-{5, 6}-branch too
Is it OK to apply following patch on branches?
-Maxim
gcc/ChangeLog:
2017-02-02 Maxim Ostapenko <m.ostapenko@samsung.com>
PR lto/79061
* asan.c (asan_add_global): Force has_dynamic_init to zero in LTO mode.
diff --git a/gcc/asan.c b/gcc/asan.c
index 398a508..0f55dc0 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2275,7 +2275,11 @@ asan_add_global (tree decl, tree type, vec<constructor_elt, va_gc> *v)
CONSTRUCTOR_APPEND_ELT (vinner, NULL_TREE,
fold_convert (const_ptr_type_node, module_name_cst));
varpool_node *vnode = varpool_node::get (decl);
- int has_dynamic_init = vnode ? vnode->dynamically_initialized : 0;
+ int has_dynamic_init = 0;
+ /* FIXME: Enable initialization order fiasco detection in LTO mode once
+ proper fix for PR 79061 will be applied. */
+ if (!in_lto_p)
+ has_dynamic_init = vnode ? vnode->dynamically_initialized : 0;
CONSTRUCTOR_APPEND_ELT (vinner, NULL_TREE,
build_int_cst (uptr, has_dynamic_init));
tree locptr = NULL_TREE;