[PATCH] D58433: AddressSanitizer: fix for SPARC with GCC

Eric Botcazou via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 20 03:02:34 PST 2019


ebotcazou created this revision.
ebotcazou added a reviewer: Sanitizers.
ebotcazou added a project: Sanitizers.
Herald added subscribers: llvm-commits, jdoerfert, fedor.sergeev, kubamracek, jyknight.
Herald added a project: LLVM.

This patch contains a fixlet for the AddressSanitizer on the SPARC with GCC, which would otherwise generate a problematic call to the intercepted memcpy routine.  It was tested with GCC on SPARC/Solaris and SPARC/Linux.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D58433

Files:
  compiler-rt/lib/asan/asan_globals.cc


Index: compiler-rt/lib/asan/asan_globals.cc
===================================================================
--- compiler-rt/lib/asan/asan_globals.cc
+++ compiler-rt/lib/asan/asan_globals.cc
@@ -115,7 +115,11 @@
     if (flags()->report_globals >= 2)
       ReportGlobal(g, "Search");
     if (IsAddressNearGlobal(addr, g)) {
+#if defined(__GNUC__) && defined(__sparc__)
+      internal_memcpy (&globals[res], &g, sizeof (Global));
+#else
       globals[res] = g;
+#endif
       if (reg_sites)
         reg_sites[res] = FindRegistrationSite(&g);
       res++;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58433.187539.patch
Type: text/x-patch
Size: 563 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190220/ebdce832/attachment.bin>


More information about the llvm-commits mailing list