Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?

Thanks,
Richard.

        PR sanitizer/111736
        * asan.cc (asan_protect_global): Do not protect globals
        in non-generic address-space.
---
 gcc/asan.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/asan.cc b/gcc/asan.cc
index 2424cf69ef1..8d0ffb497cc 100644
--- a/gcc/asan.cc
+++ b/gcc/asan.cc
@@ -2291,6 +2291,8 @@ asan_protect_global (tree decl, bool 
ignore_decl_rtl_set_p)
       || (DECL_SECTION_NAME (decl) != NULL
          && !symtab_node::get (decl)->implicit_section
          && !section_sanitized_p (DECL_SECTION_NAME (decl)))
+      /* Don't protect variables in non-generic address-space.  */
+      || !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (TREE_TYPE (decl)))
       || DECL_SIZE (decl) == 0
       || ASAN_RED_ZONE_SIZE * BITS_PER_UNIT > MAX_OFILE_ALIGNMENT
       || TREE_CODE (DECL_SIZE_UNIT (decl)) != INTEGER_CST
-- 
2.35.3

Reply via email to