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
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>
27 Content-Type: text/plain; charset=us-ascii
28 Content-Disposition: inline
29 User-Agent: Mutt/1.5.6+20040907i
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
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.
44 Do these changes look OK?
50 2005-03-22 Daniel Jacobowitz <dan@codesourcery.com>
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.
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.
61 * sysdeps/arm/elf/start.S (_start): If not using SJLJ exceptions, include
62 EABI unwind markers to terminate unwinding.
64 * sysdeps/unix/sysv/linux/arm/mmap64.S: Handle big-endian byte ordering
65 and EABI stack layout.
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
73 #define __BYTE_ORDER __LITTLE_ENDIAN
77 +#define __FLOAT_WORD_ORDER __BYTE_ORDER
79 #define __FLOAT_WORD_ORDER __BIG_ENDIAN
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\
89 - @ get the original arg count\n\
91 @ save the entry point in another register\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\
97 + @ get the original arg count\n\
99 @ get the argv address\n\
101 - @ store the new argc in the new stack location\n\
103 + @ Fix up the stack if necessary.\n\
105 + bne .L_fixup_stack\n\
108 add r3, r2, r1, lsl #2\n\
111 @ now we call _dl_init\n\
114 @@ -182,12 +179,45 @@ _dl_start_user:\n\
116 @ jump to the user_s entry point\n\
119 + @ iWMMXt and EABI targets require the stack to be eight byte\n\
120 + @ aligned - shuffle arguments etc.\n\
122 + @ subtract _dl_skip_args from original arg count\n\
124 + @ store the new argc in the new stack location\n\
126 + @ find the first unskipped argument\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\
134 + @ shuffle envp down\n\
135 +1: ldr r5, [r4], #4\n\
136 + str r5, [r3], #4\n\
139 + @ shuffle auxv down\n\
140 +1: ldmia r4!, {r0, r5}\n\
141 + stmia r3!, {r0, r5}\n\
144 + @ Update _dl_argv\n\
146 + str r2, [sl, r3]\n\
150 .word _GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4\n\
152 .word _dl_skip_args(GOTOFF)\n\
154 .word _dl_fini(GOTOFF)\n\
156 + .word _dl_argv(GOTOFF)\n\
158 .word _rtld_local(GOTOFF)\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
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.
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.
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.
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
184 +#ifndef _DL_SYSDEP_H
185 +#define _DL_SYSDEP_H 1
187 +/* This macro must be defined to either 0 or 1.
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. */
196 +# define RTLD_PRIVATE_ERRNO 1
198 +# define RTLD_PRIVATE_ERRNO 0
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
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
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.
217 The GNU C Library is free software; you can redistribute it and/or
220 .type _start,#function
222 +#if !defined(__USING_SJLJ_EXCEPTIONS__)
223 + /* Protect against unhandled exceptions. */
226 /* Fetch address of fini */
227 ldr ip, =__libc_csu_fini
229 @@ -93,6 +98,11 @@ _start:
230 /* should never get here....*/
233 +#if !defined(__USING_SJLJ_EXCEPTIONS__)
238 /* Define a symbol for the first piece of initialized data. */
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
246 /* gmp-mparam.h -- Compiler/machine parameter header file.
248 -Copyright (C) 1991, 1993, 1994, 1995 Free Software Foundation, Inc.
249 +Copyright (C) 1991, 1993, 1994, 1995, 2005 Free Software Foundation, Inc.
251 This file is part of the GNU MP Library.
253 @@ -26,5 +26,13 @@ MA 02111-1307, USA. */
254 #define BITS_PER_SHORTINT 16
255 #define BITS_PER_CHAR 8
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
266 +# define IEEE_DOUBLE_BIG_ENDIAN 0
267 +# define IEEE_DOUBLE_MIXED_ENDIAN 1
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
274 -/* Copyright (C) 1992, 1995, 1996, 1998 Free Software Foundation, Inc.
275 - This file is part of the GNU C Library.
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.
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.
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
294 -#define _IEEE754_H 1
295 -#include <features.h>
305 - /* This is the IEEE 754 single-precision format. */
308 - unsigned int mantissa:23;
309 - unsigned int exponent:8;
310 - unsigned int negative:1;
313 - /* This format makes it easier to see if a NaN is a signalling NaN. */
316 - unsigned int mantissa:22;
317 - unsigned int quiet_nan:1;
318 - unsigned int exponent:8;
319 - unsigned int negative:1;
323 -#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */
326 -union ieee754_double
330 - /* This is the IEEE 754 double-precision format. */
333 - unsigned int mantissa0:20;
334 - unsigned int exponent:11;
335 - unsigned int negative:1;
336 - unsigned int mantissa1:32;
339 - /* This format makes it easier to see if a NaN is a signalling NaN. */
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;
350 -#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
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
357 -union ieee854_long_double
361 - /* This is the IEEE 854 double-extended-precision format. */
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;
371 - /* This is for NaNs in the IEEE 854 double-extended-precision format. */
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;
384 -#define IEEE854_LONG_DOUBLE_BIAS 0x3fff
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
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.
398 The GNU C Library is free software; you can redistribute it and/or
401 #include "kernel-features.h"
404 +# define INITIAL_OFFSET 8
406 +# define INITIAL_OFFSET 4
410 +# define LOW_OFFSET INITIAL_OFFSET + 4
411 +/* The initial + 4 is for the stack postdecrement. */
412 +# define HIGH_OFFSET 4 + INITIAL_OFFSET + 0
414 +# define LOW_OFFSET INITIAL_OFFSET + 0
415 +# define HIGH_OFFSET 4 + INITIAL_OFFSET + 4
418 /* The mmap2 system call takes six arguments, all in registers. */
422 - ldr ip, [sp, $4] @ offset low part
423 + ldr ip, [sp, $LOW_OFFSET] @ offset low part
425 - ldr r5, [sp, $12] @ offset high part
426 + ldr r5, [sp, $HIGH_OFFSET] @ offset high part
428 movs r4, ip, lsl $20 @ check that offset is page-aligned