13e76f9d6SRichard Lowe/* 23e76f9d6SRichard Lowe * CDDL HEADER START 33e76f9d6SRichard Lowe * 43e76f9d6SRichard Lowe * The contents of this file are subject to the terms of the 53e76f9d6SRichard Lowe * Common Development and Distribution License, Version 1.0 only 63e76f9d6SRichard Lowe * (the "License"). You may not use this file except in compliance 73e76f9d6SRichard Lowe * with the License. 83e76f9d6SRichard Lowe * 93e76f9d6SRichard Lowe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 103e76f9d6SRichard Lowe * or http://www.opensolaris.org/os/licensing. 113e76f9d6SRichard Lowe * See the License for the specific language governing permissions 123e76f9d6SRichard Lowe * and limitations under the License. 133e76f9d6SRichard Lowe * 143e76f9d6SRichard Lowe * When distributing Covered Code, include this CDDL HEADER in each 153e76f9d6SRichard Lowe * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 163e76f9d6SRichard Lowe * If applicable, add the following below this CDDL HEADER, with the 173e76f9d6SRichard Lowe * fields enclosed by brackets "[]" replaced with your own identifying 183e76f9d6SRichard Lowe * information: Portions Copyright [yyyy] [name of copyright owner] 193e76f9d6SRichard Lowe * 203e76f9d6SRichard Lowe * CDDL HEADER END 213e76f9d6SRichard Lowe */ 223e76f9d6SRichard Lowe/* 233e76f9d6SRichard Lowe * Copyright (c) 2001 by Sun Microsystems, Inc. 243e76f9d6SRichard Lowe * All rights reserved. 253e76f9d6SRichard Lowe */ 263e76f9d6SRichard Lowe/* 273e76f9d6SRichard Lowe * Copyright (c) 2013, Joyent, Inc. All rights reserved. 283e76f9d6SRichard Lowe */ 293e76f9d6SRichard Lowe 303e76f9d6SRichard Lowe/* 313e76f9d6SRichard Lowe * These crt*.o modules are provided as the bare minimum required 323e76f9d6SRichard Lowe * from a crt*.o for inclusion in building low level system 333e76f9d6SRichard Lowe * libraries. The are only be to included in libraries which 343e76f9d6SRichard Lowe * contain *no* C++ code and want to avoid the startup code 353e76f9d6SRichard Lowe * that the C++ runtime has introduced into the crt*.o modules. 363e76f9d6SRichard Lowe * 373e76f9d6SRichard Lowe * For further details - see bug#4433015 383e76f9d6SRichard Lowe */ 393e76f9d6SRichard Lowe 403e76f9d6SRichard Lowe .file "crti.s" 41*5e0a5eb7SRichard Lowe .ident "" 423e76f9d6SRichard Lowe 433e76f9d6SRichard Lowe/* 443e76f9d6SRichard Lowe * Note that when _init and _fini are called the stack needs to be 16-byte 453e76f9d6SRichard Lowe * aligned with a 4-byte bias. See comment in lib/libc/i386/gen/makectxt.c. 463e76f9d6SRichard Lowe * 473e76f9d6SRichard Lowe * Note: If you change it, you need to change it in the following files as 483e76f9d6SRichard Lowe * well: 493e76f9d6SRichard Lowe * 503e76f9d6SRichard Lowe * - lib/libc/i386/threads/machdep.c 513e76f9d6SRichard Lowe * - lib/libc/i386/gen/makectxt.c 523e76f9d6SRichard Lowe * - lib/crt/i386/mach-crt1.s 533e76f9d6SRichard Lowe */ 543e76f9d6SRichard Lowe 553e76f9d6SRichard Lowe/* 563e76f9d6SRichard Lowe * _init function prologue 573e76f9d6SRichard Lowe */ 583e76f9d6SRichard Lowe .section .init,"ax" 593e76f9d6SRichard Lowe .globl _init 603e76f9d6SRichard Lowe .type _init,@function 613e76f9d6SRichard Lowe .align 16 623e76f9d6SRichard Lowe_init: 633e76f9d6SRichard Lowe pushl %ebp 643e76f9d6SRichard Lowe movl %esp, %ebp 653e76f9d6SRichard Lowe andl $-16,%esp 663e76f9d6SRichard Lowe subl $12,%esp 673e76f9d6SRichard Lowe pushl %ebx 683e76f9d6SRichard Lowe call .L1 693e76f9d6SRichard Lowe.L1: popl %ebx 703e76f9d6SRichard Lowe addl $_GLOBAL_OFFSET_TABLE_+[.-.L1], %ebx 713e76f9d6SRichard Lowe 723e76f9d6SRichard Lowe/* 733e76f9d6SRichard Lowe * _fini function prologue 743e76f9d6SRichard Lowe */ 753e76f9d6SRichard Lowe .section .fini,"ax" 763e76f9d6SRichard Lowe .globl _fini 773e76f9d6SRichard Lowe .type _fini,@function 783e76f9d6SRichard Lowe .align 16 793e76f9d6SRichard Lowe_fini: 803e76f9d6SRichard Lowe pushl %ebp 813e76f9d6SRichard Lowe movl %esp, %ebp 823e76f9d6SRichard Lowe andl $-16,%esp 833e76f9d6SRichard Lowe subl $12,%esp 843e76f9d6SRichard Lowe pushl %ebx 853e76f9d6SRichard Lowe call .L2 863e76f9d6SRichard Lowe.L2: popl %ebx 873e76f9d6SRichard Lowe addl $_GLOBAL_OFFSET_TABLE_+[.-.L2], %ebx 88