head	1.16;
access;
symbols
	netbsd-11-0-RC5:1.16
	netbsd-11-0-RC4:1.16
	netbsd-11-0-RC3:1.16
	netbsd-11-0-RC2:1.16
	netbsd-11-0-RC1:1.16
	perseant-exfatfs-base-20250801:1.16
	netbsd-11:1.16.0.76
	netbsd-11-base:1.16
	netbsd-10-1-RELEASE:1.16
	perseant-exfatfs-base-20240630:1.16
	perseant-exfatfs:1.16.0.74
	perseant-exfatfs-base:1.16
	netbsd-8-3-RELEASE:1.16
	netbsd-9-4-RELEASE:1.16
	netbsd-10-0-RELEASE:1.16
	netbsd-10-0-RC6:1.16
	netbsd-10-0-RC5:1.16
	netbsd-10-0-RC4:1.16
	netbsd-10-0-RC3:1.16
	netbsd-10-0-RC2:1.16
	netbsd-10-0-RC1:1.16
	netbsd-10:1.16.0.72
	netbsd-10-base:1.16
	netbsd-9-3-RELEASE:1.16
	cjep_sun2x-base1:1.16
	cjep_sun2x:1.16.0.70
	cjep_sun2x-base:1.16
	cjep_staticlib_x-base1:1.16
	netbsd-9-2-RELEASE:1.16
	cjep_staticlib_x:1.16.0.68
	cjep_staticlib_x-base:1.16
	netbsd-9-1-RELEASE:1.16
	phil-wifi-20200421:1.16
	phil-wifi-20200411:1.16
	is-mlppp:1.16.0.66
	is-mlppp-base:1.16
	phil-wifi-20200406:1.16
	netbsd-8-2-RELEASE:1.16
	netbsd-9-0-RELEASE:1.16
	netbsd-9-0-RC2:1.16
	netbsd-9-0-RC1:1.16
	phil-wifi-20191119:1.16
	netbsd-9:1.16.0.64
	netbsd-9-base:1.16
	phil-wifi-20190609:1.16
	netbsd-8-1-RELEASE:1.16
	netbsd-8-1-RC1:1.16
	pgoyette-compat-merge-20190127:1.16
	pgoyette-compat-20190127:1.16
	pgoyette-compat-20190118:1.16
	pgoyette-compat-1226:1.16
	pgoyette-compat-1126:1.16
	pgoyette-compat-1020:1.16
	pgoyette-compat-0930:1.16
	pgoyette-compat-0906:1.16
	netbsd-7-2-RELEASE:1.16
	pgoyette-compat-0728:1.16
	netbsd-8-0-RELEASE:1.16
	phil-wifi:1.16.0.62
	phil-wifi-base:1.16
	pgoyette-compat-0625:1.16
	netbsd-8-0-RC2:1.16
	pgoyette-compat-0521:1.16
	pgoyette-compat-0502:1.16
	pgoyette-compat-0422:1.16
	netbsd-8-0-RC1:1.16
	pgoyette-compat-0415:1.16
	pgoyette-compat-0407:1.16
	pgoyette-compat-0330:1.16
	pgoyette-compat-0322:1.16
	pgoyette-compat-0315:1.16
	netbsd-7-1-2-RELEASE:1.16
	pgoyette-compat:1.16.0.60
	pgoyette-compat-base:1.16
	netbsd-7-1-1-RELEASE:1.16
	matt-nb8-mediatek:1.16.0.58
	matt-nb8-mediatek-base:1.16
	perseant-stdc-iso10646:1.16.0.56
	perseant-stdc-iso10646-base:1.16
	netbsd-8:1.16.0.54
	netbsd-8-base:1.16
	prg-localcount2-base3:1.16
	prg-localcount2-base2:1.16
	prg-localcount2-base1:1.16
	prg-localcount2:1.16.0.52
	prg-localcount2-base:1.16
	pgoyette-localcount-20170426:1.16
	bouyer-socketcan-base1:1.16
	pgoyette-localcount-20170320:1.16
	netbsd-7-1:1.16.0.50
	netbsd-7-1-RELEASE:1.16
	netbsd-7-1-RC2:1.16
	netbsd-7-nhusb-base-20170116:1.16
	bouyer-socketcan:1.16.0.48
	bouyer-socketcan-base:1.16
	pgoyette-localcount-20170107:1.16
	netbsd-7-1-RC1:1.16
	pgoyette-localcount-20161104:1.16
	netbsd-7-0-2-RELEASE:1.16
	localcount-20160914:1.16
	netbsd-7-nhusb:1.16.0.46
	netbsd-7-nhusb-base:1.16
	pgoyette-localcount-20160806:1.16
	pgoyette-localcount-20160726:1.16
	pgoyette-localcount:1.16.0.44
	pgoyette-localcount-base:1.16
	netbsd-7-0-1-RELEASE:1.16
	netbsd-7-0:1.16.0.42
	netbsd-7-0-RELEASE:1.16
	netbsd-7-0-RC3:1.16
	netbsd-7-0-RC2:1.16
	netbsd-7-0-RC1:1.16
	netbsd-5-2-3-RELEASE:1.16
	netbsd-5-1-5-RELEASE:1.16
	netbsd-6-0-6-RELEASE:1.16
	netbsd-6-1-5-RELEASE:1.16
	netbsd-7:1.16.0.40
	netbsd-7-base:1.16
	yamt-pagecache-base9:1.16
	yamt-pagecache-tag8:1.16
	netbsd-6-1-4-RELEASE:1.16
	netbsd-6-0-5-RELEASE:1.16
	tls-earlyentropy:1.16.0.38
	tls-earlyentropy-base:1.16
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.16
	riastradh-drm2-base3:1.16
	netbsd-6-1-3-RELEASE:1.16
	netbsd-6-0-4-RELEASE:1.16
	netbsd-5-2-2-RELEASE:1.16
	netbsd-5-1-4-RELEASE:1.16
	netbsd-6-1-2-RELEASE:1.16
	netbsd-6-0-3-RELEASE:1.16
	netbsd-5-2-1-RELEASE:1.16
	netbsd-5-1-3-RELEASE:1.16
	netbsd-6-1-1-RELEASE:1.16
	riastradh-drm2-base2:1.16
	riastradh-drm2-base1:1.16
	riastradh-drm2:1.16.0.32
	riastradh-drm2-base:1.16
	netbsd-6-1:1.16.0.36
	netbsd-6-0-2-RELEASE:1.16
	netbsd-6-1-RELEASE:1.16
	netbsd-6-1-RC4:1.16
	netbsd-6-1-RC3:1.16
	agc-symver:1.16.0.34
	agc-symver-base:1.16
	netbsd-6-1-RC2:1.16
	netbsd-6-1-RC1:1.16
	yamt-pagecache-base8:1.16
	netbsd-5-2:1.16.0.30
	netbsd-6-0-1-RELEASE:1.16
	yamt-pagecache-base7:1.16
	netbsd-5-2-RELEASE:1.16
	netbsd-5-2-RC1:1.16
	matt-nb6-plus-nbase:1.16
	yamt-pagecache-base6:1.16
	netbsd-6-0:1.16.0.28
	netbsd-6-0-RELEASE:1.16
	netbsd-6-0-RC2:1.16
	tls-maxphys:1.16.0.26
	tls-maxphys-base:1.16
	matt-nb6-plus:1.16.0.24
	matt-nb6-plus-base:1.16
	netbsd-6-0-RC1:1.16
	yamt-pagecache-base5:1.16
	yamt-pagecache-base4:1.16
	netbsd-6:1.16.0.22
	netbsd-6-base:1.16
	netbsd-5-1-2-RELEASE:1.16
	netbsd-5-1-1-RELEASE:1.16
	yamt-pagecache-base3:1.16
	yamt-pagecache-base2:1.16
	yamt-pagecache:1.16.0.4
	yamt-pagecache-base:1.16
	cherry-xenmp:1.16.0.20
	cherry-xenmp-base:1.16
	bouyer-quota2-nbase:1.16
	bouyer-quota2:1.16.0.18
	bouyer-quota2-base:1.16
	matt-mips64-premerge-20101231:1.16
	matt-nb5-mips64-premerge-20101231:1.16
	matt-nb5-pq3:1.16.0.16
	matt-nb5-pq3-base:1.16
	netbsd-5-1:1.16.0.14
	netbsd-5-1-RELEASE:1.16
	netbsd-5-1-RC4:1.16
	matt-nb5-mips64-k15:1.16
	netbsd-5-1-RC3:1.16
	netbsd-5-1-RC2:1.16
	netbsd-5-1-RC1:1.16
	netbsd-5-0-2-RELEASE:1.16
	matt-nb5-mips64-premerge-20091211:1.16
	matt-premerge-20091211:1.16
	matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.16
	matt-nb4-mips64-k7-u2a-k9b:1.16
	matt-nb5-mips64-u1-k1-k5:1.16
	matt-nb5-mips64:1.16.0.12
	netbsd-5-0-1-RELEASE:1.16
	jym-xensuspend-nbase:1.16
	netbsd-5-0:1.16.0.10
	netbsd-5-0-RELEASE:1.16
	netbsd-5-0-RC4:1.16
	netbsd-5-0-RC3:1.16
	netbsd-5-0-RC2:1.16
	jym-xensuspend:1.16.0.8
	jym-xensuspend-base:1.16
	netbsd-5-0-RC1:1.16
	netbsd-5:1.16.0.6
	netbsd-5-base:1.16
	matt-mips64-base2:1.16
	matt-mips64:1.15.0.32
	netbsd-4-0-1-RELEASE:1.15
	wrstuden-revivesa-base-3:1.16
	wrstuden-revivesa-base-2:1.16
	wrstuden-fixsa-newbase:1.15
	wrstuden-revivesa-base-1:1.16
	yamt-pf42-base4:1.16
	yamt-pf42-base3:1.16
	hpcarm-cleanup-nbase:1.16
	yamt-pf42-baseX:1.15
	yamt-pf42-base2:1.16
	wrstuden-revivesa:1.16.0.2
	wrstuden-revivesa-base:1.16
	yamt-pf42:1.15.0.30
	yamt-pf42-base:1.15
	keiichi-mipv6:1.15.0.28
	keiichi-mipv6-base:1.15
	matt-armv6-nbase:1.15
	matt-armv6-prevmlocking:1.15
	wrstuden-fixsa-base-1:1.15
	netbsd-4-0:1.15.0.26
	netbsd-4-0-RELEASE:1.15
	cube-autoconf:1.15.0.24
	cube-autoconf-base:1.15
	netbsd-4-0-RC5:1.15
	netbsd-4-0-RC4:1.15
	netbsd-4-0-RC3:1.15
	netbsd-4-0-RC2:1.15
	netbsd-4-0-RC1:1.15
	matt-armv6:1.15.0.22
	matt-armv6-base:1.15
	matt-mips64-base:1.15
	hpcarm-cleanup:1.15.0.20
	hpcarm-cleanup-base:1.15
	netbsd-3-1-1-RELEASE:1.15
	netbsd-3-0-3-RELEASE:1.15
	wrstuden-fixsa:1.15.0.18
	wrstuden-fixsa-base:1.15
	abandoned-netbsd-4-base:1.15
	abandoned-netbsd-4:1.15.0.12
	netbsd-3-1:1.15.0.14
	netbsd-3-1-RELEASE:1.15
	netbsd-3-0-2-RELEASE:1.15
	netbsd-3-1-RC4:1.15
	netbsd-3-1-RC3:1.15
	netbsd-3-1-RC2:1.15
	netbsd-3-1-RC1:1.15
	netbsd-4:1.15.0.16
	netbsd-4-base:1.15
	netbsd-3-0-1-RELEASE:1.15
	netbsd-3-0:1.15.0.10
	netbsd-3-0-RELEASE:1.15
	netbsd-3-0-RC6:1.15
	netbsd-3-0-RC5:1.15
	netbsd-3-0-RC4:1.15
	netbsd-3-0-RC3:1.15
	netbsd-3-0-RC2:1.15
	netbsd-3-0-RC1:1.15
	netbsd-2-0-3-RELEASE:1.15
	netbsd-2-1:1.15.0.8
	netbsd-2-1-RELEASE:1.15
	netbsd-2-1-RC6:1.15
	netbsd-2-1-RC5:1.15
	netbsd-2-1-RC4:1.15
	netbsd-2-1-RC3:1.15
	netbsd-2-1-RC2:1.15
	netbsd-2-1-RC1:1.15
	netbsd-2-0-2-RELEASE:1.15
	netbsd-3:1.15.0.6
	netbsd-3-base:1.15
	netbsd-2-0-1-RELEASE:1.15
	netbsd-2:1.15.0.4
	netbsd-2-base:1.15
	netbsd-2-0-RELEASE:1.15
	netbsd-2-0-RC5:1.15
	netbsd-2-0-RC4:1.15
	netbsd-2-0-RC3:1.15
	netbsd-2-0-RC2:1.15
	netbsd-2-0-RC1:1.15
	netbsd-2-0:1.15.0.2
	netbsd-2-0-base:1.15
	netbsd-1-6-PATCH002-RELEASE:1.4
	netbsd-1-6-PATCH002:1.4
	netbsd-1-6-PATCH002-RC4:1.4
	netbsd-1-6-PATCH002-RC3:1.4
	netbsd-1-6-PATCH002-RC2:1.4
	netbsd-1-6-PATCH002-RC1:1.4
	netbsd-1-6-PATCH001:1.4
	netbsd-1-6-PATCH001-RELEASE:1.4
	netbsd-1-6-PATCH001-RC3:1.4
	netbsd-1-6-PATCH001-RC2:1.4
	netbsd-1-6-PATCH001-RC1:1.4
	fvdl_fs64_base:1.13
	netbsd-1-6-RELEASE:1.4
	netbsd-1-6-RC3:1.4
	netbsd-1-6-RC2:1.4
	netbsd-1-6-RC1:1.4
	netbsd-1-6:1.4.0.12
	netbsd-1-6-base:1.4
	netbsd-1-5-PATCH003:1.4
	netbsd-1-5-PATCH002:1.4
	netbsd-1-5-PATCH001:1.4
	netbsd-1-5-RELEASE:1.4
	netbsd-1-5-BETA2:1.4
	netbsd-1-5-BETA:1.4
	netbsd-1-4-PATCH003:1.4
	netbsd-1-5-ALPHA2:1.4
	netbsd-1-5:1.4.0.10
	netbsd-1-5-base:1.4
	minoura-xpg4dl:1.4.0.8
	minoura-xpg4dl-base:1.4
	netbsd-1-4-PATCH002:1.4
	wrstuden-devbsize-19991221:1.4
	wrstuden-devbsize:1.4.0.6
	wrstuden-devbsize-base:1.4
	comdex-fall-1999:1.4.0.4
	comdex-fall-1999-base:1.4
	netbsd-1-4-PATCH001:1.4
	netbsd-1-4-RELEASE:1.4
	netbsd-1-4:1.4.0.2
	netbsd-1-4-base:1.4;
