public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/PR108834-asan-tu-name)] asan: adjust module name for global variables Date: Fri, 17 Feb 2023 14:16:18 +0000 (GMT) [thread overview] Message-ID: <20230217141618.12C503854811@sourceware.org> (raw) https://gcc.gnu.org/g:497459bd12a5327fa9ebcc13027850ac10bd13cb commit 497459bd12a5327fa9ebcc13027850ac10bd13cb Author: Martin Liska <mliska@suse.cz> Date: Fri Feb 17 15:11:02 2023 +0100 asan: adjust module name for global variables As mentioned in the PR, when we use LTO, we wrongly use ltrans output file name as a module name of a global variable. That leads to a non-reproducible output. After the suggested change, we emit context name of normal global variables. And for artificial variables (like .Lubsan_data3), we use aux_base_name (e.g. "./a.ltrans0.ltrans"). PR asan/108834 gcc/ChangeLog: * asan.cc (asan_add_global): Use proper TU name for normal global variables (and aux_base_name for the artificial one). Diff: --- gcc/asan.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/asan.cc b/gcc/asan.cc index f56d084bc7a..245abb14388 100644 --- a/gcc/asan.cc +++ b/gcc/asan.cc @@ -3287,7 +3287,12 @@ 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_tree tu = get_ultimate_context ((const_tree)decl); + if (tu != NULL_TREE) + pp_string (&module_name_pp, IDENTIFIER_POINTER (DECL_NAME (tu))); + else + pp_string (&module_name_pp, aux_base_name); + module_name_cst = asan_pp_string (&module_name_pp); if (asan_needs_local_alias (decl))
next reply other threads:[~2023-02-17 14:16 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-17 14:16 Martin Liska [this message] 2023-02-24 8:57 Martin Liska
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230217141618.12C503854811@sourceware.org \ --to=marxin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).