head	1.11;
access;
symbols
	netbsd-11-0-RC5:1.11
	netbsd-11-0-RC4:1.11
	netbsd-11-0-RC3:1.11
	netbsd-11-0-RC2:1.11
	netbsd-11-0-RC1:1.11
	perseant-exfatfs-base-20250801:1.11
	netbsd-11:1.11.0.60
	netbsd-11-base:1.11
	netbsd-10-1-RELEASE:1.11
	perseant-exfatfs-base-20240630:1.11
	perseant-exfatfs:1.11.0.58
	perseant-exfatfs-base:1.11
	netbsd-8-3-RELEASE:1.11
	netbsd-9-4-RELEASE:1.11
	netbsd-10-0-RELEASE:1.11
	netbsd-10-0-RC6:1.11
	netbsd-10-0-RC5:1.11
	netbsd-10-0-RC4:1.11
	netbsd-10-0-RC3:1.11
	netbsd-10-0-RC2:1.11
	netbsd-10-0-RC1:1.11
	netbsd-10:1.11.0.56
	netbsd-10-base:1.11
	netbsd-9-3-RELEASE:1.11
	cjep_sun2x-base1:1.11
	cjep_sun2x:1.11.0.54
	cjep_sun2x-base:1.11
	cjep_staticlib_x-base1:1.11
	netbsd-9-2-RELEASE:1.11
	cjep_staticlib_x:1.11.0.52
	cjep_staticlib_x-base:1.11
	netbsd-9-1-RELEASE:1.11
	phil-wifi-20200421:1.11
	phil-wifi-20200411:1.11
	is-mlppp:1.11.0.50
	is-mlppp-base:1.11
	phil-wifi-20200406:1.11
	netbsd-8-2-RELEASE:1.11
	netbsd-9-0-RELEASE:1.11
	netbsd-9-0-RC2:1.11
	netbsd-9-0-RC1:1.11
	phil-wifi-20191119:1.11
	netbsd-9:1.11.0.48
	netbsd-9-base:1.11
	phil-wifi-20190609:1.11
	netbsd-8-1-RELEASE:1.11
	netbsd-8-1-RC1:1.11
	pgoyette-compat-merge-20190127:1.11
	pgoyette-compat-20190127:1.11
	pgoyette-compat-20190118:1.11
	pgoyette-compat-1226:1.11
	pgoyette-compat-1126:1.11
	pgoyette-compat-1020:1.11
	pgoyette-compat-0930:1.11
	pgoyette-compat-0906:1.11
	netbsd-7-2-RELEASE:1.11
	pgoyette-compat-0728:1.11
	netbsd-8-0-RELEASE:1.11
	phil-wifi:1.11.0.46
	phil-wifi-base:1.11
	pgoyette-compat-0625:1.11
	netbsd-8-0-RC2:1.11
	pgoyette-compat-0521:1.11
	pgoyette-compat-0502:1.11
	pgoyette-compat-0422:1.11
	netbsd-8-0-RC1:1.11
	pgoyette-compat-0415:1.11
	pgoyette-compat-0407:1.11
	pgoyette-compat-0330:1.11
	pgoyette-compat-0322:1.11
	pgoyette-compat-0315:1.11
	netbsd-7-1-2-RELEASE:1.11
	pgoyette-compat:1.11.0.44
	pgoyette-compat-base:1.11
	netbsd-7-1-1-RELEASE:1.11
	matt-nb8-mediatek:1.11.0.42
	matt-nb8-mediatek-base:1.11
	perseant-stdc-iso10646:1.11.0.40
	perseant-stdc-iso10646-base:1.11
	netbsd-8:1.11.0.38
	netbsd-8-base:1.11
	prg-localcount2-base3:1.11
	prg-localcount2-base2:1.11
	prg-localcount2-base1:1.11
	prg-localcount2:1.11.0.36
	prg-localcount2-base:1.11
	pgoyette-localcount-20170426:1.11
	bouyer-socketcan-base1:1.11
	pgoyette-localcount-20170320:1.11
	netbsd-7-1:1.11.0.34
	netbsd-7-1-RELEASE:1.11
	netbsd-7-1-RC2:1.11
	netbsd-7-nhusb-base-20170116:1.11
	bouyer-socketcan:1.11.0.32
	bouyer-socketcan-base:1.11
	pgoyette-localcount-20170107:1.11
	netbsd-7-1-RC1:1.11
	pgoyette-localcount-20161104:1.11
	netbsd-7-0-2-RELEASE:1.11
	localcount-20160914:1.11
	netbsd-7-nhusb:1.11.0.30
	netbsd-7-nhusb-base:1.11
	pgoyette-localcount-20160806:1.11
	pgoyette-localcount-20160726:1.11
	pgoyette-localcount:1.11.0.28
	pgoyette-localcount-base:1.11
	netbsd-7-0-1-RELEASE:1.11
	netbsd-7-0:1.11.0.26
	netbsd-7-0-RELEASE:1.11
	netbsd-7-0-RC3:1.11
	netbsd-7-0-RC2:1.11
	netbsd-7-0-RC1:1.11
	netbsd-5-2-3-RELEASE:1.10
	netbsd-5-1-5-RELEASE:1.10
	netbsd-6-0-6-RELEASE:1.11
	netbsd-6-1-5-RELEASE:1.11
	netbsd-7:1.11.0.24
	netbsd-7-base:1.11
	yamt-pagecache-base9:1.11
	yamt-pagecache-tag8:1.11
	netbsd-6-1-4-RELEASE:1.11
	netbsd-6-0-5-RELEASE:1.11
	tls-earlyentropy:1.11.0.22
	tls-earlyentropy-base:1.11
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.11
	riastradh-drm2-base3:1.11
	netbsd-6-1-3-RELEASE:1.11
	netbsd-6-0-4-RELEASE:1.11
	netbsd-5-2-2-RELEASE:1.10
	netbsd-5-1-4-RELEASE:1.10
	netbsd-6-1-2-RELEASE:1.11
	netbsd-6-0-3-RELEASE:1.11
	netbsd-5-2-1-RELEASE:1.10
	netbsd-5-1-3-RELEASE:1.10
	netbsd-6-1-1-RELEASE:1.11
	riastradh-drm2-base2:1.11
	riastradh-drm2-base1:1.11
	riastradh-drm2:1.11.0.16
	riastradh-drm2-base:1.11
	netbsd-6-1:1.11.0.20
	netbsd-6-0-2-RELEASE:1.11
	netbsd-6-1-RELEASE:1.11
	netbsd-6-1-RC4:1.11
	netbsd-6-1-RC3:1.11
	agc-symver:1.11.0.18
	agc-symver-base:1.11
	netbsd-6-1-RC2:1.11
	netbsd-6-1-RC1:1.11
	yamt-pagecache-base8:1.11
	netbsd-5-2:1.10.0.4
	netbsd-6-0-1-RELEASE:1.11
	yamt-pagecache-base7:1.11
	netbsd-5-2-RELEASE:1.10
	netbsd-5-2-RC1:1.10
	matt-nb6-plus-nbase:1.11
	yamt-pagecache-base6:1.11
	netbsd-6-0:1.11.0.14
	netbsd-6-0-RELEASE:1.11
	netbsd-6-0-RC2:1.11
	tls-maxphys:1.11.0.12
	tls-maxphys-base:1.11
	matt-nb6-plus:1.11.0.10
	matt-nb6-plus-base:1.11
	netbsd-6-0-RC1:1.11
	yamt-pagecache-base5:1.11
	yamt-pagecache-base4:1.11
	netbsd-6:1.11.0.8
	netbsd-6-base:1.11
	netbsd-5-1-2-RELEASE:1.10
	netbsd-5-1-1-RELEASE:1.10
	yamt-pagecache-base3:1.11
	yamt-pagecache-base2:1.11
	yamt-pagecache:1.11.0.6
	yamt-pagecache-base:1.11
	cherry-xenmp:1.11.0.4
	cherry-xenmp-base:1.11
	bouyer-quota2-nbase:1.11
	bouyer-quota2:1.11.0.2
	bouyer-quota2-base:1.11
	matt-mips64-premerge-20101231:1.11
	matt-nb5-mips64-premerge-20101231:1.10
	matt-nb5-pq3:1.10.0.16
	matt-nb5-pq3-base:1.10
	netbsd-5-1:1.10.0.14
	netbsd-5-1-RELEASE:1.10
	netbsd-5-1-RC4:1.10
	matt-nb5-mips64-k15:1.10
	netbsd-5-1-RC3:1.10
	netbsd-5-1-RC2:1.10
	netbsd-5-1-RC1:1.10
	netbsd-5-0-2-RELEASE:1.10
	matt-nb5-mips64-premerge-20091211:1.10
	matt-premerge-20091211:1.10
	matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.10
	matt-nb4-mips64-k7-u2a-k9b:1.10
	matt-nb5-mips64-u1-k1-k5:1.10
	matt-nb5-mips64:1.10.0.12
	netbsd-5-0-1-RELEASE:1.10
	jym-xensuspend-nbase:1.10
	netbsd-5-0:1.10.0.10
	netbsd-5-0-RELEASE:1.10
	netbsd-5-0-RC4:1.10
	netbsd-5-0-RC3:1.10
	netbsd-5-0-RC2:1.10
	jym-xensuspend:1.10.0.8
	jym-xensuspend-base:1.10
	netbsd-5-0-RC1:1.10
	netbsd-5:1.10.0.6
	netbsd-5-base:1.10
	matt-mips64-base2:1.10
	matt-mips64:1.9.0.32
	netbsd-4-0-1-RELEASE:1.9
	wrstuden-revivesa-base-3:1.10
	wrstuden-revivesa-base-2:1.10
	wrstuden-fixsa-newbase:1.9
	wrstuden-revivesa-base-1:1.10
	yamt-pf42-base4:1.10
	yamt-pf42-base3:1.10
	hpcarm-cleanup-nbase:1.10
	yamt-pf42-baseX:1.9
	yamt-pf42-base2:1.10
	wrstuden-revivesa:1.10.0.2
	wrstuden-revivesa-base:1.10
	yamt-pf42:1.9.0.30
	yamt-pf42-base:1.9
	keiichi-mipv6:1.9.0.28
	keiichi-mipv6-base:1.9
	matt-armv6-nbase:1.9
	matt-armv6-prevmlocking:1.9
	wrstuden-fixsa-base-1:1.9
	netbsd-4-0:1.9.0.26
	netbsd-4-0-RELEASE:1.9
	cube-autoconf:1.9.0.24
	cube-autoconf-base:1.9
	netbsd-4-0-RC5:1.9
	netbsd-4-0-RC4:1.9
	netbsd-4-0-RC3:1.9
	netbsd-4-0-RC2:1.9
	netbsd-4-0-RC1:1.9
	matt-armv6:1.9.0.22
	matt-armv6-base:1.9
	matt-mips64-base:1.9
	hpcarm-cleanup:1.9.0.20
	hpcarm-cleanup-base:1.9
	netbsd-3-1-1-RELEASE:1.9
	netbsd-3-0-3-RELEASE:1.9
	wrstuden-fixsa:1.9.0.18
	wrstuden-fixsa-base:1.9
	abandoned-netbsd-4-base:1.9
	abandoned-netbsd-4:1.9.0.12
	netbsd-3-1:1.9.0.14
	netbsd-3-1-RELEASE:1.9
	netbsd-3-0-2-RELEASE:1.9
	netbsd-3-1-RC4:1.9
	netbsd-3-1-RC3:1.9
	netbsd-3-1-RC2:1.9
	netbsd-3-1-RC1:1.9
	netbsd-4:1.9.0.16
	netbsd-4-base:1.9
	netbsd-3-0-1-RELEASE:1.9
	netbsd-3-0:1.9.0.10
	netbsd-3-0-RELEASE:1.9
	netbsd-3-0-RC6:1.9
	netbsd-3-0-RC5:1.9
	netbsd-3-0-RC4:1.9
	netbsd-3-0-RC3:1.9
	netbsd-3-0-RC2:1.9
	netbsd-3-0-RC1:1.9
	netbsd-2-0-3-RELEASE:1.9
	netbsd-2-1:1.9.0.8
	netbsd-2-1-RELEASE:1.9
	netbsd-2-1-RC6:1.9
	netbsd-2-1-RC5:1.9
	netbsd-2-1-RC4:1.9
	netbsd-2-1-RC3:1.9
	netbsd-2-1-RC2:1.9
	netbsd-2-1-RC1:1.9
	netbsd-2-0-2-RELEASE:1.9
	netbsd-3:1.9.0.6
	netbsd-3-base:1.9
	netbsd-2-0-1-RELEASE:1.9
	netbsd-2:1.9.0.4
	netbsd-2-base:1.9
	netbsd-2-0-RELEASE:1.9
	netbsd-2-0-RC5:1.9
	netbsd-2-0-RC4:1.9
	netbsd-2-0-RC3:1.9
	netbsd-2-0-RC2:1.9
	netbsd-2-0-RC1:1.9
	netbsd-2-0:1.9.0.2
	netbsd-2-0-base:1.9
	netbsd-1-6-PATCH002-RELEASE:1.3
	netbsd-1-6-PATCH002:1.3
	netbsd-1-6-PATCH002-RC4:1.3
	netbsd-1-6-PATCH002-RC3:1.3
	netbsd-1-6-PATCH002-RC2:1.3
	netbsd-1-6-PATCH002-RC1:1.3
	netbsd-1-6-PATCH001:1.3
	netbsd-1-6-PATCH001-RELEASE:1.3
	netbsd-1-6-PATCH001-RC3:1.3
	netbsd-1-6-PATCH001-RC2:1.3
	netbsd-1-6-PATCH001-RC1:1.3
	fvdl_fs64_base:1.8
	netbsd-1-6-RELEASE:1.3
	netbsd-1-6-RC3:1.3
	netbsd-1-6-RC2:1.3
	netbsd-1-6-RC1:1.3
	netbsd-1-6:1.3.0.12
	netbsd-1-6-base:1.3
	netbsd-1-5-PATCH003:1.3
	netbsd-1-5-PATCH002:1.3
	netbsd-1-5-PATCH001:1.3
	netbsd-1-5-RELEASE:1.3
	netbsd-1-5-BETA2:1.3
	netbsd-1-5-BETA:1.3
	netbsd-1-4-PATCH003:1.3
	netbsd-1-5-ALPHA2:1.3
	netbsd-1-5:1.3.0.10
	netbsd-1-5-base:1.3
	minoura-xpg4dl:1.3.0.8
	minoura-xpg4dl-base:1.3
	netbsd-1-4-PATCH002:1.3
	wrstuden-devbsize-19991221:1.3
	wrstuden-devbsize:1.3.0.6
	wrstuden-devbsize-base:1.3
	comdex-fall-1999:1.3.0.4
	comdex-fall-1999-base:1.3
	netbsd-1-4-PATCH001:1.3
	netbsd-1-4-RELEASE:1.3
	netbsd-1-4:1.3.0.2
	netbsd-1-4-base:1.3;
