[PATCH] elfclassify tool

Dmitry V. Levin ldv@altlinux.org
Fri Jul 19 13:43:00 GMT 2019


On Fri, Jul 19, 2019 at 02:47:09PM +0200, Mark Wielaard wrote:
[...]
> +static bool
> +is_shared (void)
> +{
> +  if (!is_loadable ())
> +    return false;
> +
> +  /* The ELF type is very clear: this is an executable.  */
> +  if (elf_type == ET_EXEC)
> +    return false;
> +
> +  /* If the object is marked as PIE, it is definitely an executable,
> +     and not a loadlable shared object.  */
> +  if (has_pie_flag)
> +    return false;
> +
> +  /* Treat a DT_SONAME tag as a strong indicator that this is a shared
> +     object.  */
> +  if (has_soname)
> +    return true;

I'm not sure DT_SONAME is a reliable indicator.

I've seen many cases of DT_SONAME being erroneously applied to 
non-libraries, e.g. lib.so was used as soname in openjdk executables.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/elfutils-devel/attachments/20190719/7db6fe1e/attachment.sig>


More information about the Elfutils-devel mailing list