[compiler-rt] r316487 - On FreeBSD, skip the first entry in the dl_iterate_phdr list.

Dimitry Andric via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 12:45:59 PDT 2017


Author: dim
Date: Tue Oct 24 12:45:59 2017
New Revision: 316487

URL: http://llvm.org/viewvc/llvm-project?rev=316487&view=rev
Log:
On FreeBSD, skip the first entry in the dl_iterate_phdr list.

Summary:
Similar to NetBSD, in FreeBSD, the first returned entry when callbacks
are done via dl_iterate_phdr will return the main program.  Ignore that
entry when checking that the dynamic ASan lib is loaded first.

Reviewers: eugenis, krytarowski, emaste, joerg

Reviewed By: eugenis, krytarowski

Subscribers: kubamracek, llvm-commits

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

Modified:
    compiler-rt/trunk/lib/asan/asan_linux.cc

Modified: compiler-rt/trunk/lib/asan/asan_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_linux.cc?rev=316487&r1=316486&r2=316487&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_linux.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_linux.cc Tue Oct 24 12:45:59 2017
@@ -105,7 +105,7 @@ static int FindFirstDSOCallback(struct d
   if (internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0)
     return 0;
 
-#if SANITIZER_NETBSD
+#if SANITIZER_FREEBSD || SANITIZER_NETBSD
   // Ignore first entry (the main program)
   char **p = (char **)data;
   if (!(*p)) {




More information about the llvm-commits mailing list