summaryrefslogtreecommitdiffstats
path: root/lib/csu/i386
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-10-01 00:54:48 +0000
committerpeter <peter@FreeBSD.org>1996-10-01 00:54:48 +0000
commit2242c2dae2ba247e88307c305386125defd8ece8 (patch)
tree713b959d600b6e85b8437d2e1f4043f6f5526815 /lib/csu/i386
parentaf1c48e2152c0d2371d8e9b67ce8473caf116fda (diff)
downloadFreeBSD-src-2242c2dae2ba247e88307c305386125defd8ece8.zip
FreeBSD-src-2242c2dae2ba247e88307c305386125defd8ece8.tar.gz
Support crt0 <-> ld.so interface version 4. This should be both backwards
and forwards compatable with version 3. This is needed to enable storing a run-time library path in the dynamic linking headers. The crt startup tries version 4 first, and falls back to version 3, so an executable that is linked on -current will work with the ld.so on 2.1.x and less. Reviewed by: nate, jdp Obtained from: NetBSD
Diffstat (limited to 'lib/csu/i386')
-rw-r--r--lib/csu/i386/crt0.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/csu/i386/crt0.c b/lib/csu/i386/crt0.c
index d36cc29..7559437 100644
--- a/lib/csu/i386/crt0.c
+++ b/lib/csu/i386/crt0.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: crt0.c,v 1.21 1995/11/02 12:42:42 ache Exp $
+ * $Id: crt0.c,v 1.23 1996/01/30 05:55:20 nate Exp $
*/
#include <sys/param.h>
@@ -249,13 +249,20 @@ __do_dynamic_link ()
crt.crt_ep = environ;
crt.crt_bp = (caddr_t)_callmain;
crt.crt_prog = __progname;
+ crt.crt_ldentry = NULL;
entry = (int (*)())(crt.crt_ba + sizeof hdr);
- ret = (*entry)(CRT_VERSION_BSD_3, &crt);
+ ret = (*entry)(CRT_VERSION_BSD_4, &crt);
+ ld_entry = crt.crt_ldentry;
+ if (ret == -1 && ld_entry == NULL) {
+ /* if version 4 not recognised, try version 3 */
+ ret = (*entry)(CRT_VERSION_BSD_3, &crt);
+ ld_entry = _DYNAMIC.d_entry;
+ }
if (ret == -1) {
_PUTMSG("ld.so failed");
- if(_DYNAMIC.d_entry != NULL) {
- char *msg = (_DYNAMIC.d_entry->dlerror)();
+ if (ld_entry != NULL) {
+ char *msg = (ld_entry->dlerror)();
if(msg != NULL) {
char *endp;
_PUTMSG(": ");
@@ -267,7 +274,6 @@ __do_dynamic_link ()
_FATAL("\n");
}
- ld_entry = _DYNAMIC.d_entry;
if (ret >= LDSO_VERSION_HAS_DLEXIT)
atexit(ld_entry->dlexit);
OpenPOWER on IntegriCloud