locks; strict;
comment	@# @;


1.11
date	2010.12.05.00.56.07;	author joerg;	state Exp;
branches;
next	1.10;

1.10
date	2008.04.28.20.23.03;	author martin;	state Exp;
branches;
next	1.9;

1.9
date	2003.03.02.22.56.14;	author mycroft;	state Exp;
branches
	1.9.30.1;
next	1.8;

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

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

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

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

1.4
date	2002.09.09.14.08.08;	author mycroft;	state Exp;
branches;
next	1.3;

1.3
date	99.02.19.10.22.14;	author christos;	state Exp;
branches
	1.3.12.1;
next	1.2;

1.2
date	99.02.12.17.15.52;	author christos;	state Exp;
branches;
next	1.1;

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

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

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


desc
@@


1.11
log
@Build ld.elf_so with -fvisibility=hidden. Exploit this for i386/x86_64
to simplify the assembler code.
@
text
@/*	$NetBSD: src/libexec/ld.elf_so/arch/i386/rtld_start.S,v 1.10 2008-04-28 20:23:03 martin Exp $	*/

/*-
 * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Christos Zoulas 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>

	.text
	.align	4
	.globl	.rtld_start
	.hidden	.rtld_start
	.type	.rtld_start,@@function
.rtld_start:
	subl	$8,%esp			# make room of obj_main and exit proc
	pushl	%ebx			# save ps_strings

	call	1f
1:
	popl	%edx
	leal	_DYNAMIC-1b(%edx),%ecx	# &_DYNAMIC
	movl	%ecx,%ebx
	subl	_GLOBAL_OFFSET_TABLE_-1b(%edx),%ebx

	pushl	%ebx			# relocbase
	pushl	%ecx			# &_DYNAMIC
	call	_rtld_relocate_nonplt_self

	leal	12(%esp),%eax		# &cleanup
	pushl	%ebx			# relocbase
	pushl	%eax			# sp
	call	_rtld			# _rtld(sp, relocbase)

	addl	$16,%esp		# pop args

	popl	%ebx			# %ebx = ps_strings
	popl	%edx			# %edx = cleanup
	popl	%ecx			# %ecx = obj_main
	jmp	*%eax

	.align	4
	.globl	_rtld_bind_start
	.hidden	_rtld_bind_start
	.type	_rtld_bind_start,@@function
_rtld_bind_start:	# (obj, reloff)
	pushf				# save registers
	pushl	%eax
	pushl	%ecx
	pushl	%edx

	pushl	20(%esp)		# Copy of reloff
	pushl	20(%esp)		# Copy of obj
	call	_rtld_bind		# Call the binder
	addl	$8,%esp			# pop binder args
	movl	%eax,20(%esp)		# Store function to be called in obj

	popl	%edx
	popl	%ecx
	popl	%eax
	popf

	leal	4(%esp),%esp		# Discard reloff, do not change eflags
	ret
@


1.10
log
@Remove clause 3 and 4 from TNF licenses
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.9 2003/03/02 22:56:14 mycroft Exp $	*/
d37 1
d52 1
a52 1
	call	_rtld_relocate_nonplt_self@@PLT
