aboutsummaryrefslogtreecommitdiffstats
path: root/packages/glibc/glibc-cvs/trampoline.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/glibc/glibc-cvs/trampoline.patch')
-rw-r--r--packages/glibc/glibc-cvs/trampoline.patch560
1 files changed, 560 insertions, 0 deletions
diff --git a/packages/glibc/glibc-cvs/trampoline.patch b/packages/glibc/glibc-cvs/trampoline.patch
index e69de29bb2..86cfc0a539 100644
--- a/packages/glibc/glibc-cvs/trampoline.patch
+++ b/packages/glibc/glibc-cvs/trampoline.patch
@@ -0,0 +1,560 @@
+From 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
+Return-Path: <libc-alpha-return-16890-listarch-libc-alpha=sources dot redhat dot com at sources dot redhat dot com>
+Delivered-To: listarch-libc-alpha at sources dot redhat dot com
+Received: (qmail 26073 invoked by alias); 19 Jan 2005 18:02:41 -0000
+Mailing-List: contact libc-alpha-help at sources dot redhat dot com; run by ezmlm
+Precedence: bulk
+List-Subscribe: <mailto:libc-alpha-subscribe at sources dot redhat dot com>
+List-Archive: <http://sources.redhat.com/ml/libc-alpha/>
+List-Post: <mailto:libc-alpha at sources dot redhat dot com>
+List-Help: <mailto:libc-alpha-help at sources dot redhat dot com>, <http://sources dot redhat dot com/ml/#faqs>
+Sender: libc-alpha-owner at sources dot redhat dot com
+Delivered-To: mailing list libc-alpha at sources dot redhat dot com
+Received: (qmail 25420 invoked from network); 19 Jan 2005 18:01:47 -0000
+Received: from unknown (HELO mail.codesourcery.com) (65.74.133.9)
+ by sourceware dot org with SMTP; 19 Jan 2005 18:01:47 -0000
+Received: (qmail 7456 invoked from network); 19 Jan 2005 18:01:44 -0000
+Received: from localhost (HELO ?192.168.0.100?) (mitchell@127.0.0.1)
+ by mail dot codesourcery dot com with SMTP; 19 Jan 2005 18:01:44 -0000
+Message-ID: <41EEA082.1020000@codesourcery.com>
+Date: Wed, 19 Jan 2005 10:01:38 -0800
+From: Mark Mitchell <mark at codesourcery dot com>
+Organization: CodeSourcery, LLC
+User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103)
+MIME-Version: 1.0
+To: Daniel Jacobowitz <drow at false dot org>
+CC: libc-alpha at sources dot redhat dot com
+Subject: Re: PATCH: ARM dl-trampoline.S
+References: <200501191631.j0JGVVRA002591@sirius.codesourcery.com> <20050119170217.GA3137@nevyn.them.org>
+In-Reply-To: <20050119170217 dot GA3137 at nevyn dot them dot org>
+Content-Type: multipart/mixed;
+ boundary="------------050601050507020101060100"
+
+This is a multi-part message in MIME format.
+--------------050601050507020101060100
+Content-Type: text/plain; charset=ISO-8859-1; format=flowed
+Content-Transfer-Encoding: 7bit
+
+Daniel Jacobowitz wrote:
+> On Wed, Jan 19, 2005 at 08:31:31AM -0800, Mark Mitchell wrote:
+>
+>>This patch updates the ARM port for the recent dl-trampoline.S and
+>>link.h changes. OK to apply?
+>
+>
+> Did you test this? I'm pretty sure that RESOLVE_MAP returns a link
+> map, unlike RESOLVE.
+
+No, I didn't test -- except by building glibc. (There are other
+problems at the moment, AFAICT, with actually running the library on ARM.)
+
+However, you're definitely correct -- good catch! -- and, in fact, in
+looking at my logs I see compiler warnings about the mismatched type
+assignment. Here is a more plausible version. How about this one?
+
+Thanks,
+
+--
+Mark Mitchell
+CodeSourcery, LLC
+mark@codesourcery.com
+(916) 791-8304
+
+--------------050601050507020101060100
+Content-Type: text/plain;
+ name="glibc.patch"
+Content-Transfer-Encoding: 7bit
+Content-Disposition: inline;
+ filename="glibc.patch"
+
+2005-01-19 Mark Mitchell <mark@codesourcery.com>
+
+ * elf/tst-auditmod1.c: Add ARM support.
+ * sysdeps/arm/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
+ Remove.
+ (RESOLVE): Do not use it; use ...
+ (RESOLVE_MAP): ... instead.
+ (ARCH_LA_PLTENTER): Define.
+ (ARCH_LA_PLTEXIT): Likewise.
+ (elf_machine_rel): Use RESOLVE_MAP, not RESOLVE.
+ (elf_machine_rela): Likewise.
+ * sysdeps/arm/dl-trampoline.S: New file.
+ * sysdeps/arm/bits/link.h: Likewise.
+ * sysdeps/generic/ldsodefs.h (struct La_arm_regs): Declare.
+ (struct audit_ifaces): Add ARM functions.
+
+Index: elf/tst-auditmod1.c
+===================================================================
+RCS file: /cvs/glibc/libc/elf/tst-auditmod1.c,v
+retrieving revision 1.7
+diff -c -5 -p -r1.7 tst-auditmod1.c
+*** elf/tst-auditmod1.c 16 Jan 2005 06:24:59 -0000 1.7
+--- elf/tst-auditmod1.c 19 Jan 2005 17:54:32 -0000
+*************** la_symbind64 (Elf64_Sym *sym, unsigned i
+*** 100,110 ****
+ symname, (long int) sym->st_value, ndx, *flags);
+
+ return sym->st_value;
+ }
+
+! #ifdef __i386__
+ # define pltenter la_i86_gnu_pltenter
+ # define pltexit la_i86_gnu_pltexit
+ # define La_regs La_i86_regs
+ # define La_retval La_i86_retval
+ # define int_retval lrv_eax
+--- 100,116 ----
+ symname, (long int) sym->st_value, ndx, *flags);
+
+ return sym->st_value;
+ }
+
+! #ifdef __arm__
+! # define pltenter la_arm_gnu_plteneter
+! # define pltext la_arm_gnu_pltexit
+! # define La_regs La_arm_regs
+! # define La_retval La_arm_retval
+! # define int_retval lvr_r0
+! #elif defined __i386__
+ # define pltenter la_i86_gnu_pltenter
+ # define pltexit la_i86_gnu_pltexit
+ # define La_regs La_i86_regs
+ # define La_retval La_i86_retval
+ # define int_retval lrv_eax
+Index: sysdeps/arm/dl-trampoline.S
+===================================================================
+RCS file: sysdeps/arm/dl-trampoline.S
+diff -N sysdeps/arm/dl-trampoline.S
+*** /dev/null 1 Jan 1970 00:00:00 -0000
+--- sysdeps/arm/dl-trampoline.S 19 Jan 2005 17:54:32 -0000
+***************
+*** 0 ****
+--- 1,135 ----
++ /* PLT trampolines. ARM version.
++ Copyright (C) 2005 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++ #include <sysdep.h>
++
++ #if defined(__USE_BX__)
++ #define BX(x) bx x
++ #else
++ #define BX(x) mov pc, x
++ #endif
++
++ #ifndef PROF
++ .text
++ .globl _dl_runtime_resolve
++ .type _dl_runtime_resolve, #function
++ .align 2
++ _dl_runtime_resolve:
++ @ we get called with
++ @ stack[0] contains the return address from this call
++ @ ip contains &GOT[n+3] (pointer to function)
++ @ lr points to &GOT[2]
++
++ @ stack arguments
++ stmdb sp!,{r0-r3}
++
++ @ get pointer to linker struct
++ ldr r0, [lr, #-4]
++
++ @ prepare to call _dl_fixup()
++ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
++ sub r1, ip, lr
++ sub r1, r1, #4
++ add r1, r1, r1
++
++ @ call fixup routine
++ bl _dl_fixup
++
++ @ save the return
++ mov ip, r0
++
++ @ get arguments and return address back
++ ldmia sp!, {r0-r3,lr}
++
++ @ jump to the newly found address
++ BX(ip)
++
++ .size _dl_runtime_resolve, .-_dl_runtime_resolve
++
++ .globl _dl_runtime_profile
++ .type _dl_runtime_profile, #function
++ .align 2
++ _dl_runtime_profile:
++ @ stack arguments
++ stmdb sp!, {r0-r3}
++
++ @ get pointer to linker struct
++ ldr r0, [lr, #-4]
++
++ @ prepare to call _dl_profile_fixup()
++ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
++ sub r1, ip, lr
++ sub r1, r1, #4
++ add r1, r1, r1
++
++ @ call profiling fixup routine
++ bl _dl_profile_fixup
++
++ @ save the return
++ mov ip, r0
++
++ @ get arguments and return address back
++ ldmia sp!, {r0-r3,lr}
++
++ @ jump to the newly found address
++ BX(ip)
++
++ .size _dl_runtime_resolve, .-_dl_runtime_resolve
++ .previous
++ #else
++ .text
++ .globl _dl_runtime_resolve
++ .globl _dl_runtime_profile
++ .type _dl_runtime_resolve, #function
++ .type _dl_runtime_profile, #function
++ .align 2
++ _dl_runtime_resolve:
++ _dl_runtime_profile:
++ @ we get called with
++ @ stack[0] contains the return address from this call
++ @ ip contains &GOT[n+3] (pointer to function)
++ @ lr points to &GOT[2]
++
++ @ stack arguments
++ stmdb sp!, {r0-r3}
++
++ @ get pointer to linker struct
++ ldr r0, [lr, #-4]
++
++ @ prepare to call _dl_fixup()
++ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
++ sub r1, ip, lr
++ sub r1, r1, #4
++ add r1, r1, r1
++
++ @ call profiling fixup routine
++ bl _dl_fixup
++
++ @ save the return
++ mov ip, r0
++
++ @ get arguments and return address back
++ ldmia sp!, {r0-r3,lr}
++
++ @ jump to the newly found address
++ BX(ip)
++
++ .size _dl_runtime_profile, .-_dl_runtime_profile
++ .previous
++ #endif
+Index: sysdeps/arm/bits/link.h
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/arm/bits/link.h,v
+retrieving revision 1.2
+diff -c -5 -p -r1.2 link.h
+*** sysdeps/arm/bits/link.h 6 Jan 2005 22:40:20 -0000 1.2
+--- sysdeps/arm/bits/link.h 19 Jan 2005 17:54:32 -0000
+***************
+*** 0 ****
+--- 1,57 ----
++ /* Copyright (C) 2005 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++ #ifndef _LINK_H
++ # error "Never include <bits/link.h> directly; use <link.h> instead."
++ #endif
++
++
++ /* Registers for entry into PLT on ARM. */
++ typedef struct La_arm_regs
++ {
++ uint32_t lvr_r0;
++ uint32_t lvr_r1;
++ uint32_t lvr_r2;
++ uint32_t lvr_r3;
++ } La_arm_regs;
++
++ /* Return values for calls from PLT on ARM. */
++ typedef struct La_arm_retval
++ {
++ uint32_t lvr_r0;
++ uint32_t lvr_r1;
++ } La_arm_retval;
++
++
++ __BEGIN_DECLS
++
++ extern Elf32_Addr la_arm_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx,
++ uintptr_t *__refcook,
++ uintptr_t *__defcook,
++ La_arm_regs *__regs,
++ unsigned int *__flags,
++ const char *__symname,
++ long int *__framesizep);
++ extern unsigned int la_arm_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx,
++ uintptr_t *__refcook,
++ uintptr_t *__defcook,
++ const La_arm_regs *__inregs,
++ La_arm_retval *__outregs,
++ const char *symname);
++
++ __END_DECLS
+Index: sysdeps/generic/ldsodefs.h
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/generic/ldsodefs.h,v
+retrieving revision 1.112
+diff -c -5 -p -r1.112 ldsodefs.h
+*** sysdeps/generic/ldsodefs.h 16 Jan 2005 02:07:29 -0000 1.112
+--- sysdeps/generic/ldsodefs.h 19 Jan 2005 17:54:32 -0000
+*************** enum allowmask
+*** 173,182 ****
+--- 173,183 ----
+ allow_ldso = 8
+ };
+
+
+ /* Type for list of auditing interfaces. */
++ struct La_arm_regs;
+ struct La_i86_regs;
+ struct La_i86_retval;
+ struct La_x86_64_regs;
+ struct La_x86_64_retval;
+ struct La_ppc32_regs;
+*************** struct audit_ifaces
+*** 202,211 ****
+--- 203,216 ----
+ uintptr_t (*symbind64) (Elf64_Sym *, unsigned int, uintptr_t *,
+ uintptr_t *, unsigned int *, const char *);
+ };
+ union
+ {
++ Elf32_Addr (*arm_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
++ uintptr_t *, struct La_arm_regs *,
++ unsigned int *, const char *name,
++ long int *framesizep);
+ Elf32_Addr (*i86_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
+ uintptr_t *, struct La_i86_regs *,
+ unsigned int *, const char *name,
+ long int *framesizep);
+ Elf64_Addr (*x86_64_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
+*************** struct audit_ifaces
+*** 229,238 ****
+--- 234,246 ----
+ unsigned int *, const char *name,
+ long int *framesizep);
+ };
+ union
+ {
++ unsigned int (*arm_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
++ uintptr_t *, const struct La_arm_regs *,
++ struct La_i86_retval *, const char *);
+ unsigned int (*i86_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
+ uintptr_t *, const struct La_i86_regs *,
+ struct La_i86_retval *, const char *);
+ unsigned int (*x86_64_gnu_pltexit) (Elf64_Sym *, unsigned int, uintptr_t *,
+ uintptr_t *,
+
+--------------050601050507020101060100--
+
+diff -u -r1.52 dl-machine.h
+--- sysdeps/arm/dl-machine.h 15 Mar 2005 22:57:26 -0000 1.52
++++ sysdeps/arm/dl-machine.h 22 Apr 2005 03:38:15 -0000
+@@ -129,119 +129,6 @@
+ #define BX(x) "mov\tpc, " #x
+ #endif
+
+-#ifndef PROF
+-# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
+- .text\n\
+- .globl _dl_runtime_resolve\n\
+- .type _dl_runtime_resolve, #function\n\
+- .align 2\n\
+-_dl_runtime_resolve:\n\
+- @ we get called with\n\
+- @ stack[0] contains the return address from this call\n\
+- @ ip contains &GOT[n+3] (pointer to function)\n\
+- @ lr points to &GOT[2]\n\
+-\n\
+- @ stack arguments\n\
+- stmdb sp!,{r0-r3}\n\
+-\n\
+- @ get pointer to linker struct\n\
+- ldr r0, [lr, #-4]\n\
+-\n\
+- @ prepare to call fixup()\n\
+- @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
+- sub r1, ip, lr\n\
+- sub r1, r1, #4\n\
+- add r1, r1, r1\n\
+-\n\
+- @ call fixup routine\n\
+- bl fixup\n\
+-\n\
+- @ save the return\n\
+- mov ip, r0\n\
+-\n\
+- @ get arguments and return address back\n\
+- ldmia sp!, {r0-r3,lr}\n\
+-\n\
+- @ jump to the newly found address\n\
+- " BX(ip) "\n\
+-\n\
+- .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
+-\n\
+- .globl _dl_runtime_profile\n\
+- .type _dl_runtime_profile, #function\n\
+- .align 2\n\
+-_dl_runtime_profile:\n\
+- @ stack arguments\n\
+- stmdb sp!, {r0-r3}\n\
+-\n\
+- @ get pointer to linker struct\n\
+- ldr r0, [lr, #-4]\n\
+-\n\
+- @ prepare to call fixup()\n\
+- @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
+- sub r1, ip, lr\n\
+- sub r1, r1, #4\n\
+- add r1, r1, r1\n\
+-\n\
+- @ call profiling fixup routine\n\
+- bl profile_fixup\n\
+-\n\
+- @ save the return\n\
+- mov ip, r0\n\
+-\n\
+- @ get arguments and return address back\n\
+- ldmia sp!, {r0-r3,lr}\n\
+-\n\
+- @ jump to the newly found address\n\
+- " BX(ip) "\n\
+-\n\
+- .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
+- .previous\n\
+-");
+-#else // PROF
+-# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
+- .text\n\
+- .globl _dl_runtime_resolve\n\
+- .globl _dl_runtime_profile\n\
+- .type _dl_runtime_resolve, #function\n\
+- .type _dl_runtime_profile, #function\n\
+- .align 2\n\
+-_dl_runtime_resolve:\n\
+-_dl_runtime_profile:\n\
+- @ we get called with\n\
+- @ stack[0] contains the return address from this call\n\
+- @ ip contains &GOT[n+3] (pointer to function)\n\
+- @ lr points to &GOT[2]\n\
+-\n\
+- @ stack arguments\n\
+- stmdb sp!, {r0-r3}\n\
+-\n\
+- @ get pointer to linker struct\n\
+- ldr r0, [lr, #-4]\n\
+-\n\
+- @ prepare to call fixup()\n\
+- @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
+- sub r1, ip, lr\n\
+- sub r1, r1, #4\n\
+- add r1, r1, r1\n\
+-\n\
+- @ call profiling fixup routine\n\
+- bl fixup\n\
+-\n\
+- @ save the return\n\
+- mov ip, r0\n\
+-\n\
+- @ get arguments and return address back\n\
+- ldmia sp!, {r0-r3,lr}\n\
+-\n\
+- @ jump to the newly found address\n\
+- " BX(ip) "\n\
+-\n\
+- .size _dl_runtime_profile, .-_dl_runtime_profile\n\
+- .previous\n\
+-");
+-#endif //PROF
+-
+ /* Mask identifying addresses reserved for the user program,
+ where the dynamic linker should not map anything. */
+ #define ELF_MACHINE_USER_ADDRESS_MASK 0xf8000000UL
+@@ -348,6 +235,10 @@
+ return value;
+ }
+
++/* Names of the architecture-specific auditing callback functions. */
++#define ARCH_LA_PLTENTER arm_gnu_pltenter
++#define ARCH_LA_PLTEXIT arm_gnu_pltexit
++
+ #endif /* !dl_machine_h */
+
+
+@@ -355,7 +246,7 @@
+ Prelinked libraries may use Elf32_Rela though. */
+ #define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
+
+-#ifdef RESOLVE
++#ifdef RESOLVE_MAP
+
+ /* Deal with an out-of-range PC24 reloc. */
+ static Elf32_Addr
+@@ -425,7 +316,8 @@
+ #endif
+ {
+ const Elf32_Sym *const refsym = sym;
+- Elf32_Addr value = RESOLVE (&sym, version, r_type);
++ struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
++ Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
+ if (sym)
+ value += sym->st_value;
+
+@@ -535,7 +427,8 @@
+ # ifndef RESOLVE_CONFLICT_FIND_MAP
+ const Elf32_Sym *const refsym = sym;
+ # endif
+- Elf32_Addr value = RESOLVE (&sym, version, r_type);
++ struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
++ Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
+ if (sym)
+ value += sym->st_value;
+
+@@ -637,4 +530,4 @@
+ _dl_reloc_bad_type (map, r_type, 1);
+ }
+
+-#endif /* RESOLVE */
++#endif /* RESOLVE_MAP */