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

llvm-svn: 316487
This commit is contained in:
Dimitry Andric 2017-10-24 19:45:59 +00:00
parent 51f604ce66
commit 95af9e654f
1 changed files with 1 additions and 1 deletions

View File

@ -105,7 +105,7 @@ static int FindFirstDSOCallback(struct dl_phdr_info *info, size_t size,
if (internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0) if (internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0)
return 0; return 0;
#if SANITIZER_NETBSD #if SANITIZER_FREEBSD || SANITIZER_NETBSD
// Ignore first entry (the main program) // Ignore first entry (the main program)
char **p = (char **)data; char **p = (char **)data;
if (!(*p)) { if (!(*p)) {