locks; strict;
comment	@# @;


1.16
date	2008.04.28.20.23.03;	author martin;	state Exp;
branches;
next	1.15;

1.15
date	2003.03.01.15.14.59;	author mycroft;	state Exp;
branches
	1.15.30.1;
next	1.14;

1.14
date	2003.02.27.05.39.42;	author mycroft;	state Exp;
branches;
next	1.13;

1.13
date	2002.09.26.02.05.41;	author mycroft;	state Exp;
branches;
next	1.12;

1.12
date	2002.09.26.01.59.16;	author mycroft;	state Exp;
branches;
next	1.11;

1.11
date	2002.09.26.01.54.52;	author mycroft;	state Exp;
branches;
next	1.10;

1.10
date	2002.09.25.14.38.51;	author mycroft;	state Exp;
branches;
next	1.9;

1.9
date	2002.09.12.17.18.41;	author mycroft;	state Exp;
branches;
next	1.8;

1.8
date	2002.09.12.17.07.26;	author mycroft;	state Exp;
branches;
next	1.7;

1.7
date	2002.09.11.19.11.05;	author mycroft;	state Exp;
branches;
next	1.6;

1.6
date	2002.09.09.19.01.52;	author mycroft;	state Exp;
branches;
next	1.5;

1.5
date	2002.09.09.18.10.21;	author mycroft;	state Exp;
branches;
next	1.4;

