Module Name:    src
Committed By:   christos
Date:           Wed Oct 22 00:15:16 UTC 2014

Modified Files:
        src/external/gpl3/gcc/dist/libsanitizer/interception:
            interception_linux.cc

Log Message:
the interceptors don't know about __RENAME() so add a kludge.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
    src/external/gpl3/gcc/dist/libsanitizer/interception/interception_linux.cc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/interception/interception_linux.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/interception/interception_linux.cc:1.2 src/external/gpl3/gcc/dist/libsanitizer/interception/interception_linux.cc:1.3
--- src/external/gpl3/gcc/dist/libsanitizer/interception/interception_linux.cc:1.2	Wed Oct 15 14:44:50 2014
+++ src/external/gpl3/gcc/dist/libsanitizer/interception/interception_linux.cc	Tue Oct 21 20:15:16 2014
@@ -16,9 +16,24 @@
 #include <stddef.h>  // for NULL
 #include <dlfcn.h>   // for dlsym
 
+#ifdef __NetBSD__
+static int mystrcmp(const char *s1, const char *s2) {
+  while (*s1 == *s2++)
+    if (*s1++ == 0)
+      return (0);
+  return (*(const unsigned char *)s1 - *(const unsigned char *)--s2);
+}
+#endif
+
+
 namespace __interception {
 bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
     uptr real, uptr wrapper) {
+#ifdef __NetBSD__
+  // XXX: Until I come up with something better to deal with renames.
+  if (mystrcmp(func_name, "sigaction") == 0)
+    func_name = "__sigaction14";
+#endif
   *func_addr = (uptr)dlsym(RTLD_NEXT, func_name);
   return real == wrapper;
 }

Reply via email to