[PATCH] D15049: [asan] Skip all non-shared objects in FindFirstDSOCallback.
Dimitry Andric via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 7 11:44:17 PST 2015
dim added a comment.
In http://reviews.llvm.org/D15049#304100, @eugenis wrote:
> Of course, every DSO has LOAD segments.
> Sorry, it looks like I don't understand the purpose of this change. What exactly is this not-shared-object that you are trying to avoid? The main executable? I think on linux it can be distinguished by empty dlpi_name.
Yes, that is precisely the point of the change. On FreeBSD, the main executable **does** have its `dlpi_name` filled with the path to the executable.
> One idea: it looks like we can rely on the fact that the main executable is the first one in dl_iterate_phdr (is it? what about LD_PRELOAD?).
It seems to be so, both on Linux and FreeBSD, but I'm unsure whether it is a hard rule.
> If so, you can walk its dynamic section and look for DT_NEEDED records.
I'd think that was the job of the dynamic linker. :-)
http://reviews.llvm.org/D15049
More information about the llvm-commits
mailing list