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

Attachment: signature.asc
Description: PGP signature

Reply via email to