AddressSanitizer: fix for SPARC with GCC

Summary:
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.

Patch by Eric Botcazou.

Reviewers: #sanitizers, vitalybuka

Reviewed By: #sanitizers, vitalybuka

Subscribers: vitalybuka, ro, jyknight, kubamracek, fedor.sergeev, jdoerfert, llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D58433

llvm-svn: 355979
This commit is contained in:
Vitaly Buka 2019-03-12 21:02:15 +00:00
parent d3ed66dfb3
commit 5ae9f865b2
1 changed files with 4 additions and 0 deletions

View File

@ -115,7 +115,11 @@ int GetGlobalsForAddress(uptr addr, Global *globals, u32 *reg_sites,
if (flags()->report_globals >= 2)
ReportGlobal(g, "Search");
if (IsAddressNearGlobal(addr, g)) {
#if defined(__GNUC__) && defined(__sparc__)
internal_memcpy(&globals[res], &g, sizeof(g));
#else
globals[res] = g;
#endif
if (reg_sites)
reg_sites[res] = FindRegistrationSite(&g);
res++;