crt1.s revision ebe15f48e9897d68d978938414a5c16cb0ceb049
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This crt1.o module is provided as the bare minimum required to build
* where it will be picked up by gcc, along with crti.o and crtn.o
*/
/* global entities defined elsewhere but used here */
.align 4
.align 8
.zero 24
.align 4
.align 4
/*
* C language startup routine.
* Assume that exec code has cleared the direction flag in the TSS.
* Assume that %esp is set to the addr after the last word pushed.
* The stack contains (in order): argc, argv[],envp[],...
* Assume that all of the segment registers are initialized.
*
* Allocate a NULL return address and a NULL previous %ebp as if
* there was a genuine call to _start.
* sdb stack trace shows _start(argc,argv[0],argv[1],...,envp[0],...)
*/
pushl $0
pushl $0
jz 1f
1:
/*
* The following code provides almost standard static destructor handling
* for systems that do not have the modified atexit processing in their
* system libraries. It checks for the existence of the new routine
* "_get_exit_frame_monitor()", which is in libc.so when the new exit-handling
* code is there. It then check for the existence of "__Crun::do_exit_code()"
* which will be in libCrun.so whenever the code was linked with the C++
* compiler. If there is no enhanced atexit, and we do have do_exit_code,
* we register the latter with atexit. There are 5 extra slots in
* atexit, so this will still be standard conforming. Since the code
* is registered after the .fini section, it runs before the library
* cleanup code, leaving nothing for the calls to _do_exit_code_in_range
* to handle.
*
* Remove this code and the associated code in libCrun when the earliest
* system to be supported is Solaris 8.
*/
.align 4
.align 4
jz 1f
jz 1f
1:
/*
* End of destructor handling code
*/
/*
* Calculate the location of the envp array by adding the size of
* the argv array to the start of the argv array.
*/
1:
#include "fsr.s"
/*
* The following is here in case any object module compiled with cc -p
* was linked into this module.
*/
.align 4
.align 4