1.4
date	99.03.01.14.40.32;	author christos;	state Exp;
branches
	1.4.12.1;
next	1.3;

1.3
date	99.03.01.03.39.39;	author kim;	state Exp;
branches;
next	1.2;

1.2
date	99.02.26.22.01.31;	author pk;	state Exp;
branches;
next	1.1;

1.1
date	99.02.24.18.25.41;	author christos;	state Exp;
branches;
next	;

1.15.30.1
date	2008.05.18.12.30.44;	author yamt;	state Exp;
branches;
next	;

1.4.12.1
date	2004.05.28.08.31.22;	author tron;	state Exp;
branches;
next	;


desc
@@


1.16
log
@Remove clause 3 and 4 from TNF licenses
@
text
@/*	$NetBSD: rtld_start.S,v 1.15 2003/03/01 15:14:59 mycroft Exp $	*/

/*-
 * Copyright (c) 1999, 2002, 2003 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Christos Zoulas, Paul Kranenburg, and by Charles M. Hannum.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include <machine/asm.h>

	.section	".text"
	.align	4
	.global	_rtld_start
	.type	_rtld_start,@@function
_rtld_start:
	mov	0, %fp			/* Erect a fence post for ourselves */
	mov	%g1, %l1		/* save ps_strings */
	sub	%sp, 32+8, %sp		/* room for return args and save area */

	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7
	call	0f
	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
	call	_DYNAMIC+8
