Replace FSF snail mail address with URLs.
[glibc.git] / sysdeps / powerpc / powerpc64 / elf / start.S
blobd9c92d139fbd26a4c7db22ec701926c8b5db9a23
1 /* Startup code for programs linked with GNU libc.  PowerPC64 version.
2    Copyright (C) 1998,1999,2000,2001,2002,2003,2009
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.rel.ro.local","aw"
43 #else
44         .section ".rodata"
45 #endif
46         .align  3
47 L(start_addresses):
48         .quad   0 /* was _SDA_BASE_  but not in 64-bit ABI*/
49 /*     function descriptors so don't need JUMPTARGET */
50         .quad   BP_SYM(main)
51         .quad   __libc_csu_init
52         .quad   __libc_csu_fini
54         ASM_SIZE_DIRECTIVE(L(start_addresses))
56         .section        ".toc","aw"
57 .L01:
58         .tc     L(start_addresses)[TC],L(start_addresses)
59         .section ".text"
60 ENTRY(_start)
61  /* Save the stack pointer, in case we're statically linked under Linux.  */
62         mr      r9,r1
63  /* Set up an initial stack frame, and clear the LR.  */
64         clrrdi  r1,r1,4
65         li      r0,0
66         stdu    r1,-128(r1)
67         mtlr    r0
68         std     r0,0(r1)
70  /* put the address of start_addresses in r8...  **
71 ** PPC64 ABI uses R13 for thread local, so we leave it alone */
72         ld      r8,.L01(r2)
74  /* and continue in libc-start, in glibc.  */
75         b       JUMPTARGET(BP_SYM(__libc_start_main))
76 /* The linker needs this nop to recognize that it's OK to call via a
77    TOC adjusting stub.  */
78         nop
80 END(_start)
82 /* Define a symbol for the first piece of initialized data.  */
83         .section ".data"
84         .globl  __data_start
85 __data_start:
86         .long   0
87 weak_alias (__data_start, data_start)