This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix LD_BIND_NOT and LD_PROFILE on ia64


Ulrich Drepper <drepper@redhat.com> writes:

> That branch is completely irrelevant when it comes to patches.  You are
> not getting anything ever on that branch unless it has been proved in the
> trunk.

The trunk is useless until the audit stuff has been implemented.  I have
only a patch for an incomplete implementation, maybe someone with more
knowledge about the IA64 ABI can complete it.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Index: elf/dl-runtime.c
===================================================================
RCS file: /cvs/glibc/libc/elf/dl-runtime.c,v
retrieving revision 1.67
diff -u -a -p -r1.67 dl-runtime.c
--- elf/dl-runtime.c	9 Jan 2005 20:22:48 -0000	1.67
+++ elf/dl-runtime.c	21 Jan 2005 14:41:33 -0000
@@ -52,7 +52,7 @@
    function.  */
 
 #ifndef ELF_MACHINE_NO_PLT
-ElfW(Addr)
+DL_FIXUP_VALUE_TYPE
 __attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
 _dl_fixup (
 # ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
@@ -71,7 +71,7 @@ _dl_fixup (
   const ElfW(Sym) *sym = &symtab[ELFW(R_SYM) (reloc->r_info)];
   void *const rel_addr = (void *)(l->l_addr + reloc->r_offset);
   lookup_t result;
-  ElfW(Addr) value;
+  DL_FIXUP_VALUE_TYPE value;
 
   /* Sanity check that we're really looking at a PLT relocation.  */
   assert (ELFW(R_TYPE)(reloc->r_info) == ELF_MACHINE_JMP_SLOT);
@@ -99,13 +99,14 @@ _dl_fixup (
       /* Currently result contains the base load address (or link map)
 	 of the object that defines sym.  Now add in the symbol
 	 offset.  */
-      value = (sym ? LOOKUP_VALUE_ADDRESS (result) + sym->st_value : 0);
+      value = DL_FIXUP_MAKE_VALUE (sym ? (LOOKUP_VALUE_ADDRESS (result)
+					  + sym->st_value) : 0, result);
     }
   else
     {
       /* We already found the symbol.  The module (and therefore its load
 	 address) is also known.  */
-      value = l->l_addr + sym->st_value;
+      value = DL_FIXUP_MAKE_VALUE (l->l_addr + sym->st_value, l);
       result = l;
     }
 
@@ -122,7 +123,7 @@ _dl_fixup (
 
 #if !defined PROF && !defined ELF_MACHINE_NO_PLT && !__BOUNDED_POINTERS__
 
-ElfW(Addr)
+DL_FIXUP_VALUE_TYPE
 __attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
 _dl_profile_fixup (
 #ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
@@ -137,10 +138,10 @@ _dl_profile_fixup (
      relocations.  */
   struct reloc_result *reloc_result
     = &l->l_reloc_result[reloc_offset / sizeof (PLTREL)];
-  ElfW(Addr) *resultp = &reloc_result->addr;
+  DL_FIXUP_VALUE_TYPE *resultp = &reloc_result->addr;
 
-  ElfW(Addr) value = *resultp;
-  if (value == 0)
+  DL_FIXUP_VALUE_TYPE value = *resultp;
+  if (DL_FIXUP_VALUE_CODE_ADDR (value) == 0)
     {
       /* This is the first time we have to relocate this object.  */
       const ElfW(Sym) *const symtab
@@ -180,14 +181,15 @@ _dl_profile_fixup (
 	  /* Currently result contains the base load address (or link map)
 	     of the object that defines sym.  Now add in the symbol
 	     offset.  */
-	  value = (defsym != NULL
-		   ? LOOKUP_VALUE_ADDRESS (result) + defsym->st_value : 0);
+	  value = DL_FIXUP_MAKE_VALUE (defsym != NULL
+				       ? (LOOKUP_VALUE_ADDRESS (result)
+					  + defsym->st_value) : 0, result);
 	}
       else
 	{
 	  /* We already found the symbol.  The module (and therefore its load
 	     address) is also known.  */
-	  value = l->l_addr + refsym->st_value;
+	  value = DL_FIXUP_MAKE_VALUE (l->l_addr + refsym->st_value, l);
 	  result = l;
 	}
       /* And now perhaps the relocation addend.  */
@@ -215,7 +217,7 @@ _dl_profile_fixup (
 	      /* Synthesize a symbol record where the st_value field is
 		 the result.  */
 	      ElfW(Sym) sym = *defsym;
-	      sym.st_value = value;
+	      sym.st_value = DL_FIXUP_VALUE_CODE_ADDR (value);
 
 	      /* Keep track whether there is any interest in tracing
 		 the call in the lower two bits.  */
@@ -268,7 +270,7 @@ _dl_profile_fixup (
 		}
 
 	      reloc_result->flags = altvalue;
-	      value = sym.st_value;
+	      DL_FIXUP_VALUE_SET_CODE_ADDR (value, sym.st_value);
 	    }
 	  else
 	    /* Set all bits since this symbol binding is not interesting.  */
@@ -287,7 +289,7 @@ _dl_profile_fixup (
 #ifdef SHARED
   /* Auditing checkpoint: report the PLT entering and allow the
      auditors to change the value.  */
-  if (value != 0 && GLRO(dl_naudit) > 0
+  if (DL_FIXUP_VALUE_CODE_ADDR (value) != 0 && GLRO(dl_naudit) > 0
       /* Don't do anything if no auditor wants to intercept this call.  */
       && (reloc_result->enterexit & LA_SYMB_NOPLTENTER) == 0)
     {
@@ -297,7 +299,7 @@ _dl_profile_fixup (
 
       /* Set up the sym parameter.  */
       ElfW(Sym) sym = *defsym;
-      sym.st_value = value;
+      sym.st_value = DL_FIXUP_VALUE_CODE_ADDR (value);
 
       /* Get the symbol name.  */
       const char *strtab = (const void *) D_PTR (reloc_result->bound,
@@ -352,14 +354,14 @@ _dl_profile_fixup (
 	  afct = afct->next;
 	}
 
-      value = sym.st_value;
+      DL_FIXUP_VALUE_SET_CODE_ADDR (value, sym.st_value);
     }
 #endif
 
   /* Store the frame size information.  */
   *framesizep = framesize;
 
-  (*mcount_fct) (retaddr, value);
+  (*mcount_fct) (retaddr, DL_FIXUP_VALUE_CODE_ADDR (value));
 
   return value;
 }
Index: elf/tst-auditmod1.c
===================================================================
RCS file: /cvs/glibc/libc/elf/tst-auditmod1.c,v
retrieving revision 1.7
diff -u -a -p -r1.7 tst-auditmod1.c
--- elf/tst-auditmod1.c	16 Jan 2005 06:24:59 -0000	1.7
+++ elf/tst-auditmod1.c	21 Jan 2005 14:41:33 -0000
@@ -138,6 +138,12 @@ la_symbind64 (Elf64_Sym *sym, unsigned i
 # define La_regs La_m68k_regs
 # define La_retval La_m68k_retval
 # define int_retval lrv_d0
+#elif defined __ia64__
+# define pltenter la_ia64_gnu_pltenter
+# define pltexit la_ia64_gnu_pltexit
+# define La_regs La_ia64_regs
+# define La_retval La_ia64_retval
+# define int_retval lrv_r8
 #else
 # error "architecture specific code needed"
 #endif
Index: include/link.h
===================================================================
RCS file: /cvs/glibc/libc/include/link.h,v
retrieving revision 1.35
diff -u -a -p -r1.35 link.h
--- include/link.h	18 Jan 2005 01:19:29 -0000	1.35
+++ include/link.h	21 Jan 2005 14:41:33 -0000
@@ -214,7 +214,7 @@ struct link_map
     /* Collected results of relocation while profiling.  */
     struct reloc_result
     {
-      ElfW(Addr) addr;
+      DL_FIXUP_VALUE_TYPE addr;
       struct link_map *bound;
       unsigned int boundndx;
       uint32_t enterexit;
Index: sysdeps/generic/dl-fptr.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/dl-fptr.h,v
retrieving revision 1.1
diff -u -a -p -r1.1 dl-fptr.h
--- sysdeps/generic/dl-fptr.h	2 May 2003 02:37:21 -0000	1.1
+++ sysdeps/generic/dl-fptr.h	21 Jan 2005 14:41:35 -0000
@@ -20,6 +20,8 @@
 #ifndef dl_fptr_h
 #define dl_fptr_h 1
 
+struct link_map;
+
 /* An FDESC is a function descriptor.  */
 
 struct fdesc
Index: sysdeps/generic/dl-lookupcfg.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/dl-lookupcfg.h,v
retrieving revision 1.5
diff -u -a -p -r1.5 dl-lookupcfg.h
--- sysdeps/generic/dl-lookupcfg.h	6 Jan 2005 22:40:20 -0000	1.5
+++ sysdeps/generic/dl-lookupcfg.h	21 Jan 2005 14:41:35 -0000
@@ -17,4 +17,11 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-/* Nothing special.  */
+/* The type of the return value of fixup/profile_fixup.  */
+#define DL_FIXUP_VALUE_TYPE ElfW(Addr)
+/* Construct a value of type DL_FIXUP_VALUE_TYPE from a code address and a
+   link map.  */
+#define DL_FIXUP_MAKE_VALUE(v, t) v
+/* Extract the code address from a value of type DL_FIXUP_MAKE_VALUE.  */
+#define DL_FIXUP_VALUE_CODE_ADDR(v) v
+#define DL_FIXUP_VALUE_SET_CODE_ADDR(v, a) ((v) = (a))
Index: sysdeps/generic/ldsodefs.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/ldsodefs.h,v
retrieving revision 1.112
diff -u -a -p -r1.112 ldsodefs.h
--- sysdeps/generic/ldsodefs.h	16 Jan 2005 02:07:29 -0000	1.112
+++ sysdeps/generic/ldsodefs.h	21 Jan 2005 14:41:35 -0000
@@ -187,6 +187,8 @@ struct La_sh_regs;
 struct La_sh_retval;
 struct La_m68k_regs;
 struct La_m68k_retval;
+struct La_ia64_regs;
+struct La_ia64_retval;
 
 
 struct audit_ifaces
@@ -228,6 +230,10 @@ struct audit_ifaces
 				     uintptr_t *, struct La_m68k_regs *,
 				     unsigned int *, const char *name,
 				     long int *framesizep);
+    Elf64_Addr (*ia64_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
+				     uintptr_t *, struct La_ia64_regs *,
+				     unsigned int *, const char *name,
+				     long int *framesizep);
   };
   union
   {
@@ -253,6 +259,9 @@ struct audit_ifaces
     unsigned int (*m68k_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
 				      uintptr_t *, const struct La_m68k_regs *,
 				      struct La_m68k_retval *, const char *);
+    unsigned int (*ia64_gnu_pltexit) (Elf64_Sym *, unsigned int, uintptr_t *,
+				      uintptr_t *, const struct La_ia64_regs *,
+				      struct La_ia64_retval *, const char *);
   };
   unsigned int (*objclose) (uintptr_t *);
 
Index: sysdeps/hppa/dl-lookupcfg.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/hppa/dl-lookupcfg.h,v
retrieving revision 1.6
diff -u -a -p -r1.6 dl-lookupcfg.h
--- sysdeps/hppa/dl-lookupcfg.h	6 Jan 2005 22:40:18 -0000	1.6
+++ sysdeps/hppa/dl-lookupcfg.h	21 Jan 2005 14:41:35 -0000
@@ -63,3 +63,12 @@ void _dl_unmap (struct link_map *map);
   ((Elf32_Addr)(addr) & 2 ? (addr) : DL_AUTO_FUNCTION_ADDRESS (map, addr))
 #define DL_DT_FINI_ADDRESS(map, addr) \
   ((Elf32_Addr)(addr) & 2 ? (addr) : DL_AUTO_FUNCTION_ADDRESS (map, addr))
+
+/* The type of the return value of fixup/profile_fixup.  */
+#define DL_FIXUP_VALUE_TYPE ElfW(Addr)
+/* Construct a value of type DL_FIXUP_VALUE_TYPE from a code address and a
+   link map.  */
+#define DL_FIXUP_MAKE_VALUE(v, t) v
+/* Extract the code address from a value of type DL_FIXUP_MAKE_VALUE.  */
+#define DL_FIXUP_VALUE_CODE_ADDR(v) v
+#define DL_FIXUP_VALUE_SET_CODE_ADDR(v, a) ((v) = (a))
Index: sysdeps/ia64/dl-lookupcfg.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/ia64/dl-lookupcfg.h,v
retrieving revision 1.11
diff -u -a -p -r1.11 dl-lookupcfg.h
--- sysdeps/ia64/dl-lookupcfg.h	6 Jan 2005 22:40:17 -0000	1.11
+++ sysdeps/ia64/dl-lookupcfg.h	21 Jan 2005 14:41:35 -0000
@@ -17,6 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <dl-fptr.h>
+
 #define ELF_FUNCTION_PTR_IS_SPECIAL
 #define DL_UNMAP_IS_SPECIAL
 
@@ -56,3 +58,13 @@ extern void _dl_unmap (struct link_map *
 
 #define DL_DT_INIT_ADDRESS(map, addr) DL_AUTO_FUNCTION_ADDRESS (map, addr)
 #define DL_DT_FINI_ADDRESS(map, addr) DL_AUTO_FUNCTION_ADDRESS (map, addr)
+
+/* The type of the return value of fixup/profile_fixup.  */
+#define DL_FIXUP_VALUE_TYPE struct fdesc
+/* Construct a value of type DL_FIXUP_VALUE_TYPE from a code address and a
+   link map.  */
+#define DL_FIXUP_MAKE_VALUE(v, t) \
+  ((struct fdesc) { (v), (t)->l_info[DT_PLTGOT]->d_un.d_ptr })
+/* Extract the code address from a value of type DL_FIXUP_MAKE_VALUE.  */
+#define DL_FIXUP_VALUE_CODE_ADDR(v) (v).ip
+#define DL_FIXUP_VALUE_SET_CODE_ADDR(v, a) ((v).ip = (a))
Index: sysdeps/ia64/dl-machine.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/ia64/dl-machine.h,v
retrieving revision 1.36
diff -u -a -p -r1.36 dl-machine.h
--- sysdeps/ia64/dl-machine.h	15 Dec 2004 08:54:00 -0000	1.36
+++ sysdeps/ia64/dl-machine.h	21 Jan 2005 14:41:35 -0000
@@ -123,7 +123,8 @@ elf_machine_runtime_setup (struct link_m
 	doit = (Elf64_Addr) ((struct fdesc *) &_dl_runtime_resolve)->ip;
       else
 	{
-	  if (_dl_name_match_p (GLRO(dl_profile), l))
+	  if (GLRO(dl_profile) != NULL
+	      && _dl_name_match_p (GLRO(dl_profile), l))
 	    {
 	      /* This is the object we are looking for.  Say that we really
 		 want profiling and the timers are started.  */
@@ -140,133 +141,6 @@ elf_machine_runtime_setup (struct link_m
 }
 
 
-/*
-   This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns. `fixup()' takes two
-   arguments, however profile_fixup() takes three.
-
-   The ABI specifies that we will never see more than 8 input
-   registers to a function call, thus it is safe to simply allocate
-   those, and simpler than playing stack games.
-					                     - 12/09/99 Jes
- */
-#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name)			     \
-  extern void tramp_name (void);					     \
-  asm (									     \
-"	.global " #tramp_name "#\n"					     \
-"	.proc " #tramp_name "#\n"					     \
-#tramp_name ":\n"							     \
-"	{ .mmi\n"							     \
-"	  .prologue\n"							     \
-"	  .save ar.pfs, r40\n"						     \
-"	  alloc loc0 = ar.pfs, 8, 6, 3, 0\n"				     \
-"	  adds r2 = -144, r12\n"					     \
-"	  adds r3 = -128, r12\n"					     \
-"	}\n"								     \
-"	{ .mii\n"							     \
-"	  .fframe 160\n"						     \
-"	  adds r12 = -160, r12\n"					     \
-"	  .save rp, r41\n"						     \
-"	  mov loc1 = b0\n"						     \
-"	  .body\n"							     \
-"	  mov out2 = b0		/* needed by fixup_profile */\n"	     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mfb\n"							     \
-"	  mov loc2 = r8		/* preserve struct value register */\n"	     \
-"	  nop.f 0\n"							     \
-"	  nop.b 0\n"							     \
-"	}\n"								     \
-"	{ .mii\n"							     \
-"	  mov loc3 = r9		/* preserve language specific register */\n" \
-"	  mov loc4 = r10	/* preserve language specific register */\n" \
-"	  mov loc5 = r11	/* preserve language specific register */\n" \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  stf.spill [r2] = f8, 32\n"					     \
-"	  stf.spill [r3] = f9, 32\n"					     \
-"	  mov out0 = r16\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  stf.spill [r2] = f10, 32\n"					     \
-"	  stf.spill [r3] = f11, 32\n"					     \
-"	  shl out1 = r15, 4\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  stf.spill [r2] = f12, 32\n"					     \
-"	  stf.spill [r3] = f13, 32\n"					     \
-"	  shladd out1 = r15, 3, out1\n"					     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmb\n"							     \
-"	  stf.spill [r2] = f14\n"					     \
-"	  stf.spill [r3] = f15\n"					     \
-"	  br.call.sptk.many b0 = " #fixup_name "#\n"			     \
-"	}\n"								     \
-"	{ .mii\n"							     \
-"	  ld8 r9 = [ret0], 8\n"						     \
-"	  adds r2 = 16, r12\n"						     \
-"	  adds r3 = 32, r12\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  ldf.fill f8 = [r2], 32\n"					     \
-"	  ldf.fill f9 = [r3], 32\n"					     \
-"	  mov b0 = loc1\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  ldf.fill f10 = [r2], 32\n"					     \
-"	  ldf.fill f11 = [r3], 32\n"					     \
-"	  mov b6 = r9\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  ldf.fill f12 = [r2], 32\n"					     \
-"	  ldf.fill f13 = [r3], 32\n"					     \
-"	  mov ar.pfs = loc0\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  ldf.fill f14 = [r2], 32\n"					     \
-"	  ldf.fill f15 = [r3], 32\n"					     \
-"	  .restore sp		/* pop the unwind frame state */\n"	     \
-"	  adds r12 = 160, r12\n"					     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mii\n"							     \
-"	  mov r9 = loc3		/* restore language specific register */\n"  \
-"	  mov r10 = loc4	/* restore language specific register */\n"  \
-"	  mov r11 = loc5	/* restore language specific register */\n"  \
-"	}\n"								     \
-"	{ .mii\n"							     \
-"	  ld8 gp = [ret0]\n"						     \
-"	  mov r8 = loc2		/* restore struct value register */\n"	     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	/* An alloc is needed for the break system call to work.\n"	     \
-"	   We don't care about the old value of the pfs register.  */\n"     \
-"	{ .mmb\n"							     \
-"	  .prologue\n"							     \
-"	  .body\n"							     \
-"	  alloc r2 = ar.pfs, 0, 0, 8, 0\n"				     \
-"	  br.sptk.many b6\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	.endp " #tramp_name "#\n");
-
-#ifndef PROF
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE 				\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);		\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup);
-#else
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE				\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);		\
-  strong_alias (_dl_runtime_resolve, _dl_runtime_profile);
-#endif
-
 /* Undo the adds out0 = 16, sp below to get at the value we want in
    __libc_stack_end.  */
 #define DL_STACK_END(cookie) \
@@ -454,36 +328,35 @@ elf_machine_runtime_setup (struct link_m
 #define ELF_MACHINE_START_ADDRESS(map, start)	\
   DL_STATIC_FUNCTION_ADDRESS (map, start)
 
-#define elf_machine_profile_fixup_plt(l, reloc, rel_addr, value) \
-  elf_machine_fixup_plt (l, reloc, rel_addr, value)
-
-#define elf_machine_profile_plt(reloc_addr) ((Elf64_Addr) (reloc_addr))
-
 /* Fixup a PLT entry to bounce directly to the function at VALUE.  */
-static inline Elf64_Addr __attribute__ ((always_inline))
+static inline struct fdesc __attribute__ ((always_inline))
 elf_machine_fixup_plt (struct link_map *l, lookup_t t,
 		       const Elf64_Rela *reloc,
-		       Elf64_Addr *reloc_addr, Elf64_Addr value)
+		       Elf64_Addr *reloc_addr, struct fdesc value)
 {
   /* l is the link_map for the caller, t is the link_map for the object
    * being called */
   /* got has already been relocated in elf_get_dynamic_info() */
-  reloc_addr[1] = t->l_info[DT_PLTGOT]->d_un.d_ptr;
+  reloc_addr[1] = value.gp;
   /* we need a "release" here to ensure that the gp is visible before
      the code entry point is updated: */
-  ((volatile Elf64_Addr *) reloc_addr)[0] = value;
-  return (Elf64_Addr) reloc_addr;
+  ((volatile Elf64_Addr *) reloc_addr)[0] = value.ip;
+  return value;
 }
 
 /* Return the final value of a plt relocation.  */
-static inline Elf64_Addr
+static inline struct fdesc
 elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
-		       Elf64_Addr value)
+		       struct fdesc value)
 {
   /* No need to handle rel vs rela since IA64 is rela only */
-  return value + reloc->r_addend;
+  return (struct fdesc) { value.ip + reloc->r_addend, value.gp };
 }
 
+/* Names of the architecture-specific auditing callback functions.  */
+#define ARCH_LA_PLTENTER ia64_gnu_pltenter
+#define ARCH_LA_PLTEXIT ia64_gnu_pltexit
+
 #endif /* !dl_machine_h */
 
 #ifdef RESOLVE_MAP
@@ -552,7 +425,8 @@ elf_machine_rela (struct link_map *map,
 	    ;/* No adjustment.  */
 	  else if (r_type == R_IA64_IPLTLSB)
 	    {
-	      elf_machine_fixup_plt (NULL, sym_map, reloc, reloc_addr, value);
+	      elf_machine_fixup_plt (NULL, NULL, reloc, reloc_addr,
+				     DL_FIXUP_MAKE_VALUE (value, sym_map));
 	      return;
 	    }
 	  else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_FPTR64LSB))
Index: sysdeps/ia64/dl-trampoline.S
===================================================================
RCS file: sysdeps/ia64/dl-trampoline.S
diff -N sysdeps/ia64/dl-trampoline.S
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sysdeps/ia64/dl-trampoline.S	21 Jan 2005 14:41:35 -0000
@@ -0,0 +1,227 @@
+/* PLT trampolines.  ia64 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>
+
+	.text
+	.global _dl_runtime_resolve#
+	.proc _dl_runtime_resolve#
+_dl_runtime_resolve:
+	{ .mmi
+	  .prologue
+	  .save ar.pfs, r40
+	  alloc loc0 = ar.pfs, 8, 6, 3, 0
+	  adds r2 = -144, r12
+	  adds r3 = -128, r12
+	}
+	{ .mii
+	  .fframe 160
+	  adds r12 = -160, r12
+	  .save rp, r41
+	  mov loc1 = b0
+	  .body
+	  mov out2 = b0		/* needed by fixup_profile */
+	  ;;
+	}
+	{ .mfb
+	  mov loc2 = r8		/* preserve struct value register */
+	  nop.f 0
+	  nop.b 0
+	}
+	{ .mii
+	  mov loc3 = r9		/* preserve language specific register */
+	  mov loc4 = r10	/* preserve language specific register */
+	  mov loc5 = r11	/* preserve language specific register */
+	}
+	{ .mmi
+	  stf.spill [r2] = f8, 32
+	  stf.spill [r3] = f9, 32
+	  mov out0 = r16
+	  ;;
+	}
+	{ .mmi
+	  stf.spill [r2] = f10, 32
+	  stf.spill [r3] = f11, 32
+	  shl out1 = r15, 4
+	  ;;
+	}
+	{ .mmi
+	  stf.spill [r2] = f12, 32
+	  stf.spill [r3] = f13, 32
+	  shladd out1 = r15, 3, out1
+	  ;;
+	}
+	{ .mmb
+	  stf.spill [r2] = f14
+	  stf.spill [r3] = f15
+	  br.call.sptk.many b0 = _dl_fixup#
+	}
+	{ .mii
+	  adds r2 = 16, r12
+	  adds r3 = 32, r12
+	  mov b6 = ret0
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f8 = [r2], 32
+	  ldf.fill f9 = [r3], 32
+	  mov b0 = loc1
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f10 = [r2], 32
+	  ldf.fill f11 = [r3], 32
+	  mov gp = ret1
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f12 = [r2], 32
+	  ldf.fill f13 = [r3], 32
+	  mov ar.pfs = loc0
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f14 = [r2], 32
+	  ldf.fill f15 = [r3], 32
+	  .restore sp		/* pop the unwind frame state */
+	  adds r12 = 160, r12
+	  ;;
+	}
+	{ .mii
+	  mov r9 = loc3		/* restore language specific register */
+	  mov r10 = loc4	/* restore language specific register */
+	  mov r11 = loc5	/* restore language specific register */
+	}
+	{ .mii
+	  mov r8 = loc2		/* restore struct value register */
+	  ;;
+	}
+	/* An alloc is needed for the break system call to work.
+	   We don't care about the old value of the pfs register.  */
+	{ .mmb
+	  .prologue
+	  .body
+	  alloc r2 = ar.pfs, 0, 0, 8, 0
+	  br.sptk.many b6
+	  ;;
+	}
+	.endp _dl_runtime_resolve#
+
+	.global _dl_runtime_profile#
+	.proc _dl_runtime_profile#
+_dl_runtime_profile:
+	{ .mmi
+	  .prologue
+	  .save ar.pfs, r40
+	  alloc loc0 = ar.pfs, 8, 6, 5, 0
+	  adds r2 = -144, r12
+	  adds r3 = -128, r12
+	}
+	{ .mii
+	  .fframe 160
+	  adds r12 = -160, r12
+	  .save rp, r41
+	  mov loc1 = b0
+	  .body
+	  mov out2 = b0		/* needed by _dl_profile_fixup */
+	  ;;
+	}
+	{ .mii
+	  mov loc2 = r8		/* preserve struct value register */
+	  adds out3 = 16, r12	/* needed by _dl_profile_fixup */
+	  adds out4 = 8, r12	/* needed by _dl_profile_fixup */
+	}
+	{ .mii
+	  mov loc3 = r9		/* preserve language specific register */
+	  mov loc4 = r10	/* preserve language specific register */
+	  mov loc5 = r11	/* preserve language specific register */
+	}
+	{ .mmi
+	  stf.spill [r2] = f8, 32
+	  stf.spill [r3] = f9, 32
+	  mov out0 = r16
+	  ;;
+	}
+	{ .mmi
+	  stf.spill [r2] = f10, 32
+	  stf.spill [r3] = f11, 32
+	  shl out1 = r15, 4
+	  ;;
+	}
+	{ .mmi
+	  stf.spill [r2] = f12, 32
+	  stf.spill [r3] = f13, 32
+	  shladd out1 = r15, 3, out1
+	  ;;
+	}
+	{ .mmb
+	  stf.spill [r2] = f14
+	  stf.spill [r3] = f15
+	  br.call.sptk.many b0 = _dl_profile_fixup#
+	}
+	{ .mii
+	  adds r2 = 16, r12
+	  adds r3 = 32, r12
+	  mov b6 = ret0
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f8 = [r2], 32
+	  ldf.fill f9 = [r3], 32
+	  mov b0 = loc1
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f10 = [r2], 32
+	  ldf.fill f11 = [r3], 32
+	  mov gp = ret1
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f12 = [r2], 32
+	  ldf.fill f13 = [r3], 32
+	  mov ar.pfs = loc0
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f14 = [r2], 32
+	  ldf.fill f15 = [r3], 32
+	  .restore sp		/* pop the unwind frame state */
+	  adds r12 = 160, r12
+	  ;;
+	}
+	{ .mii
+	  mov r9 = loc3		/* restore language specific register */
+	  mov r10 = loc4	/* restore language specific register */
+	  mov r11 = loc5	/* restore language specific register */
+	}
+	{ .mii
+	  mov r8 = loc2		/* restore struct value register */
+	  ;;
+	}
+	/* An alloc is needed for the break system call to work.
+	   We don't care about the old value of the pfs register.  */
+	{ .mmb
+	  .prologue
+	  .body
+	  alloc r2 = ar.pfs, 0, 0, 8, 0
+	  br.sptk.many b6
+	  ;;
+	}
+	.endp _dl_runtime_profile#
Index: sysdeps/ia64/bits/link.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/ia64/bits/link.h,v
retrieving revision 1.2
diff -u -a -p -r1.2 link.h
--- sysdeps/ia64/bits/link.h	6 Jan 2005 22:40:16 -0000	1.2
+++ sysdeps/ia64/bits/link.h	21 Jan 2005 14:41:35 -0000
@@ -0,0 +1,54 @@
+/* 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 IA-64.  */
+typedef struct La_ia64_regs
+{
+  /* To be defined.  */
+} La_ia64_regs;
+
+/* Return values for calls from PLT on IA-64.  */
+typedef struct La_ia64_retval
+{
+  uint64_t lrv_r8;
+  /* To be defined.  */
+} La_ia64_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf64_Addr la_ia64_gnu_pltenter (Elf64_Sym *__sym, unsigned int __ndx,
+					uintptr_t *__refcook,
+					uintptr_t *__defcook,
+					La_ia64_regs *__regs,
+					unsigned int *__flags,
+					const char *__symname,
+					long int *__framesizep);
+extern unsigned int la_ia64_gnu_pltexit (Elf64_Sym *__sym, unsigned int __ndx,
+					 uintptr_t *__refcook,
+					 uintptr_t *__defcook,
+					 const La_ia64_regs *__inregs,
+					 La_ia64_retval *__outregs,
+					 const char *symname);
+
+__END_DECLS
Index: sysdeps/powerpc/powerpc64/dl-lookupcfg.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/powerpc/powerpc64/dl-lookupcfg.h,v
retrieving revision 1.2
diff -u -a -p -r1.2 dl-lookupcfg.h
--- sysdeps/powerpc/powerpc64/dl-lookupcfg.h	6 Jan 2005 22:40:16 -0000	1.2
+++ sysdeps/powerpc/powerpc64/dl-lookupcfg.h	21 Jan 2005 14:41:35 -0000
@@ -0,0 +1,27 @@
+/* Configuration of lookup functions.  PowerPC64 version.
+   Copyright (C) 2002, 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.  */
+
+/* The type of the return value of fixup/profile_fixup.  */
+#define DL_FIXUP_VALUE_TYPE ElfW(Addr)
+/* Construct a value of type DL_FIXUP_VALUE_TYPE from a code address and a
+   link map.  */
+#define DL_FIXUP_MAKE_VALUE(v, t) v
+/* Extract the code address from a value of type DL_FIXUP_MAKE_VALUE.  */
+#define DL_FIXUP_VALUE_CODE_ADDR(v) v
+#define DL_FIXUP_VALUE_SET_CODE_ADDR(v, a) ((v) = (a))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]