~ubuntu-branches/ubuntu/utopic/eglibc/utopic

« back to all changes in this revision

Viewing changes to ports/sysdeps/tile/elf/start.S

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-10-26 05:14:58 UTC
  • mfrom: (1.5.1) (4.4.22 experimental)
  • Revision ID: package-import@ubuntu.com-20121026051458-oryotr4i03ob5pab
Tags: 2.16-0ubuntu1
* Merge with unreleased 2.16 in Debian experimental, remaining changes:
  - Drop the Breaks line from libc6, which refers to a Debian transition
  - Remove the libc6 recommends on libc6-i686, which we don't build
  - Enable libc6{,-dev}-armel on armhf and libc6{-dev}-armhf on armel
  - Ship update-locale and validlocale in /usr/sbin in libc-bin
  - Don't build locales or locales-all in Ubuntu, we rely on langpacks
  - Heavily mangle the way we do service restarting on major upgrades
  - Use different MIN_KERNEL_SUPPORTED versions than Debian, due to
    buildd needs.  This should be universally bumped to 3.2.0 once all
    our buildds (including the PPA guests) are running precise kernels
  - Build i386 variants as -march=i686, build amd64 with -O3, and build
    ppc64 variants (both 64-bit and 32-bit) with -O3 -fno-tree-vectorize
  - Re-enable unsubmitted-ldconfig-cache-abi.diff and rebuild the cache
    on upgrades from previous versions that used a different constant
  - debian/patches/any/local-CVE-2012-3406.diff: switch to malloc when
    array grows too large to handle via alloca extension (CVE-2012-3406)
  - Build generic i386/i686 flavour with -mno-tls-direct-seg-refs
* Changes added/dropped with this merge while reducing our delta:
  - Stop building glibc docs from the eglibc source, and instead make
    the glibc-docs stub have a hard dependency on glibc-doc-reference
  - Remove outdated conflicts against ancient versions of ia32-libs
  - Drop the tzdata dependency from libc6, it's in required and minimal
  - Use gcc-4.7/g++-4.7 by default on all our supported architectures
  - Save our historical changelog as changelog.ubuntu in the source
  - Drop nscd's libaudit build-dep for now, as libaudit is in universe
  - Drop the unnecessary Breaks from libc6 to locales and locales-all
  - Ship xen's ld.so.conf.d snippet as /etc/ld.so.conf.d/libc6-xen.conf
* Disable hard failures on the test suite for the first upload to raring

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2011 Free Software Foundation, Inc.
2
 
   This file is part of the GNU C Library.
3
 
   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
4
 
 
5
 
   The GNU C Library is free software; you can redistribute it and/or
6
 
   modify it under the terms of the GNU Lesser General Public
7
 
   License as published by the Free Software Foundation; either
8
 
   version 2.1 of the License, or (at your option) any later version.
9
 
 
10
 
   In addition to the permissions in the GNU Lesser General Public
11
 
   License, the Free Software Foundation gives you unlimited
12
 
   permission to link the compiled version of this file with other
13
 
   programs, and to distribute those programs without any restriction
14
 
   coming from the use of this file. (The GNU Lesser General Public
15
 
   License restrictions do apply in other respects; for example, they
16
 
   cover modification of the file, and distribution when not linked
17
 
   into another program.)
18
 
 
19
 
   Note that people who make modified versions of this file are not
20
 
   obligated to grant this special exception for their modified
21
 
   versions; it is their choice whether to do so. The GNU Lesser
22
 
   General Public License gives permission to release a modified
23
 
   version without this exception; this exception also makes it
24
 
   possible to release a modified version which carries forward this
25
 
   exception.
26
 
 
27
 
   The GNU C Library is distributed in the hope that it will be useful,
28
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
29
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
30
 
   Lesser General Public License for more details.
31
 
 
32
 
   You should have received a copy of the GNU Lesser General Public
33
 
   License along with the GNU C Library; if not, write to the Free
34
 
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
35
 
   02111-1307 USA.  */
36
 
 
37
 
/* This is the canonical entry point, usually the first thing in the text
38
 
   segment.  The ELF standard tells us that the stack is set up like this on
39
 
   entry (the left side is the offset from "sp"), in units of
40
 
   __SIZEOF_POINTER__ entries:
41
 
 
42
 
                +0              argc
43
 
                +1              argv[0]
44
 
                ...
45
 
                +(argc+1)       NULL
46
 
                +(argc+2)       envp[0]
47
 
                ...
48
 
                                NULL
49
 
                ...             ElfInfo
50
 
 
51
 
   The ElfInfo is pairs of key/value long words following the envp
52
 
   pointers and terminated by a zero-valued key.
53
 
 
54
 
   Although not mandated by the standard, it happens to be the case
55
 
   that we store the actual argv and envp strings immediately after
56
 
   the ElfInfo data on the stack.
57
 
 
58
 
   On entry r0 points to the shared library termination function, or 0
59
 
   if there isn't one.
60
 
*/
61
 
 
62
 
#include <features.h>
63
 