0:	add	%l7, %o7, %l7		/* real &_GLOBAL_OFFSET_TABLE_ */
	ld	[%o7+8], %o0		/* load stub call instruction */
	ld	[%l7], %l0		/* base-relative &_DYNAMIC */
	sll	%o0, 2, %o0		/* extract PC offset */

	add	%o0, %o7, %o0		/* real &_DYNAMIC */
	sub	%o0, %l0, %l0		/* relocbase */
	call	_rtld_relocate_nonplt_self
	 mov	%l0, %o1		/* relocbase */

	mov	%l0, %o1		/* relocbase */
	call	_rtld
	 add	%sp, 96, %o0		/* &argc - 8 */

	ld	[%sp + 96], %g3	/* arg: cleanup */
	ld	[%sp + 96 + 4], %g2	/* arg: obj */
	add	%sp, 32+8, %sp		/* restore stack pointer */

	jmp	%o0
	 mov	%l1, %g1		/* restore ps_strings */


	.section	".text"
	.align	4
	.global	_rtld_bind_start
	.type	_rtld_bind_start,@@function
_rtld_bind_start:	# (obj, reloff)
	ld	[%o7 + 8], %o0		/* obj id is in second PLT slot */
	srl	%g1, 10, %o1		/* offset is in high 22 bits */
	call	_rtld_bind		/* Call _rtld_bind(obj, offset) */
	 sub	%o1, 12*4, %o1		/* first 4 `pltrel' entries missing! */

	jmp	%o0			/* return value == function address */
	 restore

