On Mon, 30 Jan 2017, 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.
Yes, it indeed does. Note that GCC8+ both TU decls and NAMESPACE_DECLs should no longer be neccessary and eventually vanish completely... (in lto1, that is). Can we code-gen the init order stuff early before LTO write-out? > 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? The patch works for me. Richard.