head	1.12;
access;
symbols
	netbsd-11-0-RC5:1.12
	netbsd-11-0-RC4:1.12
	netbsd-11-0-RC3:1.12
	netbsd-11-0-RC2:1.12
	netbsd-11-0-RC1:1.12
	perseant-exfatfs-base-20250801:1.12
	netbsd-11:1.12.0.40
	netbsd-11-base:1.12
	netbsd-10-1-RELEASE:1.12
	perseant-exfatfs-base-20240630:1.12
	perseant-exfatfs:1.12.0.38
	perseant-exfatfs-base:1.12
	netbsd-8-3-RELEASE:1.12
	netbsd-9-4-RELEASE:1.12
	netbsd-10-0-RELEASE:1.12
	netbsd-10-0-RC6:1.12
	netbsd-10-0-RC5:1.12
	netbsd-10-0-RC4:1.12
	netbsd-10-0-RC3:1.12
	netbsd-10-0-RC2:1.12
	netbsd-10-0-RC1:1.12
	netbsd-10:1.12.0.36
	netbsd-10-base:1.12
	netbsd-9-3-RELEASE:1.12
	cjep_sun2x-base1:1.12
	cjep_sun2x:1.12.0.34
	cjep_sun2x-base:1.12
	cjep_staticlib_x-base1:1.12
	netbsd-9-2-RELEASE:1.12
	cjep_staticlib_x:1.12.0.32
	cjep_staticlib_x-base:1.12
	netbsd-9-1-RELEASE:1.12
	phil-wifi-20200421:1.12
	phil-wifi-20200411:1.12
	is-mlppp:1.12.0.30
	is-mlppp-base:1.12
	phil-wifi-20200406:1.12
	netbsd-8-2-RELEASE:1.12
	netbsd-9-0-RELEASE:1.12
	netbsd-9-0-RC2:1.12
	netbsd-9-0-RC1:1.12
	phil-wifi-20191119:1.12
	netbsd-9:1.12.0.28
	netbsd-9-base:1.12
	phil-wifi-20190609:1.12
	netbsd-8-1-RELEASE:1.12
	netbsd-8-1-RC1:1.12
	pgoyette-compat-merge-20190127:1.12
	pgoyette-compat-20190127:1.12
	pgoyette-compat-20190118:1.12
	pgoyette-compat-1226:1.12
	pgoyette-compat-1126:1.12
	pgoyette-compat-1020:1.12
	pgoyette-compat-0930:1.12
	pgoyette-compat-0906:1.12
	netbsd-7-2-RELEASE:1.12
	pgoyette-compat-0728:1.12
	netbsd-8-0-RELEASE:1.12
	phil-wifi:1.12.0.26
	phil-wifi-base:1.12
	pgoyette-compat-0625:1.12
	netbsd-8-0-RC2:1.12
	pgoyette-compat-0521:1.12
	pgoyette-compat-0502:1.12
	pgoyette-compat-0422:1.12
	netbsd-8-0-RC1:1.12
	pgoyette-compat-0415:1.12
	pgoyette-compat-0407:1.12
	pgoyette-compat-0330:1.12
	pgoyette-compat-0322:1.12
	pgoyette-compat-0315:1.12
	netbsd-7-1-2-RELEASE:1.12
	pgoyette-compat:1.12.0.24
	pgoyette-compat-base:1.12
	netbsd-7-1-1-RELEASE:1.12
	matt-nb8-mediatek:1.12.0.22
	matt-nb8-mediatek-base:1.12
	perseant-stdc-iso10646:1.12.0.20
	perseant-stdc-iso10646-base:1.12
	netbsd-8:1.12.0.18
	netbsd-8-base:1.12
	prg-localcount2-base3:1.12
	prg-localcount2-base2:1.12
	prg-localcount2-base1:1.12
	prg-localcount2:1.12.0.16
	prg-localcount2-base:1.12
	pgoyette-localcount-20170426:1.12
	bouyer-socketcan-base1:1.12
	pgoyette-localcount-20170320:1.12
	netbsd-7-1:1.12.0.14
	netbsd-7-1-RELEASE:1.12
	netbsd-7-1-RC2:1.12
	netbsd-7-nhusb-base-20170116:1.12
	bouyer-socketcan:1.12.0.12
	bouyer-socketcan-base:1.12
	pgoyette-localcount-20170107:1.12
	netbsd-7-1-RC1:1.12
	pgoyette-localcount-20161104:1.12
	netbsd-7-0-2-RELEASE:1.12
	localcount-20160914:1.12
	netbsd-7-nhusb:1.12.0.10
	netbsd-7-nhusb-base:1.12
	pgoyette-localcount-20160806:1.12
	pgoyette-localcount-20160726:1.12
	pgoyette-localcount:1.12.0.8
	pgoyette-localcount-base:1.12
	netbsd-7-0-1-RELEASE:1.12
	netbsd-7-0:1.12.0.6
	netbsd-7-0-RELEASE:1.12
	netbsd-7-0-RC3:1.12
	netbsd-7-0-RC2:1.12
	netbsd-7-0-RC1:1.12
	netbsd-5-2-3-RELEASE:1.9
	netbsd-5-1-5-RELEASE:1.9
	netbsd-6-0-6-RELEASE:1.10
	netbsd-6-1-5-RELEASE:1.10
	netbsd-7:1.12.0.4
	netbsd-7-base:1.12
	yamt-pagecache-base9:1.12
	yamt-pagecache-tag8:1.10.6.1
	netbsd-6-1-4-RELEASE:1.10
	netbsd-6-0-5-RELEASE:1.10
	tls-earlyentropy:1.12.0.2
	tls-earlyentropy-base:1.12
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.12
	riastradh-drm2-base3:1.12
	netbsd-6-1-3-RELEASE:1.10
	netbsd-6-0-4-RELEASE:1.10
	netbsd-5-2-2-RELEASE:1.9
	netbsd-5-1-4-RELEASE:1.9
	netbsd-6-1-2-RELEASE:1.10
	netbsd-6-0-3-RELEASE:1.10
	netbsd-5-2-1-RELEASE:1.9
	netbsd-5-1-3-RELEASE:1.9
	netbsd-6-1-1-RELEASE:1.10
	riastradh-drm2-base2:1.11
	riastradh-drm2-base1:1.11
	riastradh-drm2:1.11.0.4
	riastradh-drm2-base:1.11
	netbsd-6-1:1.10.0.14
	netbsd-6-0-2-RELEASE:1.10
	netbsd-6-1-RELEASE:1.10
	netbsd-6-1-RC4:1.10
	netbsd-6-1-RC3:1.10
	agc-symver:1.11.0.6
	agc-symver-base:1.11
	netbsd-6-1-RC2:1.10
	netbsd-6-1-RC1:1.10
	yamt-pagecache-base8:1.11
	netbsd-5-2:1.9.0.4
	netbsd-6-0-1-RELEASE:1.10
	yamt-pagecache-base7:1.11
	netbsd-5-2-RELEASE:1.9
	netbsd-5-2-RC1:1.9
	matt-nb6-plus-nbase:1.10
	yamt-pagecache-base6:1.11
	netbsd-6-0:1.10.0.12
	netbsd-6-0-RELEASE:1.10
	netbsd-6-0-RC2:1.10
	tls-maxphys:1.11.0.2
	tls-maxphys-base:1.12
	matt-nb6-plus:1.10.0.10
	matt-nb6-plus-base:1.10
	netbsd-6-0-RC1:1.10
	yamt-pagecache-base5:1.10
	yamt-pagecache-base4:1.10
	netbsd-6:1.10.0.8
	netbsd-6-base:1.10
	netbsd-5-1-2-RELEASE:1.9
	netbsd-5-1-1-RELEASE:1.9
	yamt-pagecache-base3:1.10
	yamt-pagecache-base2:1.10
	yamt-pagecache:1.10.0.6
	yamt-pagecache-base:1.10
	cherry-xenmp:1.10.0.4
	cherry-xenmp-base:1.10
	bouyer-quota2-nbase:1.10
	bouyer-quota2:1.10.0.2
	bouyer-quota2-base:1.10
	matt-mips64-premerge-20101231:1.10
	matt-nb5-mips64-premerge-20101231:1.9
	matt-nb5-pq3:1.9.0.16
	matt-nb5-pq3-base:1.9
	netbsd-5-1:1.9.0.14
	netbsd-5-1-RELEASE:1.9
	netbsd-5-1-RC4:1.9
	matt-nb5-mips64-k15:1.9
	netbsd-5-1-RC3:1.9
	netbsd-5-1-RC2:1.9
	netbsd-5-1-RC1:1.9
	netbsd-5-0-2-RELEASE:1.9
	matt-nb5-mips64-premerge-20091211:1.9
	matt-premerge-20091211:1.10
	matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.9
	matt-nb4-mips64-k7-u2a-k9b:1.9
	matt-nb5-mips64-u1-k1-k5:1.9
	matt-nb5-mips64:1.9.0.12
	netbsd-5-0-1-RELEASE:1.9
	jym-xensuspend-nbase:1.9
	netbsd-5-0:1.9.0.10
	netbsd-5-0-RELEASE:1.9
	netbsd-5-0-RC4:1.9
	netbsd-5-0-RC3:1.9
	netbsd-5-0-RC2:1.9
	jym-xensuspend:1.9.0.8
	jym-xensuspend-base:1.9
	netbsd-5-0-RC1:1.9
	netbsd-5:1.9.0.6
	netbsd-5-base:1.9
	matt-mips64-base2:1.9
	matt-mips64:1.8.0.26
	netbsd-4-0-1-RELEASE:1.8
	wrstuden-revivesa-base-3:1.9
	wrstuden-revivesa-base-2:1.9
	wrstuden-fixsa-newbase:1.8
	wrstuden-revivesa-base-1:1.9
	yamt-pf42-base4:1.9
	yamt-pf42-base3:1.9
	hpcarm-cleanup-nbase:1.9
	yamt-pf42-baseX:1.8
	yamt-pf42-base2:1.9
	wrstuden-revivesa:1.9.0.2
	wrstuden-revivesa-base:1.9
	yamt-pf42:1.8.0.24
	yamt-pf42-base:1.8
	keiichi-mipv6:1.8.0.22
	keiichi-mipv6-base:1.8
	matt-armv6-nbase:1.8
	matt-armv6-prevmlocking:1.8
	wrstuden-fixsa-base-1:1.8
	netbsd-4-0:1.8.0.20
	netbsd-4-0-RELEASE:1.8
	cube-autoconf:1.8.0.18
	cube-autoconf-base:1.8
	netbsd-4-0-RC5:1.8
	netbsd-4-0-RC4:1.8
	netbsd-4-0-RC3:1.8
	netbsd-4-0-RC2:1.8
	netbsd-4-0-RC1:1.8
	matt-armv6:1.8.0.16
	matt-armv6-base:1.8
	matt-mips64-base:1.8
	hpcarm-cleanup:1.8.0.14
	hpcarm-cleanup-base:1.8
	netbsd-3-1-1-RELEASE:1.8
	netbsd-3-0-3-RELEASE:1.8
	wrstuden-fixsa:1.8.0.12
	wrstuden-fixsa-base:1.8
	abandoned-netbsd-4-base:1.8
	abandoned-netbsd-4:1.8.0.6
	netbsd-3-1:1.8.0.8
	netbsd-3-1-RELEASE:1.8
	netbsd-3-0-2-RELEASE:1.8
	netbsd-3-1-RC4:1.8
	netbsd-3-1-RC3:1.8
	netbsd-3-1-RC2:1.8
	netbsd-3-1-RC1:1.8
	netbsd-4:1.8.0.10
	netbsd-4-base:1.8
	netbsd-3-0-1-RELEASE:1.8
	netbsd-3-0:1.8.0.4
	netbsd-3-0-RELEASE:1.8
	netbsd-3-0-RC6:1.8
	netbsd-3-0-RC5:1.8
	netbsd-3-0-RC4:1.8
	netbsd-3-0-RC3:1.8
	netbsd-3-0-RC2:1.8
	netbsd-3-0-RC1:1.8
	netbsd-2-0-3-RELEASE:1.7
	netbsd-2-1:1.7.0.6
	netbsd-2-1-RELEASE:1.7
	netbsd-2-1-RC6:1.7
	netbsd-2-1-RC5:1.7
	netbsd-2-1-RC4:1.7
	netbsd-2-1-RC3:1.7
	netbsd-2-1-RC2:1.7
	netbsd-2-1-RC1:1.7
	netbsd-2-0-2-RELEASE:1.7
	netbsd-3:1.8.0.2
	netbsd-3-base:1.8
	netbsd-2-0-1-RELEASE:1.7
	netbsd-2:1.7.0.4
	netbsd-2-base:1.7
	netbsd-2-0-RELEASE:1.7
	netbsd-2-0-RC5:1.7
	netbsd-2-0-RC4:1.7
	netbsd-2-0-RC3:1.7
	netbsd-2-0-RC2:1.7
	netbsd-2-0-RC1:1.7
	netbsd-2-0:1.7.0.2
	netbsd-2-0-base:1.7
	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.7
	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.2
	netbsd-1-6-base:1.3;