@


1.15
log
@Update copyright.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.14 2003/02/27 05:39:42 mycroft Exp $	*/
a17 7
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *        This product includes software developed by the NetBSD
 *        Foundation, Inc. and its contributors.
 * 4. Neither the name of The NetBSD Foundation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
@


1.15.30.1
log
@sync with head.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.15 2003/03/01 15:14:59 mycroft Exp $	*/
d18 7
@


1.14
log
@Adjust for the fact that the GOT is all 0s in new binutils -- do the trick of
disassembling a call to _DYNAMIC to determine its real address, and using the
first entry of the GOT as its base-relative address.

It's evil, but it works.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.13 2002/09/26 02:05:41 mycroft Exp $	*/
d4 1
a4 1
 * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@


1.13
log
@Make the stack frame 96 bytes, like GCC does.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.12 2002/09/26 01:59:16 mycroft Exp $	*/
a42 6
.LLGETPC0:
	retl
	 add	%o7,%l7,%l7

	.section	".text"
	.align	4
d51 1
a51 1
	call	.LLGETPC0
d53 5
a57 2
	ld	[%l7+_DYNAMIC], %o0
	ld	[%l7+_GLOBAL_OFFSET_TABLE_], %l0
d59 2
a60 1
	sub	%l7, %l0, %o1		/* relocbase */
d62 1
a62 1
	 add	%o0, %o1, %o0		/* &_DYNAMIC */
