This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: About hacking libc


On 24 Apr 2013, OndÅej BÃlka told this:

> On Tue, Apr 23, 2013 at 05:53:05PM -0400, Xinyang Ge wrote:
>> Thank you, Carlos.
>> 
>> I think the preload way is cleaner and doesn't require recompilation
>> of glibc. However, will there be any symbol conflict between my
>> library and glibc since both have the open() function? How do dynamic
>> linked library avoid symbol conflict? I am really newbie in this
>> field, could you recommend some reading materials to me if possible?
>>
> On conflict resolution symbol that is loaded first wins.

That's not true in general. The ELF rules are much more complex,
since they have to take into account \( .. \) (DT_GROUP), -Bsymbolic,
libraries loaded with dlmopen() and so on.

But, in general, if you avoid all of that, the rules for shared
libraries appear to be the same as for static libraries: i.e., symbols
appearing in libraries specified earlier on the link line take priority
over symbols appearing in libraries specified later.

-- 
NULL && (void)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]