public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Fix LD_BIND_NOT and LD_PROFILE on ia64
@ 2005-01-21 10:55 Andreas Schwab
  2005-01-23  4:36 ` Ulrich Drepper
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2005-01-21 10:55 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: libc-hacker

This patch fixes PR677.  Instead of returning a pointer to a function
descriptor fixup and profile_fixup now return the descriptor itself.  This
is required for LD_BIND_NOT to work since we never actually write the
resolved descriptor to memory in this case, and for the relocation cache
used by profile_fixup.

HPPA probably has the same problem, and most likely can use the same
solution, but that needs to be looked at by someone who knows more about
HPPA.

Andreas.

2005-01-21  Andreas Schwab  <schwab@suse.de>

	[BZ #677]
	* sysdeps/ia64/dl-machine.h (elf_machine_fixup_plt)
	(elf_machine_plt_value): Change return type and type of value
	parameter to struct fdesc.
	(elf_machine_profile_fixup_plt, elf_machine_profile_plt): Remove,
	unused.
	(elf_machine_rela): Use DL_FIXUP_MAKE_VALUE to construct argument
	for elf_machine_fixup_plt.
	(TRAMPOLINE_TEMPLATE): Adapt to new return type of fixup and
	profile_fixup.
	* sysdeps/ia64/dl-lookupcfg.h (DL_FIXUP_VALUE_TYPE)
	(DL_FIXUP_MAKE_VALUE, DL_FIXUP_VALUE_CODE_ADDR): Define.
	* sysdeps/generic/dl-lookupcfg.h (DL_FIXUP_VALUE_TYPE)
	(DL_FIXUP_MAKE_VALUE, DL_FIXUP_VALUE_CODE_ADDR): Define.
	* sysdeps/hppa/dl-lookupcfg.h (DL_FIXUP_VALUE_TYPE)
	(DL_FIXUP_MAKE_VALUE, DL_FIXUP_VALUE_CODE_ADDR): Define.
	* sysdeps/powerpc/powerpc64/dl-lookupcfg.h (DL_FIXUP_VALUE_TYPE)
	(DL_FIXUP_MAKE_VALUE, DL_FIXUP_VALUE_CODE_ADDR): Define.
	* include/link.h (struct link_map): Use DL_FIXUP_VALUE_TYPE for
	l_reloc_result.
	* elf/dl-runtime.c (fixup, profile_fixup): Change return type to
	DL_FIXUP_VALUE_TYPE.  Use DL_FIXUP_VALUE_TYPE, DL_FIXUP_MAKE_VALUE
	and DL_FIXUP_VALUE_CODE_ADDR for relocation values.
	* elf/dl-reloc.c (_dl_relocate_object): Use DL_FIXUP_VALUE_TYPE
	for l_reloc_result.

Index: elf/dl-reloc.c
===================================================================
RCS file: /cvs/glibc/libc/elf/dl-reloc.c,v
retrieving revision 1.96
diff -u -a -p -r1.96 dl-reloc.c
--- elf/dl-reloc.c	7 Mar 2004 05:21:01 -0000	1.96
+++ elf/dl-reloc.c	21 Jan 2005 10:26:02 -0000
@@ -1,5 +1,5 @@
 /* Relocate a shared object and resolve its references to other loaded objects.
-   Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002, 2003, 2004, 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
@@ -284,8 +284,8 @@ _dl_relocate_object (struct link_map *l,
 	  }
 
 	l->l_reloc_result =
-	  (ElfW(Addr) *) calloc (sizeof (ElfW(Addr)),
-				 l->l_info[DT_PLTRELSZ]->d_un.d_val);
+	  (DL_FIXUP_VALUE_TYPE *) calloc (sizeof (DL_FIXUP_VALUE_TYPE),
+					  l->l_info[DT_PLTRELSZ]->d_un.d_val);
 	if (l->l_reloc_result == NULL)
 	  {
 	    errstring = N_("\
Index: elf/dl-runtime.c
===================================================================
RCS file: /cvs/glibc/libc/elf/dl-runtime.c,v
retrieving revision 1.65
diff -u -a -p -r1.65 dl-runtime.c
--- elf/dl-runtime.c	9 Mar 2004 07:42:59 -0000	1.65
+++ elf/dl-runtime.c	21 Jan 2005 10:26:02 -0000
@@ -1,5 +1,5 @@
 /* On-demand PLT fixup for shared objects.
-   Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002, 2003, 2004, 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
@@ -51,7 +51,7 @@
    function.  */
 
 #ifndef ELF_MACHINE_NO_PLT
-static ElfW(Addr)
+static DL_FIXUP_VALUE_TYPE
 __attribute ((used, noinline)) ARCH_FIXUP_ATTRIBUTE
 fixup (
 # ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
@@ -70,7 +70,7 @@ 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);
@@ -102,13 +102,14 @@ 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);
 #ifdef DL_LOOKUP_RETURNS_MAP
       result = l;
 #endif
@@ -127,7 +128,7 @@ fixup (
 
 #if !defined PROF && !defined ELF_MACHINE_NO_PLT && !__BOUNDED_POINTERS__
 
-static ElfW(Addr)
+static DL_FIXUP_VALUE_TYPE
 __attribute ((used, noinline)) ARCH_FIXUP_ATTRIBUTE
 profile_fixup (
 #ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
@@ -136,16 +137,16 @@ profile_fixup (
        struct link_map *l, ElfW(Word) reloc_offset, ElfW(Addr) retaddr)
 {
   void (*mcount_fct) (ElfW(Addr), ElfW(Addr)) = INTUSE(_dl_mcount);
-  ElfW(Addr) *resultp;
+  DL_FIXUP_VALUE_TYPE *resultp;
   lookup_t result;
-  ElfW(Addr) value;
+  DL_FIXUP_VALUE_TYPE value;
 
   /* This is the address in the array where we store the result of previous
      relocations.  */
   resultp = &l->l_reloc_result[reloc_offset / sizeof (PLTREL)];
 
   value = *resultp;
-  if (value == 0)
+  if (DL_FIXUP_VALUE_CODE_ADDR (value) == 0)
     {
       /* This is the first time we have to relocate this object.  */
       const ElfW(Sym) *const symtab
@@ -187,13 +188,14 @@ 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 = (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);
 #ifdef DL_LOOKUP_RETURNS_MAP
 	  result = l;
 #endif
@@ -206,7 +208,7 @@ profile_fixup (
 	*resultp = value;
     }
 
-  (*mcount_fct) (retaddr, value);
+  (*mcount_fct) (retaddr, DL_FIXUP_VALUE_CODE_ADDR (value));
 
   return value;
 }
Index: include/link.h
===================================================================
RCS file: /cvs/glibc/libc/include/link.h,v
retrieving revision 1.33
diff -u -a -p -r1.33 link.h
--- include/link.h	14 Oct 2004 01:57:54 -0000	1.33
+++ include/link.h	21 Jan 2005 10:26:02 -0000
@@ -1,6 +1,6 @@
 /* Data structure for communication from the run-time dynamic linker for
    loaded ELF shared objects.
-   Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002, 2003, 2004, 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
@@ -207,7 +207,7 @@ struct link_map
     struct r_search_path_struct l_rpath_dirs;
 
     /* Collected results of relocation while profiling.  */
-    ElfW(Addr) *l_reloc_result;
+    DL_FIXUP_VALUE_TYPE *l_reloc_result;
 
     /* Pointer to the version information if available.  */
     ElfW(Versym) *l_versyms;
Index: sysdeps/generic/dl-lookupcfg.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/dl-lookupcfg.h,v
retrieving revision 1.4
diff -u -a -p -r1.4 dl-lookupcfg.h
--- sysdeps/generic/dl-lookupcfg.h	11 Oct 2002 12:19:50 -0000	1.4
+++ sysdeps/generic/dl-lookupcfg.h	21 Jan 2005 10:26:03 -0000
@@ -1,5 +1,5 @@
 /* Configuration of lookup functions.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   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
@@ -30,3 +30,11 @@
 #else
 # undef DL_LOOKUP_RETURNS_MAP
 #endif
+
+/* 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
Index: sysdeps/hppa/dl-lookupcfg.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/hppa/dl-lookupcfg.h,v
retrieving revision 1.5
diff -u -a -p -r1.5 dl-lookupcfg.h
--- sysdeps/hppa/dl-lookupcfg.h	18 Dec 2003 03:53:47 -0000	1.5
+++ sysdeps/hppa/dl-lookupcfg.h	21 Jan 2005 10:26:03 -0000
@@ -1,5 +1,5 @@
 /* Configuration of lookup functions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 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
@@ -67,3 +67,10 @@ void _dl_unmap (struct link_map *map);
 #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
Index: sysdeps/ia64/dl-lookupcfg.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/ia64/dl-lookupcfg.h,v
retrieving revision 1.10
diff -u -a -p -r1.10 dl-lookupcfg.h
--- sysdeps/ia64/dl-lookupcfg.h	27 Mar 2003 01:15:24 -0000	1.10
+++ sysdeps/ia64/dl-lookupcfg.h	21 Jan 2005 10:26:03 -0000
@@ -1,5 +1,5 @@
 /* Configuration of lookup functions.
-   Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2003, 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
@@ -59,3 +59,12 @@ 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
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 10:26:03 -0000
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  IA-64 version.
-   Copyright (C) 1995-1997, 2000-2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-1997, 2000-2003, 2004, 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
@@ -206,9 +206,9 @@ elf_machine_runtime_setup (struct link_m
 "	  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"						     \
+"	  mov b6 = ret0\n"						     \
 "	  ;;\n"								     \
 "	}\n"								     \
 "	{ .mmi\n"							     \
@@ -220,7 +220,7 @@ elf_machine_runtime_setup (struct link_m
 "	{ .mmi\n"							     \
 "	  ldf.fill f10 = [r2], 32\n"					     \
 "	  ldf.fill f11 = [r3], 32\n"					     \
-"	  mov b6 = r9\n"						     \
+"	  mov gp = ret1\n"						     \
 "	  ;;\n"								     \
 "	}\n"								     \
 "	{ .mmi\n"							     \
@@ -242,7 +242,6 @@ elf_machine_runtime_setup (struct link_m
 "	  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"								     \
@@ -454,34 +453,29 @@ 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 };
 }
 
 #endif /* !dl_machine_h */
@@ -552,7 +546,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/powerpc/powerpc64/dl-lookupcfg.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/powerpc/powerpc64/dl-lookupcfg.h,v
retrieving revision 1.1
diff -u -a -p -r1.1 dl-lookupcfg.h
--- sysdeps/powerpc/powerpc64/dl-lookupcfg.h	17 Sep 2002 23:50:02 -0000	1.1
+++ sysdeps/powerpc/powerpc64/dl-lookupcfg.h	21 Jan 2005 10:26:03 -0000
@@ -1,5 +1,5 @@
 /* Configuration of lookup functions.  PowerPC64 version.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   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
@@ -20,3 +20,11 @@
 /* Return the symbol map from the symbol lookup function.  */
 
 #define DL_LOOKUP_RETURNS_MAP 1
+
+/* 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

-- 
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."

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Fix LD_BIND_NOT and LD_PROFILE on ia64
  2005-01-21 10:55 Fix LD_BIND_NOT and LD_PROFILE on ia64 Andreas Schwab
@ 2005-01-23  4:36 ` Ulrich Drepper
  2005-01-23 13:24   ` Andreas Schwab
  0 siblings, 1 reply; 8+ messages in thread
From: Ulrich Drepper @ 2005-01-23  4:36 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Jes Sorensen, libc-hacker

[-- Attachment #1: Type: text/plain, Size: 288 bytes --]

Andreas Schwab wrote:
> This patch fixes PR677.

It might have fixed it at some point in time.  But it does not even 
apply today anymore.  Why do you send something as outdated as this?

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Fix LD_BIND_NOT and LD_PROFILE on ia64
  2005-01-23  4:36 ` Ulrich Drepper
