Subject: Re: static vs. dynamic runtime linking, again (was: PAM and su -K)
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: John Nemeth <jnemeth@victoria.tc.ca>
List: tech-userlevel
Date: 01/25/2005 06:11:39
On May 11,  8:06am, der Mouse wrote:
} 
} > this is the standard way dynamic linking works for ELF objects.  It
} > struck me as a little bit strange too -- 10 years ago, when it was
} > genuinely new or unusual.  Now that I've managed to accept it as the
} > norm, I can see that it has decided advantages
} 
} The flexibility it provides has decided advantages.
} 
} The way it is implemented in 2.0 is rather broken, even if only in the
} way it defaults things.

     Uhm, ELF was introduced in 1.5 for most platforms.

} > ELF doesn't work quite like a.out did in terms of loading
} > dependencies.  In ELF, there are both a per-executable "run path"
} > which will be searched to find each named dependency, and,
} > per-dependency, a name.  The run path is explicit, and is part of the
} > built executable; it is not implicit in some magical way, pulled from
} > a configuration file in /etc, or so forth.
} 
} Then unless given an option that includes "suppress the warning"
} semantics, the linker needs to warn when it is linking a program in
} such a way that it will not work to run it immediately, preferably
} including what needs to be done to change that.
} 
} > -R is how you set the run path in an executable.
} 
} The warning I mention above should say this, then.  Really, the simple
} way of specifying the library path needs to set both the link-time path
} and the run-time path, to avoid this "buh-but I just linked it and got
} no errors, why can't it now find the library it found a moment ago?"
} effect.

     I don't think a warning is required.  This is something that is
well known.  As noted above, it has been around for at least 10 years.
However, it still seems to be a big problem.  I see the same issue on
Solaris.  But, times change (i.e. you can no longer assume that seek()
takes a 32 bit int, we now have ANSI C, etc.).

     BTW, if you really want to talk about brokenness consider GCC
silently linking in extra libraries (i.e. libgcc_s.so) and not issuing
the appropriate rpath option.  Now that's broken!

}-- End of excerpt from der Mouse