diff options
author | Vitaly Buka <vitalybuka@google.com> | 2019-01-22 00:39:59 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2019-01-22 00:39:59 +0000 |
commit | b793d25443d0322e32d690762d5885ec79496695 (patch) | |
tree | e6d3c43bfbeb7b1f997f2ab9528d279b78667ee4 /compiler-rt/lib/interception/interception_linux.cc | |
parent | c09219363c59277997af864718b1100f53d0a42f (diff) | |
download | bcm5719-llvm-b793d25443d0322e32d690762d5885ec79496695.tar.gz bcm5719-llvm-b793d25443d0322e32d690762d5885ec79496695.zip |
[safestack] Fix NetBSD build
llvm-svn: 351771
Diffstat (limited to 'compiler-rt/lib/interception/interception_linux.cc')
-rw-r--r-- | compiler-rt/lib/interception/interception_linux.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/compiler-rt/lib/interception/interception_linux.cc b/compiler-rt/lib/interception/interception_linux.cc index 3c7e6edc44a..9f2caa25ca4 100644 --- a/compiler-rt/lib/interception/interception_linux.cc +++ b/compiler-rt/lib/interception/interception_linux.cc @@ -18,16 +18,27 @@ #include <dlfcn.h> // for dlsym() and dlvsym() +namespace __interception { + #if SANITIZER_NETBSD -#include "sanitizer_common/sanitizer_libc.h" +static int StrCmp(const char *s1, const char *s2) { + while (true) { + if (*s1 != *s2) + return false; + if (*s1 == 0) + return true; + s1++; + s2++; + } +} #endif -namespace __interception { bool GetRealFunctionAddress(const char *func_name, uptr *func_addr, uptr real, uptr wrapper) { #if SANITIZER_NETBSD - // XXX: Find a better way to handle renames - if (internal_strcmp(func_name, "sigaction") == 0) func_name = "__sigaction14"; + // FIXME: Find a better way to handle renames + if (StrCmp(func_name, "sigaction")) + func_name = "__sigaction14"; #endif *func_addr = (uptr)dlsym(RTLD_NEXT, func_name); if (!*func_addr) { |