@ 2005-01-23 13:24   ` Andreas Schwab
  2005-01-23 18:44     ` Ulrich Drepper
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2005-01-23 13:24 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Jes Sorensen, libc-hacker

Ulrich Drepper <drepper@redhat.com> writes:

> Andreas Schwab wrote:
>> This patch fixes PR677.
>
> It might have fixed it at some point in time.

And still does!

>  But it does not even apply today anymore.  Why do you send something as
> outdated as this?

??? It perfectly matches what is on the 2.3 branch!  Why don't you just check
the PR and look at the version field???

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."

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Fix LD_BIND_NOT and LD_PROFILE on ia64
  2005-01-23 13:24   ` Andreas Schwab
@ 2005-01-23 18:44     ` Ulrich Drepper
  2005-01-23 22:36       ` Andreas Schwab
  0 siblings, 1 reply; 8+ messages in thread
From: Ulrich Drepper @ 2005-01-23 18:44 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Jes Sorensen, libc-hacker

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]

Andreas Schwab wrote:
> ??? It perfectly matches what is on the 2.3 branch!  Why don't you just check
> the PR and look at the version field???

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.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Fix LD_BIND_NOT and LD_PROFILE on ia64
  2005-01-23 18:44     ` Ulrich Drepper
@ 2005-01-23 22:36       ` Andreas Schwab
  2005-01-23 22:41         ` Roland McGrath
  2005-01-25  0:25         ` H. J. Lu
  0 siblings, 2 replies; 8+ messages in thread
From: Andreas Schwab @ 2005-01-23 22:36 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Jes Sorensen, libc-hacker

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

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."

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ia64-audit.diff --]
[-- Type: text/x-patch, Size: 28150 bytes --]

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))

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Fix LD_BIND_NOT and LD_PROFILE on ia64
  2005-01-23 22:36       ` Andreas Schwab
