[gcc(refs/vendors/ARM/heads/arm-perf-staging)] Darwin: Make sanitizer local vars linker-visible.

Tamar Christina tnfchris@gcc.gnu.org
Fri Jul 17 15:15:49 GMT 2020


https://gcc.gnu.org/g:25a9db6c6d02437fe025a14323675a5128b4ed42

commit 25a9db6c6d02437fe025a14323675a5128b4ed42
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sun May 24 12:18:19 2020 +0100

    Darwin: Make sanitizer local vars linker-visible.
    
    Another case where we need a linker-visible symbol in order
    to preserve the ld64 atom model.  If these symbols are emitted
    as 'local' the linker cannot see that they are separate from any
    global weak entry that precedes them.  This will cause the linker
    to complain that there is (apparently) direct access to such a
    weak global.
    
    This is a short-term fix for the problem - ideally we need a more
    generic handling for all the relevant cases.
    
            Backport 804254edb48f87d726a1bc9e95af04076c030e35
    
    gcc/ChangeLog:
    
            * config/darwin.h (ASM_GENERATE_INTERNAL_LABEL):
            Make ubsan_{data,type},ASAN linker-visible.

Diff:
---
 gcc/ChangeLog       | 8 ++++++++
 gcc/config/darwin.h | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d848d3f1cec..c047aaf9f11 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2020-05-24  Iain Sandoe  <iain@sandoe.co.uk>
+
+	Backported from master.
+	2020-05-22  Iain Sandoe  <iain@sandoe.co.uk>
+
+	* config/darwin.h (ASM_GENERATE_INTERNAL_LABEL):
+	Make ubsan_{data,type},ASAN linker-visible.
+
 2020-05-24  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR target/95258
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 27665b34a18..f528b1766bf 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -808,6 +808,12 @@ extern GTY(()) section * darwin_sections[NUM_DARWIN_SECTIONS];
   do {							\
     if (strcmp ("LC", PREFIX) == 0)			\
       sprintf (LABEL, "*%s%ld", "lC", (long)(NUM));	\
+    else if (strcmp ("Lubsan_data", PREFIX) == 0)	\
+      sprintf (LABEL, "*%s%ld", "lubsan_data", (long)(NUM));\
+    else if (strcmp ("Lubsan_type", PREFIX) == 0)	\
+      sprintf (LABEL, "*%s%ld", "lubsan_type", (long)(NUM));\
+    else if (strcmp ("LASAN", PREFIX) == 0)	\
+      sprintf (LABEL, "*%s%ld", "lASAN", (long)(NUM));\
     else						\
       sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM));	\
   } while (0)


More information about the Gcc-cvs mailing list