lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Kurz <n...@verse.com>
Subject Re: [lucy-dev] OFFSET globals
Date Mon, 23 Apr 2012 19:49:34 GMT
On Mon, Apr 23, 2012 at 7:55 AM, Marvin Humphrey <marvin@rectangular.com> wrote:
> My understanding is that in the event that two ELF DSOs export the same
> symbol, the general rule is that the last library loaded wins[1]:

I'm pretty sure that at runtime it's the first definition found that
wins, which is why LD_PRELOAD can be used to override functions like
malloc().

>    http://www.akkadia.org/drepper/dsohowto.pdf

"Note that there is no problem if the scope contains more than one
definition of the same symbol. The symbol lookup algorithm simply
picks up the first definition it finds." p.6, 1.5.2

> [1] "How to Write Shared Libraries" by Ulrich Drepper, section 1.4.5.

Thought maybe you were referencing a different version of the paper,
then figured out that you meant "1.5.4" (transposition).

---

I've been planning to chime in on this, but haven't had time to do it
justice.  My quick thoughts are that:

1) This can and should be solved through DSO symbol versioning.
2) It's great to get things right so as to have a solid foundation, but
3) We got along just fine for years without actually implementing this, thus
4) We don't need to solve this right now, just future-proof ourselves.

I'm rusty and busy, though, and might not be of immediate help.  In
addition to Ulrich's paper, Ian's series here might be a good
refresher: http://www.airs.com/blog/page/4?s=%22linkers+part%22

I haven't found a good overview of the links, but versioning is covered in
Part 9: Symbol Versions http://www.airs.com/blog/archives/46
Part 13: Symbol Versions Redux http://www.airs.com/blog/archives/50

--nate

Mime
View raw message