@ 2005-01-23 22:41         ` Roland McGrath
  2005-01-25  0:25         ` H. J. Lu
  1 sibling, 0 replies; 8+ messages in thread
From: Roland McGrath @ 2005-01-23 22:41 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

The 2.3 backport patch is of course useful when it's fixing bugs.  In
future, please indicate in the subject line when a patch is not intended
for the trunk.  As Ulrich said, it will have to be integrated in the trunk
first before a backport version could be considered for the branch.  Once
it's settled what the trunk code will look like to address the issues, and
if people's production branches based on 2.3 are using the fix, then it can
be considered for the release branch.


Thanks,
Roland

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Fix LD_BIND_NOT and LD_PROFILE on ia64
  2005-01-23 22:36       ` Andreas Schwab
  2005-01-23 22:41         ` Roland McGrath
@ 2005-01-25  0:25         ` H. J. Lu
  2005-01-25  6:38           ` Richard Henderson
  1 sibling, 1 reply; 8+ messages in thread
From: H. J. Lu @ 2005-01-25  0:25 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Ulrich Drepper, Jes Sorensen, libc-hacker

On Sun, Jan 23, 2005 at 11:36:42PM +0100, Andreas Schwab wrote:
> 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.
> 

This is my incomplete patch. I need to spend some time on audit code.


