[compiler-rt] r351771 - [safestack] Fix NetBSD build

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 21 16:40:00 PST 2019


Author: vitalybuka
Date: Mon Jan 21 16:39:59 2019
New Revision: 351771

URL: http://llvm.org/viewvc/llvm-project?rev=351771&view=rev
Log:
[safestack] Fix NetBSD build

Modified:
    compiler-rt/trunk/lib/interception/interception_linux.cc

Modified: compiler-rt/trunk/lib/interception/interception_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/interception_linux.cc?rev=351771&r1=351770&r2=351771&view=diff
==============================================================================
--- compiler-rt/trunk/lib/interception/interception_linux.cc (original)
+++ compiler-rt/trunk/lib/interception/interception_linux.cc Mon Jan 21 16:39:59 2019
@@ -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) {




More information about the llvm-commits mailing list