[systemd-devel] Can apps ship their own copy of libudev?

Thiago Macieira thiago.macieira at intel.com
Fri Oct 25 12:13:19 CEST 2013


On sexta-feira, 25 de outubro de 2013 11:57:25, Jan Engelhardt wrote:
> >The drawbacks of this solution are:
> > - no link-time dependency for packaging tools to detect and create the
> >
> >   package dependency without intervention
> 
> Given most .run-type software bypasses package tools already,
> there is not much more to lose.

Good point. I was thinking of the case of distributions that potentially 
forgot to enable direct linking and instead fell back to the dynamic loading 
code. We probably have to make our code smart enough so that this won't 
happen.

> > - sub-optimal resolution and calling (hand-written code worse than linker-
> >
> >   generated PLT)
> 
> How worse is it, actually?
> 
> 5               void *h = dlopen("libc.so.6", RTLD_LAZY);
> (gdb) n
> 6               int (*scmp)(const char *, const char *) = dlsym(h,
> "strcmp"); (gdb)
> 7               return scmp(argv[0], "x.c") == 0;
> (gdb) p scmp
> $1 = (int (*)(const char *, const char *)) 0x7ffff7953c40 <__strcmp_ssse3>
> 
> 
> So even though I used the, as you call it, "suboptimal" dlopen mechanism,
> I do get the SSSE3-optimized variant. Can't be _that_ bad.

That's not what I meant. Yes, both variants will call the same function. 

I meant that the code you wrote above (dlopen-dlsym-call, plus handling dlopen 
failing) is worse than the equivalent solution generated by the linker and 
dynamic linker for the case when we are allowed to link directly.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20131025/6d47f426/attachment.pgp>


More information about the systemd-devel mailing list