H.J.
-----
2005-01-24  H.J. Lu  <hongjiu.lu@intel.com>

	* elf/tst-auditmod1.c: Add ia64 entries.

	* sysdeps/generic/ldsodefs.h (La_ia64_regs): New.
	(La_ia64_retval): New.
	(audit_ifaces): Add ia64 entries.

	* sysdeps/ia64/bits/link.h: New file.

	* sysdeps/ia64/dl-machine.h (elf_machine_runtime_setup): Test
	for dl_profile non-null.
	(ARCH_LA_PLTENTER): New.
	(ARCH_LA_PLTEXIT): New.

	* sysdeps/ia64/dl-trampoline.S (_dl_runtime_resolve): Only
	allocate 2 output registers. Call _dl_fixup instead of fixup.
	(_dl_runtime_profile): Try to support audit.

--- libc/elf/tst-auditmod1.c.tramp	2005-01-24 15:30:36.000000000 -0800
+++ libc/elf/tst-auditmod1.c	2005-01-24 15:41:02.000000000 -0800
@@ -144,6 +144,12 @@ la_symbind64 (Elf64_Sym *sym, unsigned i
 # define La_regs La_alpha_regs
 # define La_retval La_alpha_retval
 # define int_retval lrv_r0
+#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
--- libc/sysdeps/generic/ldsodefs.h.tramp	2005-01-24 15:30:39.000000000 -0800
+++ libc/sysdeps/generic/ldsodefs.h	2005-01-24 15:43:13.000000000 -0800
@@ -189,6 +189,8 @@ struct La_m68k_regs;
 struct La_m68k_retval;
 struct La_alpha_regs;
 struct La_alpha_retval;
+struct La_ia64_regs;
+struct La_ia64_retval;
 
 struct audit_ifaces
 {
@@ -233,6 +235,10 @@ struct audit_ifaces
 				      uintptr_t *, struct La_alpha_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
   {
@@ -262,6 +268,10 @@ struct audit_ifaces
 				       uintptr_t *,
 				       const struct La_alpha_regs *,
 				       struct La_alpha_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 *);
 
--- libc/sysdeps/ia64/bits/link.h.tramp	2005-01-07 14:13:48.000000000 -0800
+++ libc/sysdeps/ia64/bits/link.h	2005-01-24 15:40:07.000000000 -0800
@@ -0,0 +1,60 @@
+/* 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 ia64.  */
+typedef struct La_ia64_regs
+{
+  uint64_t lr_gr [8];
+  long double lr_fr [8];
+  uint64_t lr_sp;
+  uint64_t lr_gp;
+} La_ia64_regs;
+
+/* Return values for calls from PLT on ia64.  */
+typedef struct La_ia64_retval
+{
+  uint64_t lrv_r8;
+  uint64_t lrv_r9;
+  uint64_t lrv_r10;
+  uint64_t lrv_r11;
+  long double lr_fr [8];
+} 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
--- libc/sysdeps/ia64/dl-machine.h.tramp	2005-01-24 15:30:39.000000000 -0800
+++ libc/sysdeps/ia64/dl-machine.h	2005-01-24 16:03:55.000000000 -0800
@@ -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.  */
@@ -139,6 +140,9 @@ elf_machine_runtime_setup (struct link_m
   return lazy;
 }
 
+/* Names of the architecture-specific auditing callback functions.  */
+#define ARCH_LA_PLTENTER ia64_gnu_pltenter
+#define ARCH_LA_PLTEXIT ia64_gnu_pltexit
 
 /* Undo the adds out0 = 16, sp below to get at the value we want in
    __libc_stack_end.  */
--- libc/sysdeps/ia64/dl-trampoline.S.tramp	2005-01-22 21:11:50.000000000 -0800
+++ libc/sysdeps/ia64/dl-trampoline.S	2005-01-24 16:16:27.795490484 -0800
@@ -32,7 +32,7 @@ ENTRY(_dl_runtime_resolve)
 	{ .mmi
 	  .prologue
 	  .save ar.pfs, r40
-	  alloc loc0 = ar.pfs, 8, 6, 3, 0
+	  alloc loc0 = ar.pfs, 8, 6, 2, 0
 	  adds r2 = -144, r12
 	  adds r3 = -128, r12
 	}
@@ -42,13 +42,8 @@ ENTRY(_dl_runtime_resolve)
 	  .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 */
@@ -76,7 +71,7 @@ ENTRY(_dl_runtime_resolve)
 	{ .mmb
 	  stf.spill [r2] = f14
 	  stf.spill [r3] = f15
-	  br.call.sptk.many b0 = fixup
+	  br.call.sptk.many b0 = _dl_fixup#
 	}
 	{ .mii
 	  ld8 r9 = [ret0], 8
@@ -128,35 +123,55 @@ ENTRY(_dl_runtime_resolve)
 	  br.sptk.many b6
 	  ;;
 	}
-END (_dl_runtime_resolve)
+END(_dl_runtime_resolve)
 
 
 ENTRY(_dl_runtime_profile)
 	{ .mmi
 	  .prologue
 	  .save ar.pfs, r40
-	  alloc loc0 = ar.pfs, 8, 6, 3, 0
-	  adds r2 = -144, r12
-	  adds r3 = -128, r12
+	  alloc loc0 = ar.pfs, 8, 7, 5, 0
+	  adds r2 = -224, r12
+	  adds r3 = -216, r12
 	}
 	{ .mii
-	  .fframe 160
-	  adds r12 = -160, r12
+	  .fframe 248
+	  adds r12 = -248, r12
 	  .save rp, r41
 	  mov loc1 = b0
 	  .body
-	  mov out2 = b0		/* needed by fixup_profile */
+	  mov out2 = b0		/* needed by _dl_fixup_profile */
 	  ;;
 	}
-	{ .mfb
+	{ .mmi
+	  st8.spill [r2] = in0, 16	/* store arg 0 */
+	  st8.spill [r3] = in1, 16	/* store arg 1 */
 	  mov loc2 = r8		/* preserve struct value register */
-	  nop.f 0
-	  nop.b 0
+	  ;;
 	}
-	{ .mii
+	{ .mmi
+	  st8.spill [r2] = in2, 16	/* store arg 2 */
+	  st8.spill [r3] = in3, 16	/* store arg 3 */
 	  mov loc3 = r9		/* preserve language specific register */
+	  ;;
+	}
+	{ .mmi
+	  st8.spill [r2] = in4, 16	/* store arg 4 */
+	  st8.spill [r3] = in5, 16	/* store arg 5 */
 	  mov loc4 = r10	/* preserve language specific register */
+	  ;;
+	}
+	{ .mmi
+	  st8 [r2] = in6, 16	/* store arg 6 */
+	  st8 [r3] = in7, 16	/* store arg 7 */
 	  mov loc5 = r11	/* preserve language specific register */
+	  ;;
+	}
+	{ .mii
+	  adds out3 = 16, r12	/* needed by _dl_fixup_profile */
+	  adds out4 = 224, r12	/* needed by _dl_fixup_profile */
+	  adds r3 = 8, r3
+	  ;;
 	}
 	{ .mmi
 	  stf.spill [r2] = f8, 32
@@ -176,10 +191,16 @@ ENTRY(_dl_runtime_profile)
 	  shladd out1 = r15, 3, out1
 	  ;;
 	}
+	{ .mmi
+	  stf.spill [r2] = f14, 32
+	  stf.spill [r3] = f15, 24
+	  adds loc6 = 248, r12
+	  ;;
+	}
 	{ .mmb
-	  stf.spill [r2] = f14
-	  stf.spill [r3] = f15
-	  br.call.sptk.many b0 = profile_fixup
+	  st8 [r2] = gp		/* store gp */
+	  st8 [r3] = loc6	/* store sp */
+	  br.call.sptk.many b0 = _dl_profile_fixup#
 	}
 	{ .mii
 	  ld8 r9 = [ret0], 8
@@ -209,7 +230,7 @@ ENTRY(_dl_runtime_profile)
 	  ldf.fill f14 = [r2], 32
 	  ldf.fill f15 = [r3], 32
 	  .restore sp		/* pop the unwind frame state */
-	  adds r12 = 160, r12
+	  adds r12 = 248, r12
 	  ;;
 	}
 	{ .mii
@@ -231,4 +252,4 @@ ENTRY(_dl_runtime_profile)
 	  br.sptk.many b6
 	  ;;
 	}
-END (_dl_runtime_profile)
+END(_dl_runtime_profile)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Fix LD_BIND_NOT and LD_PROFILE on ia64
  2005-01-25  0:25         ` H. J. Lu
@ 2005-01-25  6:38           ` Richard Henderson
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2005-01-25  6:38 UTC (permalink / raw)
  To: H. J. Lu; +Cc: Andreas Schwab, Ulrich Drepper, Jes Sorensen, libc-hacker

On Mon, Jan 24, 2005 at 04:25:45PM -0800, H. J. Lu wrote:
> +	  st8.spill [r2] = in0, 16	/* store arg 0 */

You must save and restore unat around this.


r~

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-01-25  6:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-21 10:55 Fix LD_BIND_NOT and LD_PROFILE on ia64 Andreas Schwab
2005-01-23  4:36 ` Ulrich Drepper
2005-01-23 13:24   ` Andreas Schwab
2005-01-23 18:44     ` Ulrich Drepper
2005-01-23 22:36       ` Andreas Schwab
2005-01-23 22:41         ` Roland McGrath
2005-01-25  0:25         ` H. J. Lu
2005-01-25  6:38           ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).