/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1988 AT&T
* All Rights Reserved
*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Bootstrap routine for ld.so. Control arrives here either directly from
* exec() upon invocation of a dynamically linked program specifying ld.so
* as its interpreter, or from the "a.out compatibility ld.so". Entry
* vector at "_rt_boot" used to discriminate between the two.
*
* On entry, the stack appears as:
*
* !_______________________! high addresses
* ! !
* ! Information !
* ! Block !
* ! (size varies) !
* !_______________________!
* ! 0 word !
* !_______________________!
* ! Auxiliary !
* ! vector !
* ! 2 word entries !
* ! !
* !_______________________!
* ! 0 word !
* !_______________________!
* ! Environment !
* ! pointers !
* ! ... !
* ! (one word each) !
* !_______________________!
* ! 0 word !
* !_______________________!
* ! Argument ! low addresses
* ! pointers !
* ! Argc words !
* !_______________________!
* ! !
* ! Argc !
* !_______________________! <- %sp + 64
* ! !
* ! Window save area !
* !_______________________! <- %sp
*
* In the case of being invoked from the a.out compatibility ld.so, the stack
* has the appearance above but also several frames pushed by the compatibility
* routine. An "elf_boot" structure is available in %o1 on entry, which
* has been "pre-evaluated" to hold much of the information needed from the
* original stack frame -- we pass this directly into the main portion of the
* ld.so bootstrap.
*/
#if defined(lint)
extern unsigned long _setup();
extern void atexit_fini();
void
main()
{
(void) _setup();
atexit_fini();
}
#else
#include <sys/asm_linkage.h>
#include <link.h>
.seg ".text"
.align 4
ba,a _elf_start
! want to save -- the elf can be zeroed.
_elf_start:
clr %o0 ! 0 in %o0 == ELF
_aout_start: ! (falls through)
! skip it.
save %sp, -SA(MINFRAME + (EB_MAX * 8)), %sp
_alias_start:
1: ! PIC prologue
call 2f
sethi %hi(_GLOBAL_OFFSET_TABLE_ + (. - 1b)), %l7
2:
or %l7, %lo(_GLOBAL_OFFSET_TABLE_ + (. - 1b)), %l7
2:
1:
1:
retl ! compatibility return
#endif