[PATCH v3][PR lto/79061] Fix LTO plus ASAN fails with "AddressSanitizer: initialization-order-fiasco".

Jakub Jelinek jakub@redhat.com
Mon Jan 30 15:19:00 GMT 2017

On Mon, Jan 30, 2017 at 06:09:36PM +0300, Maxim Ostapenko wrote:
> Hi,
> as was figured out in PR, using DECL_NAME (TRANSLATION_UNIT_DECL) does not
> always give us a correct module name in LTO mode because e.g. DECL_CONTEXT
> of some variables can be NAMESPACE_DECL and LTO merges NAMESPACE_DECLs. The
> easiest fix is just to disable the initialization order checking altogether
> for LTO by forcing dynamically_initialized = 0 in LTO for now but we'll
> probably want to restore initialization order fiasco detection in the future
> (e.g. for GCC 8).
> This patch just disables initialization order fiasco detection for LTO for
> now. Tested and bootstrapped on x86_64-unknown-linux-gnu, OK to apply?
> Or do I need to cook a proper fix for GCC 7 (and branches) and come back
> then?
> -Maxim

> gcc/ChangeLog:
> 2017-01-30  Maxim Ostapenko  <m.ostapenko@samsung.com>

Please add
	PR lto/79061
> 	* asan.c (get_translation_unit_decl): Remove function.
> 	(asan_add_global): Force has_dynamic_init to zero in LTO mode.

Ok with that change.


More information about the Gcc-patches mailing list