d64 1
a64 1
	sub	%l7, %l0, %o1		/* relocbase */
@


1.12
log
@Tweak the save instruction in the PLT stub rather than adding an instruction
to the binder entry stub...
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.11 2002/09/26 01:54:52 mycroft Exp $	*/
d54 1
a54 1
	sub	%sp, 24+8, %sp		/* room for return args and save area */
d68 1
a68 1
	 add	%sp, 24+64, %o0		/* &argc - 8 */
d70 3
a72 3
	ld	[%sp + 24+64], %g3	/* arg: cleanup */
	ld	[%sp + 24+64 + 4], %g2	/* arg: obj */
	add	%sp, 24+8, %sp		/* restore stack pointer */
@


1.11
log
@Allocate space for the argument space area in both _rtld_start() and
_rtld_bind_start().  Not needed normally, but if we compile ld.elf_so with
-g, it blows up without this.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.10 2002/09/25 14:38:51 mycroft Exp $	*/
a82 1
	sub	%sp, 24, %sp
@


1.10
log
@There is no need to save and restore a second register window in the binder
stub.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.9 2002/09/12 17:18:41 mycroft Exp $	*/
d54 1
a54 1
	sub	%sp, 8, %sp		/* Make room for return args */
d68 1
a68 1
	 add	%sp, 64, %o0		/* &argc - 8 */
d70 3
a72 3
	ld	[%sp + 64], %g3		/* arg: cleanup */
	ld	[%sp + 64 + 4], %g2	/* arg: obj */
	add	%sp, 8, %sp		/* restore stack pointer */
d83 1
@


1.9
log
@Update comments.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.8 2002/09/12 17:07:26 mycroft Exp $	*/
d83 1
a83 2
	save	%sp, -96, %sp		/* setup standard stack frame */
	ld	[%i7 + 8], %o0		/* obj id is in second PLT slot */
d88 2
a89 4
	mov	%o0, %g1		/* return value == function address */
	restore				/* get rid of our context */
	 jmp	%g1			/* and the jmpslot context, then go. */
	restore
@


1.8
log
@Pass the calculated relocation offset down to _rtld().
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.7 2002/09/11 19:11:05 mycroft Exp $	*/
d4 1
a4 1
 * Copyright (c) 1999 The NetBSD Foundation, Inc.
d8 1
a8 1
 * by Christos Zoulas and Paul Kranenburg.
@


1.7
log
@Do the _rtld_relocate_nonplt_self() thing for SPARC.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.6 2002/09/09 19:01:52 mycroft Exp $	*/
d60 3
a62 2
	ld	[%l7+_GLOBAL_OFFSET_TABLE_], %o1
	sub	%l7, %o1, %o1
d64 1
a64 1
	 add	%o0, %o1, %o0
d66 1
@


1.6
log
@Indent branch delay instructions.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.5 2002/09/09 18:10:21 mycroft Exp $	*/
d59 1
a59 1
	ld	[%l7+_GOT_END_], %o0
d61 3
a63 11
	mov	%l7, %o2
	sub	%o2, %o1, %o1
	add	%o0, %o1, %o0
	ld	[%o2], %o3
1:
	add	%o3, %o1, %o3
	st	%o3, [%o2]
	add	%o2, 4, %o2
	cmp	%o2, %o0
	blu,a	1b
	 ld	[%o2], %o3
@


1.5
log
@Nuke RTLD_RELOCATE_SELF for SPARC.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.4 1999/03/01 14:40:32 christos Exp $	*/
d45 1
a45 1
	add	%o7,%l7,%l7
d58 1
a58 1
	add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
@


1.4
log
@- Use c style comments.
- & -> and
- align 4 in both functions for consistency.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.3 1999/03/01 03:39:39 kim Exp $	*/
d43 6
d55 17
@


