Wed Sep 20 18:02:03 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[glibc.git] / sysdeps / unix / sysv / linux / i386 / init-first.S
blob3c0c185fb7222ee6f39ccc37469a7e184d2b4099
1 /* Initialization code run first thing by the ELF startup code.
2    For i386/Linux.
3 Copyright (C) 1995 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB.  If
18 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
21 #include <sysdep.h>
23         .text
25         /* Called from start.S.  Not: there is no value in %ebx.  */
27 ENTRY (__libc_init_first)
29         /* Make sure we are not using iBSC2 personality.  */
30         movl $SYS_ify (personality), %eax
31         xorl %ebx, %ebx
32         int $0x80
34 #ifdef PIC
35         /* Set control work of FPU.  */
36         call .L0
37 .L0:    popl %ebx
38         addl $_GLOBAL_OFFSET_TABLE_+[.-.L0], %ebx
39         movzwl C_SYMBOL_NAME(___fpu_control@GOT)(%ebx), %eax
40 #else
41         movzwl ___fpu_control, %eax
42 #endif
43         pushl %eax
44         call JUMPTARGET(__setfpucw)
45         addl $4, %esp
47         /* That is all for now.  */
48         ret
51         /* This is only a dummy function for the list below.  */
52         .type _dummy_exit, @function
53 C_LABEL(_dummy_exit)
54         ret
57         .section .init,"ax",@progbits
58         movl 16(%ebp), %edx     /* envp */
59         movl 12(%ebp), %ecx     /* argv */
60         movl 8(%ebp), %eax      /* argc */
61         pushl %edx
62         pushl %ecx
63         pushl %eax
65         call JUMPTARGET(__libc_init)
67         addl $12, %esp
70         /* Make sure __libc_subinit section is always present.  */
71         .section __libc_subinit, "a", @progbits
72         .align 4
73         .type __elf_set___libc_subinit_element__dummy_exit__, @object
74         .size __elf_set___libc_subinit_element__dummy_exit__, 4
75 __elf_set___libc_subinit_element__dummy_exit__:
76         .long _dummy_exit
78         /* Make sure __libc_atexit section is always present.  */
79         .section __libc_atexit, "a", @progbits
80         .align 4
81         .type __elf_set___libc_atexit_element__dummy_exit__, @object
82         .size __elf_set___libc_atexit_element__dummy_exit__, 4
83 __elf_set___libc_atexit_element__dummy_exit__:
84         .long _dummy_exit