locks; strict;
comment	@# @;


1.12
date	2013.12.03.00.19.56;	author matt;	state Exp;
branches;
next	1.11;
commitid	E69XWYTkvJDtsCfx;

1.11
date	2012.08.13.02.53.25;	author matt;	state Exp;
branches
	1.11.2.1;
next	1.10;

1.10
date	2009.11.11.14.15.41;	author skrll;	state Exp;
branches
	1.10.6.1
	1.10.10.1;
next	1.9;

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

1.8
date	2004.08.21.11.12.03;	author rearnsha;	state Exp;
branches
	1.8.24.1;
next	1.7;

1.7
date	2002.09.12.17.18.38;	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.22.28.33;	author mycroft;	state Exp;
branches;
next	1.4;

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

1.3
date	2001.07.15.23.19.59;	author matt;	state Exp;
branches
	1.3.2.1;
next	1.2;

1.2
date	2001.07.15.17.31.03;	author matt;	state Exp;
branches;
next	1.1;

1.1
date	2001.07.15.03.08.33;	author matt;	state Exp;
branches;
next	;

1.11.2.1
date	2014.08.20.00.02.22;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.10.6.1
date	2012.10.30.18.59.23;	author yamt;	state Exp;
branches;
next	1.10.6.2;

1.10.6.2
date	2014.05.22.11.37.13;	author yamt;	state Exp;
branches;
next	;
commitid	VmckIax9CgOhKwBx;