1.4.12.1
log
@Apply patch (request by skrll in ticket #1702):
Bring "ld.elf_so" (mostly) in sync with NetBSD-current:
- MI and MD (e.g. under NetBSD-alpha) performance improvements
- RTLD_SELF, RTLD_NEXT, RTLD_DEFAULT support
- much better structured code
- closes PR bin/25464
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.15 2003/03/01 15:14:59 mycroft Exp $	*/
d4 1
a4 1
 * Copyright (c) 1999, 2002, 2003 The NetBSD Foundation, Inc.
d8 1
a8 1
 * by Christos Zoulas, Paul Kranenburg, and by Charles M. Hannum.
d48 1
a48 1
	sub	%sp, 32+8, %sp		/* room for return args and save area */
a49 15
	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7
	call	0f
	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
	call	_DYNAMIC+8
0:	add	%l7, %o7, %l7		/* real &_GLOBAL_OFFSET_TABLE_ */
	ld	[%o7+8], %o0		/* load stub call instruction */
	ld	[%l7], %l0		/* base-relative &_DYNAMIC */
	sll	%o0, 2, %o0		/* extract PC offset */

	add	%o0, %o7, %o0		/* real &_DYNAMIC */
	sub	%o0, %l0, %l0		/* relocbase */
	call	_rtld_relocate_nonplt_self
	 mov	%l0, %o1		/* relocbase */

	mov	%l0, %o1		/* relocbase */
d51 1
a51 1
	 add	%sp, 96, %o0		/* &argc - 8 */
d53 3
a55 3
	ld	[%sp + 96], %g3	/* arg: cleanup */
	ld	[%sp + 96 + 4], %g2	/* arg: obj */
	add	%sp, 32+8, %sp		/* restore stack pointer */
d66 2
a67 1
	ld	[%o7 + 8], %o0		/* obj id is in second PLT slot */
d72 4
a75 2
	jmp	%o0			/* return value == function address */
	 restore
@


1.3
log
@Make mkdep succeed (use matching quotes in comment).
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.2 1999/02/26 22:01:31 pk Exp $	*/
d8 1
a8 1
 * by Christos Zoulas & Paul Kranenburg.
d42 1
a42 1
	.align	8
d46 3
a48 3
	mov	0, %fp			! Erect a fence post for ourselves
	mov	%g1, %l1		! save ps_strings
	sub	%sp, 8, %sp		! Make room for return args
d51 1
a51 1
	 add	%sp, 64, %o0		! &argc - 8
d53 3
a55 3
	ld	[%sp + 64], %g3		! arg: cleanup
	ld	[%sp + 64 + 4], %g2	! arg: obj
	add	%sp, 8, %sp		! restore stack pointer
d58 1
a58 1
	 mov	%l1, %g1		! restore ps_strings
d66 10
a75 10
	save	%sp, -96, %sp		! setup standard stack frame
	ld	[%i7 + 8], %o0		! obj id is in second PLT slot
	srl	%g1, 10, %o1		! offset is in high 22 bits
	call	_rtld_bind		! Call _rtld_bind(obj, offset)
	 sub	%o1, 12*4, %o1		! first 4 'pltrel' entries are missing!

	mov	%o0, %g1		! return value == function address
	restore				! get rid of our context
	 jmp	%g1			! and the jmpslot context, then go.
	restore				!
@


1.2
log
@Implement rtld_bind() stub.
Fix startup code.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.1 1999/02/24 18:25:41 christos Exp $	*/
d70 1
a70 1
	 sub	%o1, 12*4, %o1		! first 4 `pltrel' entries are missing!
@


1.1
log
@Work in progress (does not work yet).
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.1 1999/01/10 18:21:24 christos Exp $	*/
d4 1
a4 1
 * Copyright (c) 1998 The NetBSD Foundation, Inc.
d8 1
a8 1
 * by Christos Zoulas.
d41 1
a41 1
	.text
d43 1
a43 1
	.globl	_rtld_start
d46 3
a48 14
	mov	0, %fp
	add	%sp, 56, %o0		! &argc - 8
	andn	%sp, 7,	%sp		! align
	sub	%sp, 24, %sp		! expand to standard stack frame size
	st	%g1, [%sp]		! Store ps_strings

	call	_rtld,0			! _rtld(sp)
	 nop

	ld	[%sp - 4], %g3
	ld	[%sp - 8], %g2
	ld	[%sp - 12], %g1
	ld	[%o0], %o0
	call	%o0
d50 12
d63 1
a63 1
	.globl	_rtld_bind_start
d66 11
a76 3
	call	exit,0			! exit(random)
	 nop
	ret
@