d57 1
a57 1
	call	_rtld@@PLT		# _rtld(sp, relocbase)
d68 1
d78 1
a78 1
	call	_rtld_bind@@PLT		# Call the binder
@


1.9
log
@Shorten rtld_start() by 2 instructions or 8 bytes, and make it not use GOT
entries.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.8 2002/09/25 08:00:26 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.9.30.1
log
@sync with head.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.9 2003/03/02 22:56:14 mycroft Exp $	*/
d18 7
@


1.8
log
@We don't need to save quite as many registers in the stub.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.7 2002/09/12 17:18:39 mycroft Exp $	*/
d51 4
a54 2
	popl	%ebx
	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx
a55 3
	movl	_GLOBAL_OFFSET_TABLE_@@GOT(%ebx),%edx
	movl	_DYNAMIC@@GOT(%ebx),%ecx
	subl	%edx,%ebx
a56 1
	addl	%ebx,%ecx
@


1.7
log
@Update comments.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.6 2002/09/12 17:07:26 mycroft Exp $	*/
a81 6
	pushl	%ebx
	pushl	%ebp
	pushl	%esi
	pushl	%edi
	pushl	%ds
	pushl	%es
d83 2
a84 2
	pushl	44(%esp)		# Copy of reloff
	pushl	44(%esp)		# Copy of obj
