summaryrefslogtreecommitdiffstats
path: root/meta/packages/glibc/glibc-cvs/trampoline.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/glibc/glibc-cvs/trampoline.patch')
-rw-r--r--meta/packages/glibc/glibc-cvs/trampoline.patch560
1 files changed, 560 insertions, 0 deletions
diff --git a/meta/packages/glibc/glibc-cvs/trampoline.patch b/meta/packages/glibc/glibc-cvs/trampoline.patch
new file mode 100644
index 0000000000..86cfc0a539
--- /dev/null
+++ b/meta/packages/glibc/glibc-cvs/trampoline.patch
@@ -0,0 +1,560 @@
1From libc-alpha-return-16890-listarch-libc-alpha=sources dot redhat dot com at sources dot redhat dot com Wed Jan 19 18:02:53 2005
2Return-Path: <libc-alpha-return-16890-listarch-libc-alpha=sources dot redhat dot com at sources dot redhat dot com>
3Delivered-To: listarch-libc-alpha at sources dot redhat dot com
4Received: (qmail 26073 invoked by alias); 19 Jan 2005 18:02:41 -0000
5Mailing-List: contact libc-alpha-help at sources dot redhat dot com; run by ezmlm
6Precedence: bulk
7List-Subscribe: <mailto:libc-alpha-subscribe at sources dot redhat dot com>
8List-Archive: <http://sources.redhat.com/ml/libc-alpha/>
9List-Post: <mailto:libc-alpha at sources dot redhat dot com>
10List-Help: <mailto:libc-alpha-help at sources dot redhat dot com>, <http://sources dot redhat dot com/ml/#faqs>
11Sender: libc-alpha-owner at sources dot redhat dot com
12Delivered-To: mailing list libc-alpha at sources dot redhat dot com
13Received: (qmail 25420 invoked from network); 19 Jan 2005 18:01:47 -0000
14Received: from unknown (HELO mail.codesourcery.com) (65.74.133.9)
15 by sourceware dot org with SMTP; 19 Jan 2005 18:01:47 -0000
16Received: (qmail 7456 invoked from network); 19 Jan 2005 18:01:44 -0000
17Received: from localhost (HELO ?192.168.0.100?) (mitchell@127.0.0.1)
18 by mail dot codesourcery dot com with SMTP; 19 Jan 2005 18:01:44 -0000
19Message-ID: <41EEA082.1020000@codesourcery.com>
20Date: Wed, 19 Jan 2005 10:01:38 -0800
21From: Mark Mitchell <mark at codesourcery dot com>
22Organization: CodeSourcery, LLC
23User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103)
24MIME-Version: 1.0
25To: Daniel Jacobowitz <drow at false dot org>
26CC: libc-alpha at sources dot redhat dot com
27Subject: Re: PATCH: ARM dl-trampoline.S
28References: <200501191631.j0JGVVRA002591@sirius.codesourcery.com> <20050119170217.GA3137@nevyn.them.org>
29In-Reply-To: <20050119170217 dot GA3137 at nevyn dot them dot org>
30Content-Type: multipart/mixed;
31 boundary="------------050601050507020101060100"
32
33This is a multi-part message in MIME format.
34--------------050601050507020101060100
35Content-Type: text/plain; charset=ISO-8859-1; format=flowed
36Content-Transfer-Encoding: 7bit
37
38Daniel Jacobowitz wrote:
39> On Wed, Jan 19, 2005 at 08:31:31AM -0800, Mark Mitchell wrote:
40>
41>>This patch updates the ARM port for the recent dl-trampoline.S and
42>>link.h changes. OK to apply?
43>
44>
45> Did you test this? I'm pretty sure that RESOLVE_MAP returns a link
46> map, unlike RESOLVE.
47
48No, I didn't test -- except by building glibc. (There are other
49problems at the moment, AFAICT, with actually running the library on ARM.)
50
51However, you're definitely correct -- good catch! -- and, in fact, in
52looking at my logs I see compiler warnings about the mismatched type
53assignment. Here is a more plausible version. How about this one?
54
55Thanks,
56
57--
58Mark Mitchell
59CodeSourcery, LLC
60mark@codesourcery.com
61(916) 791-8304
62
63--------------050601050507020101060100
64Content-Type: text/plain;
65 name="glibc.patch"
66Content-Transfer-Encoding: 7bit
67Content-Disposition: inline;
68 filename="glibc.patch"
69
702005-01-19 Mark Mitchell <mark@codesourcery.com>
71
72 * elf/tst-auditmod1.c: Add ARM support.
73 * sysdeps/arm/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
74 Remove.
75 (RESOLVE): Do not use it; use ...
76 (RESOLVE_MAP): ... instead.
77 (ARCH_LA_PLTENTER): Define.
78 (ARCH_LA_PLTEXIT): Likewise.
79 (elf_machine_rel): Use RESOLVE_MAP, not RESOLVE.
80 (elf_machine_rela): Likewise.
81 * sysdeps/arm/dl-trampoline.S: New file.
82 * sysdeps/arm/bits/link.h: Likewise.
83 * sysdeps/generic/ldsodefs.h (struct La_arm_regs): Declare.
84 (struct audit_ifaces): Add ARM functions.
85
86Index: elf/tst-auditmod1.c
87===================================================================
88RCS file: /cvs/glibc/libc/elf/tst-auditmod1.c,v
89retrieving revision 1.7
90diff -c -5 -p -r1.7 tst-auditmod1.c
91*** elf/tst-auditmod1.c 16 Jan 2005 06:24:59 -0000 1.7
92--- elf/tst-auditmod1.c 19 Jan 2005 17:54:32 -0000
93*************** la_symbind64 (Elf64_Sym *sym, unsigned i
94*** 100,110 ****
95 symname, (long int) sym->st_value, ndx, *flags);
96
97 return sym->st_value;
98 }
99
100! #ifdef __i386__
101 # define pltenter la_i86_gnu_pltenter
102 # define pltexit la_i86_gnu_pltexit
103 # define La_regs La_i86_regs
104 # define La_retval La_i86_retval
105 # define int_retval lrv_eax
106--- 100,116 ----
107 symname, (long int) sym->st_value, ndx, *flags);
108
109 return sym->st_value;
110 }
111
112! #ifdef __arm__
113! # define pltenter la_arm_gnu_plteneter
114! # define pltext la_arm_gnu_pltexit
115! # define La_regs La_arm_regs
116! # define La_retval La_arm_retval
117! # define int_retval lvr_r0
118! #elif defined __i386__
119 # define pltenter la_i86_gnu_pltenter
120 # define pltexit la_i86_gnu_pltexit
121 # define La_regs La_i86_regs
122 # define La_retval La_i86_retval
123 # define int_retval lrv_eax
124Index: sysdeps/arm/dl-trampoline.S
125===================================================================
126RCS file: sysdeps/arm/dl-trampoline.S
127diff -N sysdeps/arm/dl-trampoline.S
128*** /dev/null 1 Jan 1970 00:00:00 -0000
129--- sysdeps/arm/dl-trampoline.S 19 Jan 2005 17:54:32 -0000
130***************
131*** 0 ****
132--- 1,135 ----
133+ /* PLT trampolines. ARM version.
134+ Copyright (C) 2005 Free Software Foundation, Inc.
135+ This file is part of the GNU C Library.
136+
137+ The GNU C Library is free software; you can redistribute it and/or
138+ modify it under the terms of the GNU Lesser General Public
139+ License as published by the Free Software Foundation; either
140+ version 2.1 of the License, or (at your option) any later version.
141+
142+ The GNU C Library is distributed in the hope that it will be useful,
143+ but WITHOUT ANY WARRANTY; without even the implied warranty of
144+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
145+ Lesser General Public License for more details.
146+
147+ You should have received a copy of the GNU Lesser General Public
148+ License along with the GNU C Library; if not, write to the Free
149+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
150+ 02111-1307 USA. */
151+
152+ #include <sysdep.h>
153+
154+ #if defined(__USE_BX__)
155+ #define BX(x) bx x
156+ #else
157+ #define BX(x) mov pc, x
158+ #endif
159+
160+ #ifndef PROF
161+ .text
162+ .globl _dl_runtime_resolve
163+ .type _dl_runtime_resolve, #function
164+ .align 2
165+ _dl_runtime_resolve:
166+ @ we get called with
167+ @ stack[0] contains the return address from this call
168+ @ ip contains &GOT[n+3] (pointer to function)
169+ @ lr points to &GOT[2]
170+
171+ @ stack arguments
172+ stmdb sp!,{r0-r3}
173+
174+ @ get pointer to linker struct
175+ ldr r0, [lr, #-4]
176+
177+ @ prepare to call _dl_fixup()
178+ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
179+ sub r1, ip, lr
180+ sub r1, r1, #4
181+ add r1, r1, r1
182+
183+ @ call fixup routine
184+ bl _dl_fixup
185+
186+ @ save the return
187+ mov ip, r0
188+
189+ @ get arguments and return address back
190+ ldmia sp!, {r0-r3,lr}
191+
192+ @ jump to the newly found address
193+ BX(ip)
194+
195+ .size _dl_runtime_resolve, .-_dl_runtime_resolve
196+
197+ .globl _dl_runtime_profile
198+ .type _dl_runtime_profile, #function
199+ .align 2
200+ _dl_runtime_profile:
201+ @ stack arguments
202+ stmdb sp!, {r0-r3}
203+
204+ @ get pointer to linker struct
205+ ldr r0, [lr, #-4]
206+
207+ @ prepare to call _dl_profile_fixup()
208+ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
209+ sub r1, ip, lr
210+ sub r1, r1, #4
211+ add r1, r1, r1
212+
213+ @ call profiling fixup routine
214+ bl _dl_profile_fixup
215+
216+ @ save the return
217+ mov ip, r0
218+
219+ @ get arguments and return address back
220+ ldmia sp!, {r0-r3,lr}
221+
222+ @ jump to the newly found address
223+ BX(ip)
224+
225+ .size _dl_runtime_resolve, .-_dl_runtime_resolve
226+ .previous
227+ #else
228+ .text
229+ .globl _dl_runtime_resolve
230+ .globl _dl_runtime_profile
231+ .type _dl_runtime_resolve, #function
232+ .type _dl_runtime_profile, #function
233+ .align 2
234+ _dl_runtime_resolve:
235+ _dl_runtime_profile:
236+ @ we get called with
237+ @ stack[0] contains the return address from this call
238+ @ ip contains &GOT[n+3] (pointer to function)
239+ @ lr points to &GOT[2]
240+
241+ @ stack arguments
242+ stmdb sp!, {r0-r3}
243+
244+ @ get pointer to linker struct
245+ ldr r0, [lr, #-4]
246+
247+ @ prepare to call _dl_fixup()
248+ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
249+ sub r1, ip, lr
250+ sub r1, r1, #4
251+ add r1, r1, r1
252+
253+ @ call profiling fixup routine
254+ bl _dl_fixup
255+
256+ @ save the return
257+ mov ip, r0
258+
259+ @ get arguments and return address back
260+ ldmia sp!, {r0-r3,lr}
261+
262+ @ jump to the newly found address
263+ BX(ip)
264+
265+ .size _dl_runtime_profile, .-_dl_runtime_profile
266+ .previous
267+ #endif
268Index: sysdeps/arm/bits/link.h
269===================================================================
270RCS file: /cvs/glibc/libc/sysdeps/arm/bits/link.h,v
271retrieving revision 1.2
272diff -c -5 -p -r1.2 link.h
273*** sysdeps/arm/bits/link.h 6 Jan 2005 22:40:20 -0000 1.2
274--- sysdeps/arm/bits/link.h 19 Jan 2005 17:54:32 -0000
275***************
276*** 0 ****
277--- 1,57 ----
278+ /* Copyright (C) 2005 Free Software Foundation, Inc.
279+ This file is part of the GNU C Library.
280+
281+ The GNU C Library is free software; you can redistribute it and/or
282+ modify it under the terms of the GNU Lesser General Public
283+ License as published by the Free Software Foundation; either
284+ version 2.1 of the License, or (at your option) any later version.
285+
286+ The GNU C Library is distributed in the hope that it will be useful,
287+ but WITHOUT ANY WARRANTY; without even the implied warranty of
288+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
289+ Lesser General Public License for more details.
290+
291+ You should have received a copy of the GNU Lesser General Public
292+ License along with the GNU C Library; if not, write to the Free
293+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
294+ 02111-1307 USA. */
295+
296+ #ifndef _LINK_H
297+ # error "Never include <bits/link.h> directly; use <link.h> instead."
298+ #endif
299+
300+
301+ /* Registers for entry into PLT on ARM. */
302+ typedef struct La_arm_regs
303+ {
304+ uint32_t lvr_r0;
305+ uint32_t lvr_r1;
306+ uint32_t lvr_r2;
307+ uint32_t lvr_r3;
308+ } La_arm_regs;
309+
310+ /* Return values for calls from PLT on ARM. */
311+ typedef struct La_arm_retval
312+ {
313+ uint32_t lvr_r0;
314+ uint32_t lvr_r1;
315+ } La_arm_retval;
316+
317+
318+ __BEGIN_DECLS
319+
320+ extern Elf32_Addr la_arm_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx,
321+ uintptr_t *__refcook,
322+ uintptr_t *__defcook,
323+ La_arm_regs *__regs,
324+ unsigned int *__flags,
325+ const char *__symname,
326+ long int *__framesizep);
327+ extern unsigned int la_arm_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx,
328+ uintptr_t *__refcook,
329+ uintptr_t *__defcook,
330+ const La_arm_regs *__inregs,
331+ La_arm_retval *__outregs,
332+ const char *symname);
333+
334+ __END_DECLS
335Index: sysdeps/generic/ldsodefs.h
336===================================================================
337RCS file: /cvs/glibc/libc/sysdeps/generic/ldsodefs.h,v
338retrieving revision 1.112
339diff -c -5 -p -r1.112 ldsodefs.h
340*** sysdeps/generic/ldsodefs.h 16 Jan 2005 02:07:29 -0000 1.112
341--- sysdeps/generic/ldsodefs.h 19 Jan 2005 17:54:32 -0000
342*************** enum allowmask
343*** 173,182 ****
344--- 173,183 ----
345 allow_ldso = 8
346 };
347
348
349 /* Type for list of auditing interfaces. */
350+ struct La_arm_regs;
351 struct La_i86_regs;
352 struct La_i86_retval;
353 struct La_x86_64_regs;
354 struct La_x86_64_retval;
355 struct La_ppc32_regs;
356*************** struct audit_ifaces
357*** 202,211 ****
358--- 203,216 ----
359 uintptr_t (*symbind64) (Elf64_Sym *, unsigned int, uintptr_t *,
360 uintptr_t *, unsigned int *, const char *);
361 };
362 union
363 {
364+ Elf32_Addr (*arm_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
365+ uintptr_t *, struct La_arm_regs *,
366+ unsigned int *, const char *name,
367+ long int *framesizep);
368 Elf32_Addr (*i86_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
369 uintptr_t *, struct La_i86_regs *,
370 unsigned int *, const char *name,
371 long int *framesizep);
372 Elf64_Addr (*x86_64_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
373*************** struct audit_ifaces
374*** 229,238 ****
375--- 234,246 ----
376 unsigned int *, const char *name,
377 long int *framesizep);
378 };
379 union
380 {
381+ unsigned int (*arm_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
382+ uintptr_t *, const struct La_arm_regs *,
383+ struct La_i86_retval *, const char *);
384 unsigned int (*i86_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
385 uintptr_t *, const struct La_i86_regs *,
386 struct La_i86_retval *, const char *);
387 unsigned int (*x86_64_gnu_pltexit) (Elf64_Sym *, unsigned int, uintptr_t *,
388 uintptr_t *,
389
390--------------050601050507020101060100--
391
392diff -u -r1.52 dl-machine.h
393--- sysdeps/arm/dl-machine.h 15 Mar 2005 22:57:26 -0000 1.52
394+++ sysdeps/arm/dl-machine.h 22 Apr 2005 03:38:15 -0000
395@@ -129,119 +129,6 @@
396 #define BX(x) "mov\tpc, " #x
397 #endif
398
399-#ifndef PROF
400-# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
401- .text\n\
402- .globl _dl_runtime_resolve\n\
403- .type _dl_runtime_resolve, #function\n\
404- .align 2\n\
405-_dl_runtime_resolve:\n\
406- @ we get called with\n\
407- @ stack[0] contains the return address from this call\n\
408- @ ip contains &GOT[n+3] (pointer to function)\n\
409- @ lr points to &GOT[2]\n\
410-\n\
411- @ stack arguments\n\
412- stmdb sp!,{r0-r3}\n\
413-\n\
414- @ get pointer to linker struct\n\
415- ldr r0, [lr, #-4]\n\
416-\n\
417- @ prepare to call fixup()\n\
418- @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
419- sub r1, ip, lr\n\
420- sub r1, r1, #4\n\
421- add r1, r1, r1\n\
422-\n\
423- @ call fixup routine\n\
424- bl fixup\n\
425-\n\
426- @ save the return\n\
427- mov ip, r0\n\
428-\n\
429- @ get arguments and return address back\n\
430- ldmia sp!, {r0-r3,lr}\n\
431-\n\
432- @ jump to the newly found address\n\
433- " BX(ip) "\n\
434-\n\
435- .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
436-\n\
437- .globl _dl_runtime_profile\n\
438- .type _dl_runtime_profile, #function\n\
439- .align 2\n\
440-_dl_runtime_profile:\n\
441- @ stack arguments\n\
442- stmdb sp!, {r0-r3}\n\
443-\n\
444- @ get pointer to linker struct\n\
445- ldr r0, [lr, #-4]\n\
446-\n\
447- @ prepare to call fixup()\n\
448- @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
449- sub r1, ip, lr\n\
450- sub r1, r1, #4\n\
451- add r1, r1, r1\n\
452-\n\
453- @ call profiling fixup routine\n\
454- bl profile_fixup\n\
455-\n\
456- @ save the return\n\
457- mov ip, r0\n\
458-\n\
459- @ get arguments and return address back\n\
460- ldmia sp!, {r0-r3,lr}\n\
461-\n\
462- @ jump to the newly found address\n\
463- " BX(ip) "\n\
464-\n\
465- .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
466- .previous\n\
467-");
468-#else // PROF
469-# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
470- .text\n\
471- .globl _dl_runtime_resolve\n\
472- .globl _dl_runtime_profile\n\
473- .type _dl_runtime_resolve, #function\n\
474- .type _dl_runtime_profile, #function\n\
475- .align 2\n\
476-_dl_runtime_resolve:\n\
477-_dl_runtime_profile:\n\
478- @ we get called with\n\
479- @ stack[0] contains the return address from this call\n\
480- @ ip contains &GOT[n+3] (pointer to function)\n\
481- @ lr points to &GOT[2]\n\
482-\n\
483- @ stack arguments\n\
484- stmdb sp!, {r0-r3}\n\
485-\n\
486- @ get pointer to linker struct\n\
487- ldr r0, [lr, #-4]\n\
488-\n\
489- @ prepare to call fixup()\n\
490- @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
491- sub r1, ip, lr\n\
492- sub r1, r1, #4\n\
493- add r1, r1, r1\n\
494-\n\
495- @ call profiling fixup routine\n\
496- bl fixup\n\
497-\n\
498- @ save the return\n\
499- mov ip, r0\n\
500-\n\
501- @ get arguments and return address back\n\
502- ldmia sp!, {r0-r3,lr}\n\
503-\n\
504- @ jump to the newly found address\n\
505- " BX(ip) "\n\
506-\n\
507- .size _dl_runtime_profile, .-_dl_runtime_profile\n\
508- .previous\n\
509-");
510-#endif //PROF
511-
512 /* Mask identifying addresses reserved for the user program,
513 where the dynamic linker should not map anything. */
514 #define ELF_MACHINE_USER_ADDRESS_MASK 0xf8000000UL
515@@ -348,6 +235,10 @@
516 return value;
517 }
518
519+/* Names of the architecture-specific auditing callback functions. */
520+#define ARCH_LA_PLTENTER arm_gnu_pltenter
521+#define ARCH_LA_PLTEXIT arm_gnu_pltexit
522+
523 #endif /* !dl_machine_h */
524
525
526@@ -355,7 +246,7 @@
527 Prelinked libraries may use Elf32_Rela though. */
528 #define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
529
530-#ifdef RESOLVE
531+#ifdef RESOLVE_MAP
532
533 /* Deal with an out-of-range PC24 reloc. */
534 static Elf32_Addr
535@@ -425,7 +316,8 @@
536 #endif
537 {
538 const Elf32_Sym *const refsym = sym;
539- Elf32_Addr value = RESOLVE (&sym, version, r_type);
540+ struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
541+ Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
542 if (sym)
543 value += sym->st_value;
544
545@@ -535,7 +427,8 @@
546 # ifndef RESOLVE_CONFLICT_FIND_MAP
547 const Elf32_Sym *const refsym = sym;
548 # endif
549- Elf32_Addr value = RESOLVE (&sym, version, r_type);
550+ struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
551+ Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
552 if (sym)
553 value += sym->st_value;
554
555@@ -637,4 +530,4 @@
556 _dl_reloc_bad_type (map, r_type, 1);
557 }
558
559-#endif /* RESOLVE */
560+#endif /* RESOLVE_MAP */