From 97989743a72613691418d5d748d7663f49560210 Mon Sep 17 00:00:00 2001 From: christos Date: Wed, 1 Jun 2016 00:53:35 +0000 Subject: [PATCH] Ignore the first dlpi entry which is ourselves on NetBSD instead of having a NULL name as on linux. --- external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc b/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc index 0c1cc4e4b305..2b67b28b2e30 100644 --- a/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc +++ b/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc @@ -95,6 +95,15 @@ static int FindFirstDSOCallback(struct dl_phdr_info *info, size_t size, if (internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0) return 0; +#if SANITIZER_NETBSD + // Ignore first entry (the main program) + char **p = (char **)data; + if (*p == NULL) { + *p = (char *)-1; + return 0; + } +#endif + *(const char **)data = info->dlpi_name; return 1; }