#include <sysdep.h>
64
 
#include <arch/abi.h>
65
 
 
66
 
        .text
67
 
        .global _start
68
 
        .type   _start,@function
69
 
        .align 8
70
 
_start:
71
 
        /* Linux starts us with sp pointing at the conventional Elf layout,
72
 
           but we need to allow two "caller" words for our ABI convention.  */
73
 
        {
74
 
         /* Load argc (stored as a "long", equivalent to a pointer type). */
75
 
         LD_PTR r1, sp
76
 
 
77
 
         /* Save incoming 'sp', which points to the Elf argument block. */
78
 
         move r52, sp
79
 
        }
80
 
 
81
 
        {
82
 
         /* Allocate stack frame callee space for __libc_start_main. */
83
 
         ADDI_PTR r12, sp, -(2 * REGSIZE)
84
 
        }
85
 
 
86
 
        {
87
 
         /* Get our PC. */
88
 
         lnk r13
89
 
 
90
 
         /* sp is not necessarily properly aligned on startup because
91
 
            of the way ld.so pops off leading argv elements. So align it. */
92
 
         andi sp, r12, -8
93
 
        }
94
 
.Lmy_pc:
95
 
 
96
 
        {
97
 
         /* Pass the address of the shared library termination function. */
98
 
         move r5, r0
99
 
 
100
 
         /* Compute location where __libc_start_main's caller is supposed to
101
 
            store its frame pointer. */
102
 
         ADDI_PTR r12, sp, REGSIZE
103
 
 
104
 
         /* Zero out callee space for return address. Unnecessary but free.
105
 
            This is just paranoia to help backtracing not go awry. */
106
 
         ST sp, zero
107
 
        }
108
 
        {
109
 
         /* Zero out our frame pointer for __libc_start_main. */
110
 
         ST r12, zero
111
 
 
112
 
         /* Zero out lr to make __libc_start_main the end of backtrace.  */
113
 
         move lr, zero
114
 
 
115
 
         /* Compute a pointer to argv. envp will be determined
116
 
            later in __libc_start_main.  We set up the first argument
117
 
            (the address of main) below. */
118
 
         ADDI_PTR r2, r52, __SIZEOF_POINTER__
119
 
        }
120
 
        {
121
 
         /* Pass the highest stack address to user code. */
122
 
         ADDI_PTR r6, sp, (2 * REGSIZE)
123
 
 
124
 
         /* Pass address of main() in r0, and of our own entry
125
 
            points to .fini and .init in r3 and r4.  */
126
 
#ifdef __tilegx__
127
 
         moveli r0, hw2_last(main - .Lmy_pc)
128
 
        }
129
 
        {
130
 
         moveli r3, hw2_last(__libc_csu_init - .Lmy_pc)
131
 
         shl16insli r0, r0, hw1(main - .Lmy_pc)
132
 
        }
133
 
        {
134
 
         shl16insli r3, r3, hw1(__libc_csu_init - .Lmy_pc)
135
 
         shl16insli r0, r0, hw0(main - .Lmy_pc)
136
 
        }
137
 
        {
138
 
         shl16insli r3, r3, hw0(__libc_csu_init - .Lmy_pc)
139
 
         moveli r4, hw2_last(__libc_csu_fini - .Lmy_pc)
140
 
        }
141
 
        {
142
 
         ADD_PTR r0, r0, r13
143
 
         shl16insli r4, r4, hw1(__libc_csu_fini - .Lmy_pc)
144
 
        }
145
 
        {
146
 
         ADD_PTR r3, r3, r13
147
 
         shl16insli r4, r4, hw0(__libc_csu_fini - .Lmy_pc)
148
 
        }
149
 
        {
150
 
         ADD_PTR r4, r4, r13
151
 
#else
152
 
         addli r0, r13, lo16(main - .Lmy_pc)
153
 
        }
154
 
        {
155
 
         auli r0, r0, ha16(main - .Lmy_pc)
156
 
         addli r3, r13, lo16(__libc_csu_init - .Lmy_pc)
157
 
        }
158
 
        {
159
 
         auli r3, r3, ha16(__libc_csu_init - .Lmy_pc)
160
 
         addli r4, r13, lo16(__libc_csu_fini - .Lmy_pc)
161
 
        }
162
 
        {
163
 
         auli r4, r4, ha16(__libc_csu_fini - .Lmy_pc)
164
 
 
165
 
#endif
166
 
 
167
 
         /* Call the user's main function, and exit with its value.
168
 
            But let the libc call main. */
169
 
         j plt(__libc_start_main)
170
 
        }
171
 
        {
172
 
         /* Tell backtracer to give up (_start has no caller). */
173
 
         info INFO_OP_CANNOT_BACKTRACE
174
 
        }
175
 
.size _start, .-_start
176
 
 
177
 
/* Define a symbol for the first piece of initialized data.  */
178
 
        .data
179
 
        .global __data_start
180
 
        .align 8
181
 
__data_start:
182
 
        .long 0
183
 
        .weak data_start
184
 
        data_start = __data_start