]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/glibc/glibc-cvs/eabi-patch-3
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / glibc / glibc-cvs / eabi-patch-3
1 From libc-alpha-return-17228-listarch-libc-alpha=sources dot redhat dot com at sources dot redhat dot com Tue Mar 22 16:08:31 2005
2 Return-Path: <libc-alpha-return-17228-listarch-libc-alpha=sources dot redhat dot com at sources dot redhat dot com>
3 Delivered-To: listarch-libc-alpha at sources dot redhat dot com
4 Received: (qmail 20972 invoked by alias); 22 Mar 2005 16:08:29 -0000
5 Mailing-List: contact libc-alpha-help at sources dot redhat dot com; run by ezmlm
6 Precedence: bulk
7 List-Subscribe: <mailto:libc-alpha-subscribe at sources dot redhat dot com>
8 List-Archive: <http://sources.redhat.com/ml/libc-alpha/>
9 List-Post: <mailto:libc-alpha at sources dot redhat dot com>
10 List-Help: <mailto:libc-alpha-help at sources dot redhat dot com>, <http://sources dot redhat dot com/ml/#faqs>
11 Sender: libc-alpha-owner at sources dot redhat dot com
12 Delivered-To: mailing list libc-alpha at sources dot redhat dot com
13 Received: (qmail 20165 invoked from network); 22 Mar 2005 16:08:06 -0000
14 Received: from unknown (HELO nevyn.them.org) (66.93.172.17)
15   by sourceware dot org with SMTP; 22 Mar 2005 16:08:06 -0000
16 Received: from drow by nevyn.them.org with local (Exim 4.50 #1 (Debian))
17         id 1DDlvX-0006tE-Bh; Tue, 22 Mar 2005 11:08:19 -0500
18 Date: Tue, 22 Mar 2005 11:08:19 -0500
19 From: Daniel Jacobowitz <drow at false dot org>
20 To: libc-alpha at sources dot redhat dot com
21 Cc: Phil Blundell <pb at reciva dot com>
22 Subject: ARM EABI support - changes to existing ARM code
23 Message-ID: <20050322160819.GA26216@nevyn.them.org>
24 Mail-Followup-To: libc-alpha at sources dot redhat dot com,
25         Phil Blundell <pb at reciva dot com>
26 Mime-Version: 1.0
27 Content-Type: text/plain; charset=us-ascii
28 Content-Disposition: inline
29 User-Agent: Mutt/1.5.6+20040907i
30
31 This patch updates the common ARM files for EABI support.  The changes are:
32   - Old ARM ABI targets always use FPA (mixed-endian) byte ordering.  EABI
33     targets always use VFP byte ordering for doubles, which is standard
34     ieee754 layout.  Removing the arm-specific ieee754.h doesn't break FPA;
35     it was a specialized version of the common header, which handles FPA
36     but also handles VFP.
37   - The stack needs to be aligned to eight bytes instead of just four,
38     including in mmap2 and when shifting _dl_argv.
39   - We need some markers around _start to indicate end-of-stack for the
40     unwinder - ARM EABI does not use either SJLJ exceptions or DWARF-2
41     exceptions.  It uses a table based format which seems to be not
42     quite completely unlike DWARF-2.
43
44 Do these changes look OK?
45
46 -- 
47 Daniel Jacobowitz
48 CodeSourcery, LLC
49
50 2005-03-22  Daniel Jacobowitz  <dan@codesourcery.com>
51
52         * sysdeps/arm/bits/endian.h (__FLOAT_WORD_ORDER): Handle VFP.
53         * sysdeps/arm/gmp-mparam.h (IEEE_DOUBLE_BIG_ENDIAN,
54         IEEE_DOUBLE_MIXED_ENDIAN): Handle big-endian and VFP.
55         * sysdeps/arm/ieee754.h: Remove.
56
57         * sysdeps/arm/dl-machine.h (_dl_start_user): Align the stack to eight
58         bytes even when shifting arguments.
59         * sysdeps/arm/dl-sysdep.h: New file.
60
61         * sysdeps/arm/elf/start.S (_start): If not using SJLJ exceptions, include
62         EABI unwind markers to terminate unwinding.
63
64         * sysdeps/unix/sysv/linux/arm/mmap64.S: Handle big-endian byte ordering
65         and EABI stack layout.
66
67 Index: glibc/sysdeps/arm/bits/endian.h
68 ===================================================================
69 --- glibc.orig/sysdeps/arm/bits/endian.h        2005-03-22 10:26:27.092978200 -0500
70 +++ glibc/sysdeps/arm/bits/endian.h     2005-03-22 10:27:39.457490903 -0500
71 @@ -9,4 +9,9 @@
72  #else
73  #define __BYTE_ORDER __LITTLE_ENDIAN
74  #endif
75 +
76 +#ifdef __VFP_FP__
77 +#define __FLOAT_WORD_ORDER __BYTE_ORDER
78 +#else
79  #define __FLOAT_WORD_ORDER __BIG_ENDIAN
80 +#endif
81 Index: glibc/sysdeps/arm/dl-machine.h
82 ===================================================================
83 --- glibc.orig/sysdeps/arm/dl-machine.h 2005-03-22 10:26:27.092978200 -0500
84 +++ glibc/sysdeps/arm/dl-machine.h      2005-03-22 10:27:39.457490903 -0500
85 @@ -156,22 +156,19 @@ _dl_start_user:\n\
86         add     sl, pc, sl\n\
87  .L_GOT_GOT:\n\
88         ldr     r4, [sl, r4]\n\
89 -       @ get the original arg count\n\
90 -       ldr     r1, [sp]\n\
91         @ save the entry point in another register\n\
92         mov     r6, r0\n\
93 -       @ adjust the stack pointer to skip the extra args\n\
94 -       add     sp, sp, r4, lsl #2\n\
95 -       @ subtract _dl_skip_args from original arg count\n\
96 -       sub     r1, r1, r4\n\
97 +       @ get the original arg count\n\
98 +       ldr     r1, [sp]\n\
99         @ get the argv address\n\
100         add     r2, sp, #4\n\
101 -       @ store the new argc in the new stack location\n\
102 -       str     r1, [sp]\n\
103 +       @ Fix up the stack if necessary.\n\
104 +       cmp     r4, #0\n\
105 +       bne     .L_fixup_stack\n\
106 +.L_done_fixup:\n\
107         @ compute envp\n\
108         add     r3, r2, r1, lsl #2\n\
109         add     r3, r3, #4\n\
110 -\n\
111         @ now we call _dl_init\n\
112         ldr     r0, .L_LOADED\n\
113         ldr     r0, [sl, r0]\n\
114 @@ -182,12 +179,45 @@ _dl_start_user:\n\
115         add     r0, sl, r0\n\
116         @ jump to the user_s entry point\n\
117         " BX(r6) "\n\
118 +\n\
119 +       @ iWMMXt and EABI targets require the stack to be eight byte\n\
120 +       @ aligned - shuffle arguments etc.\n\
121 +.L_fixup_stack:\n\
122 +       @ subtract _dl_skip_args from original arg count\n\
123 +       sub     r1, r1, r4\n\
124 +       @ store the new argc in the new stack location\n\
125 +       str     r1, [sp]\n\
126 +       @ find the first unskipped argument\n\
127 +       mov     r3, r2\n\
128 +       add     r4, r2, r4, lsl #2\n\
129 +       @ shuffle argv down\n\
130 +1:     ldr     r5, [r4], #4\n\
131 +       str     r5, [r3], #4\n\
132 +       cmp     r5, #0\n\
133 +       bne     1b\n\
134 +       @ shuffle envp down\n\
135 +1:     ldr     r5, [r4], #4\n\
136 +       str     r5, [r3], #4\n\
137 +       cmp     r5, #0\n\
138 +       bne     1b\n\
139 +       @ shuffle auxv down\n\
140 +1:     ldmia   r4!, {r0, r5}\n\
141 +       stmia   r3!, {r0, r5}\n\
142 +       cmp     r0, #0\n\
143 +       bne     1b\n\
144 +       @ Update _dl_argv\n\
145 +       ldr     r3, .L_ARGV\n\
146 +       str     r2, [sl, r3]\n\
147 +       b       .L_done_fixup\n\
148 +\n\
149  .L_GET_GOT:\n\
150         .word   _GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4\n\
151  .L_SKIP_ARGS:\n\
152         .word   _dl_skip_args(GOTOFF)\n\
153  .L_FINI_PROC:\n\
154         .word   _dl_fini(GOTOFF)\n\
155 +.L_ARGV:\n\
156 +       .word   _dl_argv(GOTOFF)\n\
157  .L_LOADED:\n\
158         .word   _rtld_local(GOTOFF)\n\
159  .previous\n\
160 Index: glibc/sysdeps/arm/dl-sysdep.h
161 ===================================================================
162 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
163 +++ glibc/sysdeps/arm/dl-sysdep.h       2005-03-22 10:27:39.458490675 -0500
164 @@ -0,0 +1,41 @@
165 +/* System-specific settings for dynamic linker code.  ARM version.
166 +   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
167 +   This file is part of the GNU C Library.
168 +
169 +   The GNU C Library is free software; you can redistribute it and/or
170 +   modify it under the terms of the GNU Lesser General Public
171 +   License as published by the Free Software Foundation; either
172 +   version 2.1 of the License, or (at your option) any later version.
173 +
174 +   The GNU C Library is distributed in the hope that it will be useful,
175 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
176 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
177 +   Lesser General Public License for more details.
178 +
179 +   You should have received a copy of the GNU Lesser General Public
180 +   License along with the GNU C Library; if not, write to the Free
181 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
182 +   02111-1307 USA.  */
183 +
184 +#ifndef _DL_SYSDEP_H
185 +#define _DL_SYSDEP_H   1
186 +
187 +/* This macro must be defined to either 0 or 1.
188 +
189 +   If 1, then an errno global variable hidden in ld.so will work right with
190 +   all the errno-using libc code compiled for ld.so, and there is never a
191 +   need to share the errno location with libc.  This is appropriate only if
192 +   all the libc functions that ld.so uses are called without PLT and always
193 +   get the versions linked into ld.so rather than the libc ones.  */
194 +
195 +#ifdef IS_IN_rtld
196 +# define RTLD_PRIVATE_ERRNO 1
197 +#else
198 +# define RTLD_PRIVATE_ERRNO 0
199 +#endif
200 +
201 +/* _dl_argv cannot be attribute_relro, because _dl_start_user
202 +   might write into it after _dl_start returns.  */
203 +#define DL_ARGV_NOT_RELRO 1
204 +
205 +#endif /* dl-sysdep.h */
206 Index: glibc/sysdeps/arm/elf/start.S
207 ===================================================================
208 --- glibc.orig/sysdeps/arm/elf/start.S  2005-03-22 10:26:27.096977288 -0500
209 +++ glibc/sysdeps/arm/elf/start.S       2005-03-22 11:00:35.178522707 -0500
210 @@ -1,5 +1,6 @@
211  /* Startup code for ARM & ELF
212 -   Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
213 +   Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002, 2005
214 +   Free Software Foundation, Inc.
215     This file is part of the GNU C Library.
216  
217     The GNU C Library is free software; you can redistribute it and/or
218 @@ -62,6 +63,10 @@
219         .globl _start
220         .type _start,#function
221  _start:
222 +#if !defined(__USING_SJLJ_EXCEPTIONS__)
223 +       /* Protect against unhandled exceptions.  */
224 +       .fnstart
225 +#endif
226         /* Fetch address of fini */
227         ldr ip, =__libc_csu_fini
228  
229 @@ -93,6 +98,11 @@ _start:
230         /* should never get here....*/
231         bl abort
232  
233 +#if !defined(__USING_SJLJ_EXCEPTIONS__)
234 +       .cantunwind
235 +       .fnend
236 +#endif
237 +
238  /* Define a symbol for the first piece of initialized data.  */
239         .data
240         .globl __data_start
241 Index: glibc/sysdeps/arm/gmp-mparam.h
242 ===================================================================
243 --- glibc.orig/sysdeps/arm/gmp-mparam.h 2005-03-22 10:26:27.092978200 -0500
244 +++ glibc/sysdeps/arm/gmp-mparam.h      2005-03-22 11:00:42.795683773 -0500
245 @@ -1,6 +1,6 @@
246  /* gmp-mparam.h -- Compiler/machine parameter header file.
247  
248 -Copyright (C) 1991, 1993, 1994, 1995 Free Software Foundation, Inc.
249 +Copyright (C) 1991, 1993, 1994, 1995, 2005 Free Software Foundation, Inc.
250  
251  This file is part of the GNU MP Library.
252  
253 @@ -26,5 +26,13 @@ MA 02111-1307, USA. */
254  #define BITS_PER_SHORTINT 16
255  #define BITS_PER_CHAR 8
256  
257 -#define IEEE_DOUBLE_BIG_ENDIAN 0
258 -#define IEEE_DOUBLE_MIXED_ENDIAN 1
259 +#if defined(__ARMEB__)
260 +# define IEEE_DOUBLE_MIXED_ENDIAN 0
261 +# define IEEE_DOUBLE_BIG_ENDIAN 1
262 +#elif defined(__VFP_FP__)
263 +# define IEEE_DOUBLE_MIXED_ENDIAN 0
264 +# define IEEE_DOUBLE_BIG_ENDIAN 0
265 +#else
266 +# define IEEE_DOUBLE_BIG_ENDIAN 0
267 +# define IEEE_DOUBLE_MIXED_ENDIAN 1
268 +#endif
269 Index: glibc/sysdeps/arm/ieee754.h
270 ===================================================================
271 --- glibc.orig/sysdeps/arm/ieee754.h    2005-03-22 10:26:27.092978200 -0500
272 +++ /dev/null   1970-01-01 00:00:00.000000000 +0000
273 @@ -1,115 +0,0 @@
274 -/* Copyright (C) 1992, 1995, 1996, 1998 Free Software Foundation, Inc.
275 -   This file is part of the GNU C Library.
276 -
277 -   The GNU C Library is free software; you can redistribute it and/or
278 -   modify it under the terms of the GNU Lesser General Public
279 -   License as published by the Free Software Foundation; either
280 -   version 2.1 of the License, or (at your option) any later version.
281 -
282 -   The GNU C Library is distributed in the hope that it will be useful,
283 -   but WITHOUT ANY WARRANTY; without even the implied warranty of
284 -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
285 -   Lesser General Public License for more details.
286 -
287 -   You should have received a copy of the GNU Lesser General Public
288 -   License along with the GNU C Library; if not, write to the Free
289 -   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
290 -   02111-1307 USA.  */
291 -
292 -#ifndef _IEEE754_H
293 -
294 -#define _IEEE754_H 1
295 -#include <features.h>
296 -
297 -#include <endian.h>
298 -
299 -__BEGIN_DECLS
300 -
301 -union ieee754_float
302 -  {
303 -    float f;
304 -
305 -    /* This is the IEEE 754 single-precision format.  */
306 -    struct
307 -      {
308 -       unsigned int mantissa:23;
309 -       unsigned int exponent:8;
310 -       unsigned int negative:1;
311 -      } ieee;
312 -
313 -    /* This format makes it easier to see if a NaN is a signalling NaN.  */
314 -    struct
315 -      {
316 -       unsigned int mantissa:22;
317 -       unsigned int quiet_nan:1;
318 -       unsigned int exponent:8;
319 -       unsigned int negative:1;
320 -      } ieee_nan;
321 -  };
322 -
323 -#define IEEE754_FLOAT_BIAS     0x7f /* Added to exponent.  */
324 -
325 -
326 -union ieee754_double
327 -  {
328 -    double d;
329 -
330 -    /* This is the IEEE 754 double-precision format.  */
331 -    struct
332 -      {
333 -       unsigned int mantissa0:20;
334 -       unsigned int exponent:11;
335 -       unsigned int negative:1;
336 -       unsigned int mantissa1:32;
337 -      } ieee;
338 -
339 -    /* This format makes it easier to see if a NaN is a signalling NaN.  */
340 -    struct
341 -      {
342 -       unsigned int mantissa0:19;
343 -       unsigned int quiet_nan:1;
344 -       unsigned int exponent:11;
345 -       unsigned int negative:1;
346 -       unsigned int mantissa1:32;
347 -      } ieee_nan;
348 -  };
349 -
350 -#define IEEE754_DOUBLE_BIAS    0x3ff /* Added to exponent.  */
351 -
352 -
353 -/* The following two structures are correct for `new' floating point systems but
354 -   wrong for the old FPPC.  The only solution seems to be to avoid their use on
355 -   old hardware.  */
356 -
357 -union ieee854_long_double
358 -  {
359 -    long double d;
360 -
361 -    /* This is the IEEE 854 double-extended-precision format.  */
362 -    struct
363 -      {
364 -       unsigned int exponent:15;
365 -       unsigned int empty:16;
366 -       unsigned int negative:1;
367 -       unsigned int mantissa1:32;
368 -       unsigned int mantissa0:32;
369 -      } ieee;
370 -
371 -    /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
372 -    struct
373 -      {
374 -       unsigned int exponent:15;
375 -       unsigned int empty:16;
376 -       unsigned int negative:1;
377 -       unsigned int mantissa1:32;
378 -       unsigned int mantissa0:30;
379 -       unsigned int quiet_nan:1;
380 -       unsigned int one:1;
381 -      } ieee_nan;
382 -  };
383 -
384 -#define IEEE854_LONG_DOUBLE_BIAS 0x3fff
385 -
386 -__END_DECLS
387 -
388 -#endif /* ieee754.h */
389 Index: glibc/sysdeps/unix/sysv/linux/arm/mmap64.S
390 ===================================================================
391 --- glibc.orig/sysdeps/unix/sysv/linux/arm/mmap64.S     2005-03-22 10:26:27.097977060 -0500
392 +++ glibc/sysdeps/unix/sysv/linux/arm/mmap64.S  2005-03-22 11:00:53.051209928 -0500
393 @@ -1,4 +1,4 @@
394 -/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
395 +/* Copyright (C) 2000, 2003, 2005 Free Software Foundation, Inc.
396     This file is part of the GNU C Library.
397  
398     The GNU C Library is free software; you can redistribute it and/or
399 @@ -23,13 +23,28 @@
400  
401  #include "kernel-features.h"
402  
403 +#ifdef __ARM_EABI__
404 +# define INITIAL_OFFSET 8
405 +#else
406 +# define INITIAL_OFFSET 4
407 +#endif
408 +
409 +#ifdef __ARMEB__
410 +# define LOW_OFFSET      INITIAL_OFFSET + 4
411 +/* The initial + 4 is for the stack postdecrement.  */
412 +# define HIGH_OFFSET 4 + INITIAL_OFFSET + 0
413 +#else
414 +# define LOW_OFFSET      INITIAL_OFFSET + 0
415 +# define HIGH_OFFSET 4 + INITIAL_OFFSET + 4
416 +#endif
417 +
418         /* The mmap2 system call takes six arguments, all in registers.  */
419         .text
420  ENTRY (__mmap64)
421  #ifdef __NR_mmap2
422 -       ldr     ip, [sp, $4]            @ offset low part
423 +       ldr     ip, [sp, $LOW_OFFSET]   @ offset low part
424         str     r5, [sp, #-4]!
425 -       ldr     r5, [sp, $12]           @ offset high part
426 +       ldr     r5, [sp, $HIGH_OFFSET]  @ offset high part
427         str     r4, [sp, #-4]!
428         movs    r4, ip, lsl $20         @ check that offset is page-aligned
429         mov     ip, ip, lsr $12
430