Replace FSF snail mail address with URLs.
[glibc.git] / sysdeps / powerpc / powerpc32 / elf / start.S
blob4935e64976bbf1dd575584fac779d7eb7f64de75
1 /* Startup code for programs linked with GNU libc.
2    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2009, 2011
3    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 Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
11    In addition to the permissions in the GNU Lesser General Public
12    License, the Free Software Foundation gives you unlimited
13    permission to link the compiled version of this file with other
14    programs, and to distribute those programs without any restriction
15    coming from the use of this file. (The GNU Lesser General Public
16    License restrictions do apply in other respects; for example, they
17    cover modification of the file, and distribution when not linked
18    into another program.)
20    Note that people who make modified versions of this file are not
21    obligated to grant this special exception for their modified
22    versions; it is their choice whether to do so. The GNU Lesser
23    General Public License gives permission to release a modified
24    version without this exception; this exception also makes it
25    possible to release a modified version which carries forward this
26    exception.
28    The GNU C Library is distributed in the hope that it will be useful,
29    but WITHOUT ANY WARRANTY; without even the implied warranty of
30    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
31    Lesser General Public License for more details.
33    You should have received a copy of the GNU Lesser General Public
34    License along with the GNU C Library; if not, see
35    <http://www.gnu.org/licenses/>.  */
37 #include <sysdep.h>
38 #include "bp-sym.h"
40  /* These are the various addresses we require.  */
41 #ifdef PIC
42         .section ".data"
43 #else
44         .section ".rodata"
45 #endif
46         .align  2
47 L(start_addresses):
48         .long   _SDA_BASE_
49         .long   BP_SYM (main)
50         .long   __libc_csu_init
51         .long   __libc_csu_fini
52         ASM_SIZE_DIRECTIVE(L(start_addresses))
54         .section ".text"
55 ENTRY(_start)
56  /* Save the stack pointer, in case we're statically linked under Linux.  */
57         mr      r9,r1
58  /* Set up an initial stack frame, and clear the LR.  */
59         clrrwi  r1,r1,4
60 #ifdef PIC
61         SETUP_GOT_ACCESS(r13,got_label)
62         li      r0,0
63 #else
64         li      r0,0
65 #endif
66         stwu    r1,-16(r1)
67         mtlr    r0
68         stw     r0,0(r1)
69  /* Set r13 to point at the 'small data area', and put the address of
70     start_addresses in r8.  Also load the GOT pointer so that new PLT
71     calls work, like the one to __libc_start_main.  */
72 #ifdef PIC
73         addis   r30,r13,_GLOBAL_OFFSET_TABLE_-got_label@ha
74         addis   r8,r13,L(start_addresses)-got_label@ha
75         addi    r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@l
76         lwzu    r13, L(start_addresses)-got_label@l(r8)
77 #else
78         lis     r8,L(start_addresses)@ha
79         lwzu    r13,L(start_addresses)@l(r8)
80 #endif
81  /* and continue in libc-start, in glibc.  */
82         b       JUMPTARGET(BP_SYM (__libc_start_main))
83 END(_start)
85 /* Define a symbol for the first piece of initialized data.  */
86         .section ".data"
87         .globl  __data_start
88 __data_start:
89         .long   0
90 weak_alias (__data_start, data_start)