1.10.10.1
date	2013.01.22.21.47.28;	author matt;	state Exp;
branches;
next	;

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

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


desc
@@


1.12
log
@Don't use GOT relocations.  Use PC relative for the GOT and GOTOFF for
_DYNAMIC.  Make thumb friendly.
@
text
@/*	$NetBSD: rtld_start.S,v 1.11 2012/08/13 02:53:25 matt Exp $	*/

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

RCSID("$NetBSD: rtld_start.S,v 1.11 2012/08/13 02:53:25 matt Exp $")

ENTRY_NP(_rtld_start)
	sub	sp, sp, #8		/* make room for obj_main & exit proc */
	movs	r4, r0			/* save ps_strings */

	ldr	r6, .Lgot
	ldr	r5, .Ldynamic
	add	r6, r6, pc		/* r6 = &GOT[0]; pc = &LPIC1; */
	adds	r0, r6, r5		/* arg0 = &_DYNAMIC */
.LPIC1:
	ldr	r5, [r6]		/* GOT[0] = &_DYNAMIC */
	subs	r5, r0, r5		/* relocbase = GOT[0] - &_DYNAMIC */
	movs	r1, r5			/* arg1 = relocabase */
	bl	_rtld_relocate_nonplt_self

	movs	r1, r5			/* relocbase */
	mov	r0, sp			/* sp */
	bl	_rtld			/* call the shared loader */
	movs	r3, r0			/* save entry point */