d87 1
a87 1
	movl	%eax,44(%esp)		# Store function to be called in obj
a88 6
	popl	%es			# restore registers
	popl	%ds
	popl	%edi
	popl	%esi
	popl	%ebp
	popl	%ebx
@


1.6
log
@Pass the calculated relocation offset down to _rtld().
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.5 2002/09/11 17:23:25 mycroft Exp $	*/
d4 1
a4 1
 * Copyright (c) 1998 The NetBSD Foundation, Inc.
@


1.5
log
@Split the `self' case out of _rtld_relocate_nonplt_objects, into a new function
_rtld_relocate_nonplt_self(), which is called from _rtld_start.
Now we're completely relocated before main() is called.
We also no longer need _GOT_END_, so junk the ld script.

This code assumes that ld.elf_so only contains RELATIVE relocs, but that's
supposed to be the case for -Bsymbolic anyway.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.4 2002/09/09 14:08:08 mycroft Exp $	*/
d57 1
a57 1
	pushl	%ebx
d59 1
a59 1
	pushl	%ecx
d63 3
a65 2
	pushl	%eax
	call	_rtld@@PLT		# _rtld(sp)
d67 1
a67 1
	addl	$12,%esp		# pop args
@


1.4
log
@Get rid of RTLD_RELOCATE_SELF on i386.
* Add a ld.so.script that exports _GOT_END_.
* Prebind the GOT in _rtld_start.
* Skip over GOT relocs in _rtld_relocate_nonplt_objects().
This makes debugging work better at least.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.3 1999/02/19 10:22:14 christos Exp $	*/
d8 1
a8 1
 * by Christos Zoulas.
a46 1
	movl	%esp,%eax		# save stack pointer for _rtld
d55 6
a60 9
	movl	_GOT_END_@@GOT(%ebx),%ecx
	subl	%edx,%ecx
	shrl	$2,%ecx
	subl	%ebx,%edx
1:
	subl	%edx,(%ebx)
	leal	4(%ebx),%ebx
	decl	%ecx
	jg	1b
d62 1
d65 2
a66 1
	addl	$4,%esp			# pop args
@


1.3
log
@Remove unneeded args for rtld (kleink)
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.2 1999/02/12 17:15:52 christos Exp $	*/
d49 16
@


1.3.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.9 2003/03/02 22:56:14 mycroft Exp $	*/
d4 1
a4 1
 * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
d8 1
a8 1
 * by Christos Zoulas and by Charles M. Hannum.
d47 1
d50 3
a52 17
	call	1f
1:
	popl	%edx
	leal	_DYNAMIC-1b(%edx),%ecx	# &_DYNAMIC
	movl	%ecx,%ebx
	subl	_GLOBAL_OFFSET_TABLE_-1b(%edx),%ebx

	pushl	%ebx			# relocbase
	pushl	%ecx			# &_DYNAMIC
	call	_rtld_relocate_nonplt_self@@PLT

	leal	12(%esp),%eax		# &cleanup
	pushl	%ebx			# relocbase
	pushl	%eax			# sp
	call	_rtld@@PLT		# _rtld(sp, relocbase)

	addl	$16,%esp		# pop args
d67 6
d74 2
a75 2
	pushl	20(%esp)		# Copy of reloff
	pushl	20(%esp)		# Copy of obj
d78 1
a78 1
	movl	%eax,20(%esp)		# Store function to be called in obj
d80 6
@


1.2
log
@Be consistant about the .rtld_start and _rtld_start
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.1 1999/01/10 18:21:24 christos Exp $	*/
d44 1
a44 1
	.type	.rtld_start@@function
a48 3
	movl	%esp,%ebx		# cleanup
	movl	%esp,%ecx		# obj_main
	addl	$4,%ecx
a49 2
	pushl	%ecx
	pushl	%ebx
d51 2
a52 2
	call	_rtld@@PLT		# _rtld(sp, exitproc, obj_main)
	addl	$12,%esp		# pop args
@


1.1
log
@Add i386 bits. Only works with -fpic or -fPIC compiled binaries since
COPY relocations don't work.
@
text
@d1 1
a1 1
/*	$NetBSD$	*/
d43 1
a43 1
	.globl	_rtld_start
d45 1
a45 1
_rtld_start:
@
