This is the mail archive of the mailing list for the binutils 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: Ensuring symbol resolution order at runtime

>> As long as the runtime loader sees the same libraries that the linker
>> saw, yes, there is a guarantee. However, if is replaced with a
>> library that does not define "foo", then the dynamic loader will bind
>> "foo" to the definition in without any complaint.
> So, to be as specific as I can, not only will the runtime loader see those
> same libraries, but it will look at them in the *same order* that the static
> linker did (presumably because the static linker will list them in the
> linked executable in the order it processed them, and the dynamic linker
> follows that order).

Yes. The ABI requires that:

"When the dynamic linker creates the memory segments for an object
file, the dependencies (recorded in DT_NEEDED entries of the dynamic
structure) tell what shared objects are needed to supply the program's
services. By repeatedly connecting referenced shared objects and their
dependencies, the dynamic linker builds a complete process image. When
resolving symbolic references, the dynamic linker examines the symbol
tables with a breadth-first search. That is, it first looks at the
symbol table of the executable program itself, then at the symbol
tables of the DT_NEEDED entries (in order), and then at the second
level DT_NEEDED entries, and so on. Shared object files must be
readable by the process; other permissions are not required." [from


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