This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ld, -rpath documentation seems incomplete
"John Gabriele" <jmg3000@gmail.com> writes:
> When I look up the docs on -R, they say that when you pass a directory
> name, it acts like the -rpath option. Cool. So I check the docs on
> -rpath. It says that the directory name given is used by the runtime
> dynamic linker to find libs. (The docs also go on to talk about it
> being "used when locating shared objects which are needed by shared
> objects explicitly included in the link". I don't think that 2nd part
> applies here though.)
>
> The problem is, the ld docs don't seem to describe what actually
> happens.
What actually happens is that the path gets stored into the binary as
a DT_RPATH entry in the PT_DYNAMIC segment. You can see it using
objdump -p or readelf -d.
> I'd heard elsewhere that what the -rpath option is *really*
> doing is telling ld to allow unresolved symbols in the .so file --
> such that they can be looked up at run-time. This is the crucial point
> I believe, and if accurate, should go into the ld docs.
That is incorrect. The -R option does not change how the linker
behaves with regard to unresolved symbols.
Ian