#ifdef __thumb__
	ldr	r2, [sp, #0]		/* pop r2 = cleanup */
	ldr	r1, [sp, #4]		/* pop r1 = obj_main */
	add	sp, sp, #8
#else
	ldr	r2, [sp], #4		/* pop r2 = cleanup */
	ldr	r1, [sp], #4		/* pop r1 = obj_main */
#endif
	movs	r0, r4			/* restore ps_strings */
	RETr(r3)

	.align	0
.Lgot:
	.word	_GLOBAL_OFFSET_TABLE_ - .LPIC1
.Ldynamic:
	.word	_DYNAMIC(GOTOFF)
END(_rtld_start)

/*
 *	stack[0] = RA
 *	ip = &GOT[n+3]
 *	lr = &GOT[2]
 */
ARM_ENTRY_NP(_rtld_bind_start)
	stmdb	sp!,{r0-r4,sl,fp}	/* 8 byte aligned (lr already saved) */

	sub	r1, ip, lr		/* r1 = 4 * (n + 1) */
	sub	r1, r1, #4		/* r1 = 4 * n */
	add	r1, r1, r1		/* r1 = 8 * n */

	ldr	r0, [lr, #-4]		/* get obj ptr from GOT[1] */
	mov	r4, ip			/* save GOT location */

	bl	_rtld_bind		/* Call the binder */

	str	r0, [r4]		/* save address in GOT */
	mov	ip, r0			/* save new address */

	ldmia	sp!,{r0-r4,sl,fp,lr}	/* restore the stack */
	RETr(ip)			/* jump to the new address */
END(_rtld_bind_start)
@


1.11
log
@Add a comment for EABI.  Use "pop" instructions to save one instruction.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.10 2009/11/11 14:15:41 skrll Exp $	*/
d34 1
a34 1
RCSID("$NetBSD: rtld_start.S,v 1.10 2009/11/11 14:15:41 skrll Exp $")
d36 1
a36 5
	.text
	.align	0
	.globl	_rtld_start
	.type	_rtld_start,%function
_rtld_start:
d38 1
a38 9
	mov	r4, r0			/* save ps_strings */

	ldr	sl, .L2
	ldr	r5, .L2+4
	ldr	r0, .L2+8
.L1:
	add	sl, pc, sl
	ldr	r5, [sl, r5]
	ldr	r0, [sl, r0]
d40 8
a47 2
	sub	r1, sl, r5		/* relocbase */
	add	r0, r1, r0		/* &_DYNAMIC */
d50 1
a50 1
	sub	r1, sl, r5		/* relocbase */
d53 1
a53 1
	mov	r3, r0			/* save entry point */
d55 5
a61 5
	mov	r0, r4			/* restore ps_strings */
#ifdef _ARM_ARCH_4T
	bx	r3			/* jump to the entry point */
#else
	mov	pc, r3			/* jump to the entry point */
d63 2
a64 4
.L2:
	.word	_GLOBAL_OFFSET_TABLE_ - (.L1+8)
	.word	_GLOBAL_OFFSET_TABLE_(GOT)
	.word	_DYNAMIC(GOT)
d67 6
a72 2
	.globl	_rtld_bind_start
	.type	_rtld_bind_start,%function
d78 1
a78 1
_rtld_bind_start:
d94 2
a95 6
#ifdef _ARM_ARCH_4T
	bx	ip			/* jump to the new address */
#else
	mov	pc, ip			/* jump to the new address */
#endif

@


1.11.2.1
log
@Rebase to HEAD as of a few days ago.
@
text
@d1 1
a1 1
/*	$NetBSD$	*/
d34 1
a34 1
RCSID("$NetBSD$")
d36 5
a40 1
ENTRY_NP(_rtld_start)
d42 9
a50 1
	movs	r4, r0			/* save ps_strings */
d52 2
a53 8
	ldr	r6, .Lgot
	ldr	r5, .Ldynamic
	add	r6, r6, pc		/* r6 = &GOT[0]; pc = &LPIC1; */
	adds	r0, r6, r5		/* arg0 = &_DYNAMIC */
.LPIC1:
	ldr	r5, [r6]		/* GOT[0] = &_DYNAMIC */
	subs	r5, r0, r5		/* relocbase = GOT[0] - &_DYNAMIC */
	movs	r1, r5			/* arg1 = relocabase */
d56 1
a56 1
	movs	r1, r5			/* relocbase */
d59 1
a59 1
	movs	r3, r0			/* save entry point */
a60 5
#ifdef __thumb__
	ldr	r2, [sp, #0]		/* pop r2 = cleanup */
	ldr	r1, [sp, #4]		/* pop r1 = obj_main */
	add	sp, sp, #8
#else
d63 5
d69 4
a72 2
	movs	r0, r4			/* restore ps_strings */
	RETr(r3)
d75 2
a76 6
.Lgot:
	.word	_GLOBAL_OFFSET_TABLE_ - .LPIC1
.Ldynamic:
	.word	_DYNAMIC(GOTOFF)
END(_rtld_start)

d82 1
a82 1
ARM_ENTRY_NP(_rtld_bind_start)
d98 6
a103 2
	RETr(ip)			/* jump to the new address */
END(_rtld_bind_start)
@


1.10
log
@Add RCSID
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.9 2008/04/28 20:23:03 martin Exp $	*/
d34 1
a34 1
RCSID("$NetBSD$")
d61 2
a62 3
	ldr	r2, [sp, #0]		/* r2 = cleanup */
	ldr	r1, [sp, #4]		/* r1 = obj_main */
	add	sp, sp, #8		/* restore stack */
d83 1
a83 1
	stmdb	sp!,{r0-r4,sl,fp}
@


1.10.10.1
log
@Pullup from HEAD:
Add .init_array/.fini_array support (conditionalized on HAVE_INITFINI_ARRAY).
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.11 2012/08/13 02:53:25 matt Exp $	*/
d34 1
a34 1
RCSID("$NetBSD: rtld_start.S,v 1.11 2012/08/13 02:53:25 matt Exp $")
d61 3
a63 2
	ldr	r2, [sp], #4		/* pop r2 = cleanup */
	ldr	r1, [sp], #4		/* pop r1 = obj_main */
d84 1
a84 1
	stmdb	sp!,{r0-r4,sl,fp}	/* 8 byte aligned (lr already saved) */
@


1.10.6.1
log
@sync with head
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.10 2009/11/11 14:15:41 skrll Exp $	*/
d34 1
a34 1
RCSID("$NetBSD: rtld_start.S,v 1.10 2009/11/11 14:15:41 skrll Exp $")
d61 3
a63 2
	ldr	r2, [sp], #4		/* pop r2 = cleanup */
	ldr	r1, [sp], #4		/* pop r1 = obj_main */
d84 1
a84 1
	stmdb	sp!,{r0-r4,sl,fp}	/* 8 byte aligned (lr already saved) */
@


1.10.6.2
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.10.6.1 2012/10/30 18:59:23 yamt Exp $	*/
d34 1
a34 1
RCSID("$NetBSD: rtld_start.S,v 1.10.6.1 2012/10/30 18:59:23 yamt Exp $")
d36 5
a40 1
ENTRY_NP(_rtld_start)
d42 9
a50 1
	movs	r4, r0			/* save ps_strings */
d52 2
a53 8
	ldr	r6, .Lgot
	ldr	r5, .Ldynamic
	add	r6, r6, pc		/* r6 = &GOT[0]; pc = &LPIC1; */
	adds	r0, r6, r5		/* arg0 = &_DYNAMIC */
.LPIC1:
	ldr	r5, [r6]		/* GOT[0] = &_DYNAMIC */
	subs	r5, r0, r5		/* relocbase = GOT[0] - &_DYNAMIC */
	movs	r1, r5			/* arg1 = relocabase */
d56 1
a56 1
	movs	r1, r5			/* relocbase */
d59 1
a59 1
	movs	r3, r0			/* save entry point */
a60 5
#ifdef __thumb__
	ldr	r2, [sp, #0]		/* pop r2 = cleanup */
	ldr	r1, [sp, #4]		/* pop r1 = obj_main */
	add	sp, sp, #8
#else
d63 5
d69 4
a72 2
	movs	r0, r4			/* restore ps_strings */
	RETr(r3)
d75 2
a76 6
.Lgot:
	.word	_GLOBAL_OFFSET_TABLE_ - .LPIC1
.Ldynamic:
	.word	_DYNAMIC(GOTOFF)
END(_rtld_start)

d82 1
a82 1
ARM_ENTRY_NP(_rtld_bind_start)
d98 6
a103 2
	RETr(ip)			/* jump to the new address */
END(_rtld_bind_start)
@


1.9
log
@Remove clause 3 and 4 from TNF licenses
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.8 2004/08/21 11:12:03 rearnsha Exp $	*/
d34 2
@


1.8
log
@Use BX if available.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.7 2002/09/12 17:18:38 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.8.24.1
log
@sync with head.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.8 2004/08/21 11:12:03 rearnsha Exp $	*/
d18 7
@


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 $	*/
d70 3
d74 1
d104 3
d108 1
@


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 22:28:33 mycroft Exp $	*/
d4 1
a4 1
 * Copyright (c) 1998 The NetBSD Foundation, Inc.
d8 1
a8 1
 * by Matt Thomas.
@


1.5
log
@Do the _rtld_relocate_nonplt_self() thing here, and nuke the ld script.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.4 2002/09/09 19:28:40 mycroft Exp $	*/
d50 1
a50 1
	ldr	r1, .L2+4
d54 1
a54 1
	ldr	r1, [sl, r1]
d56 3
a58 2
	sub	r1, sl, r1
	add	r0, r1, r0
d61 2
a62 1
	mov	r0, sp			/* arg#1 = sp */
@


1.4
log
@Nuke RTLD_RELOCATE_SELF on ARM.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.3 2001/07/15 23:19:59 matt Exp $	*/
d51 1
a51 1
	ldr	r2, .L2+8
d55 1
a55 1
	ldr	r2, [sl, r2]
a56 3
	add	r2, r1, r2
1:
	ldr	r0, [sl]
d58 1
a58 3
	str	r0, [sl], #4
	cmp	sl, r2
	bcc	1b
d72 1
a72 1
	.word	_GOT_END_(GOT)
@


1.3
log
@Fix binder routine to not use a volatile register.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.2 2001/07/15 17:31:03 matt Exp $	*/
d49 16
d74 4
@


1.3.2.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.7 2002/09/12 17:18:38 mycroft Exp $	*/
d4 1
a4 1
 * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
d8 1
a8 1
 * by Matt Thomas and by Charles M. Hannum.
d49 1
a49 14
	ldr	sl, .L2
	ldr	r5, .L2+4
	ldr	r0, .L2+8
.L1:
	add	sl, pc, sl
	ldr	r5, [sl, r5]
	ldr	r0, [sl, r0]

	sub	r1, sl, r5		/* relocbase */
	add	r0, r1, r0		/* &_DYNAMIC */
	bl	_rtld_relocate_nonplt_self

	sub	r1, sl, r5		/* relocbase */
	mov	r0, sp			/* sp */
a57 4
.L2:
	.word	_GLOBAL_OFFSET_TABLE_ - (.L1+8)
	.word	_GLOBAL_OFFSET_TABLE_(GOT)
	.word	_DYNAMIC(GOT)
@


1.2
log
@Bugfix for _rtld_start.  Enable common plt processing code for arm
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.1 2001/07/15 03:08:33 matt Exp $	*/
d68 1
a68 1
	stmdb	sp!,{r0-r3,sl,fp}
d75 1
d79 1
a79 1
	str	r0, [ip]		/* save address in GOT */
d82 1
a82 1
	ldmia	sp!,{r0-r3,sl,fp,lr}	/* restore the stack */
@


1.1
log
@Initial support for dynamic ELF support on ARM.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.3 1999/02/19 10:22:14 christos Exp $	*/
d53 2
a54 2
	ldr	r2, [sp, #4]		/* r2 = cleanup */
	ldr	r1, [sp]		/* r1 = obj_main */
@
