diff -uNr glibc-2.2.4-orig/elf/do-rel.h glibc-2.2.4/elf/do-rel.h
--- glibc-2.2.4-orig/elf/do-rel.h	Fri Nov  9 10:38:25 2001
+++ glibc-2.2.4/elf/do-rel.h	Fri Nov  9 13:51:28 2001
@@ -86,7 +86,7 @@
 # endif
 #endif
 	  for (; relative < r; ++relative)
-	    elf_machine_rel_relative (l_addr, relative,
+	    elf_machine_rel_relative (map, l_addr, relative,
 				      (void *) (l_addr + relative->r_offset));
 
       if (map->l_info[VERSYMIDX (DT_VERSYM)])
diff -uNr glibc-2.2.4-orig/elf/dynamic-link.h glibc-2.2.4/elf/dynamic-link.h
--- glibc-2.2.4-orig/elf/dynamic-link.h	Fri Nov  9 10:38:25 2001
+++ glibc-2.2.4/elf/dynamic-link.h	Fri Nov  9 13:51:28 2001
@@ -139,24 +139,26 @@
     struct { ElfW(Addr) start, size; int lazy; } ranges[3];		      \
     int ranges_index;							      \
 									      \
-    ranges[0].lazy = ranges[2].lazy = 0;				      \
-    ranges[1].lazy = 1;							      \
     ranges[0].size = ranges[1].size = ranges[2].size = 0;		      \
 									      \
     if ((map)->l_info[DT_##RELOC])					      \
       {									      \
 	ranges[0].start = D_PTR ((map), l_info[DT_##RELOC]);		      \
 	ranges[0].size = (map)->l_info[DT_##RELOC##SZ]->d_un.d_val;	      \
+	ranges[0].lazy = 0;						      \
       }									      \
 									      \
      if ((do_lazy)							      \
-	&& (map)->l_info[DT_PLTREL]					      \
-	&& (!test_rel || (map)->l_info[DT_PLTREL]->d_un.d_val == DT_##RELOC)) \
+	 && (map)->l_info[DT_PLTREL]					      \
+	 && (!test_rel							      \
+	     || (map)->l_info[DT_PLTREL]->d_un.d_val == DT_##RELOC))	      \
       {									      \
 	ranges[1].start = D_PTR ((map), l_info[DT_JMPREL]);		      \
 	ranges[1].size = (map)->l_info[DT_PLTRELSZ]->d_un.d_val;	      \
+	ranges[1].lazy = 1;						      \
 	ranges[2].start = ranges[1].start + ranges[1].size;		      \
 	ranges[2].size = ranges[0].start + ranges[0].size - ranges[2].start;  \
+	ranges[2].lazy = 0;						      \
 	ranges[0].size = ranges[1].start - ranges[0].start;		      \
       }									      \
 									      \
@@ -171,15 +173,16 @@
   do {									      \
     struct { ElfW(Addr) start, size; int lazy; } ranges[2];		      \
     int ranges_index;							      \
-    ranges[0].lazy = 0;							      \
+									      \
     ranges[0].size = ranges[1].size = 0;				      \
-    ranges[0].start = 0;						      \
 									      \
     if ((map)->l_info[DT_##RELOC])					      \
       {									      \
         ranges[0].start = D_PTR ((map), l_info[DT_##RELOC]);		      \
         ranges[0].size = (map)->l_info[DT_##RELOC##SZ]->d_un.d_val;	      \
+	ranges[0].lazy = 0;						      \
       }									      \
+									      \
     if ((map)->l_info[DT_PLTREL]					      \
 	&& (!test_rel || (map)->l_info[DT_PLTREL]->d_un.d_val == DT_##RELOC)) \
       {									      \
diff -uNr glibc-2.2.4-orig/sysdeps/alpha/dl-machine.h glibc-2.2.4/sysdeps/alpha/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/alpha/dl-machine.h	Fri Nov  9 10:38:23 2001
+++ glibc-2.2.4/sysdeps/alpha/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -537,7 +537,8 @@
 }
 
 static inline void
-elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
+elf_machine_rela_relative (struct link_map *map, Elf64_Addr l_addr,
+			   const Elf64_Rela *reloc,
 			   Elf64_Addr *const reloc_addr)
 {
   /* XXX Make some timings.  Maybe it's preverable to test for
diff -uNr glibc-2.2.4-orig/sysdeps/arm/dl-machine.h glibc-2.2.4/sysdeps/arm/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/arm/dl-machine.h	Fri Nov  9 10:38:23 2001
+++ glibc-2.2.4/sysdeps/arm/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -518,7 +518,8 @@
 }
 
 static inline void
-elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
+elf_machine_rel_relative (struct link_map *map, Elf32_Addr l_addr,
+			  const Elf32_Rel *reloc,
 			  Elf32_Addr *const reloc_addr)
 {
   *reloc_addr += l_addr;
diff -uNr glibc-2.2.4-orig/sysdeps/cris/dl-machine.h glibc-2.2.4/sysdeps/cris/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/cris/dl-machine.h	Fri Nov  9 10:38:23 2001
+++ glibc-2.2.4/sysdeps/cris/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -366,7 +366,8 @@
 }
 
 static inline void
-elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
+elf_machine_rela_relative (struct link_map *map, Elf32_Addr l_addr,
+			   const Elf32_Rela *reloc,
 			   Elf32_Addr *const reloc_addr)
 {
   *reloc_addr = l_addr + reloc->r_addend;
diff -uNr glibc-2.2.4-orig/sysdeps/hppa/dl-fptr.c glibc-2.2.4/sysdeps/hppa/dl-fptr.c
--- glibc-2.2.4-orig/sysdeps/hppa/dl-fptr.c	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/hppa/dl-fptr.c	Fri Nov  9 13:51:28 2001
@@ -29,8 +29,7 @@
 #ifdef _LIBC_REENTRANT
 # include <pt-machine.h>
 
-/* Remember, we use 0 to mean that a lock is taken on PA-RISC. */
-static int __hppa_fptr_lock = 1;
+static __atomic_lock_t __hppa_fptr_lock = __ATOMIC_LOCK_INIT;
 #endif
 
 /* Because ld.so is now versioned, these functions can be in their own
@@ -66,7 +65,7 @@
 #ifdef _LIBC_REENTRANT
   /* Make sure we are alone. We don't need a lock during bootstrap. */
   if (mem == NULL)
-    while (testandset (&__hppa_fptr_lock));
+    while (try_lock(&__hppa_fptr_lock));
 #endif
 
   /* Search the sorted linked list for an existing entry for this
@@ -126,9 +125,8 @@
 
 found:
 #ifdef _LIBC_REENTRANT
-  /* Release the lock.  Again, remember, zero means the lock is taken!  */
   if (mem == NULL)
-    __hppa_fptr_lock = 1;
+    __hppa_fptr_lock = __ATOMIC_LOCK_INIT;
 #endif
 
   /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */
@@ -147,7 +145,7 @@
 
 #ifdef _LIBC_REENTRANT
   /* Make sure we are alone.  */
-  while (testandset (&__hppa_fptr_lock));
+  while (try_lock(&__hppa_fptr_lock));
 #endif
 
   /* Search the sorted linked list for the first entry for this object.  */
@@ -180,8 +178,7 @@
     }
 
 #ifdef _LIBC_REENTRANT
-  /* Release the lock. */
-  __hppa_fptr_lock = 1;
+  __hppa_fptr_lock = __ATOMIC_LOCK_INIT;
 #endif
 }
 
@@ -191,9 +188,12 @@
   Elf32_Addr addr = (Elf32_Addr) address;
   struct hppa_fptr *f;
 
+ /* Clear the bottom two bits.  See make_fptr. */
+  address = (const void *) ((unsigned long) address &~ 3);
+
 #ifdef _LIBC_REENTRANT
   /* Make sure we are alone.  */
-  while (testandset (&__hppa_fptr_lock));
+  while (try_lock(&__hppa_fptr_lock));
 #endif
 
   for (f = __fptr_root; f != NULL; f = f->next)
@@ -204,8 +204,7 @@
       }
 
 #ifdef _LIBC_REENTRANT
-  /* Release the lock.   */
-  __hppa_fptr_lock = 1;
+  __hppa_fptr_lock = __ATOMIC_LOCK_INIT;
 #endif
 
   return addr;
diff -uNr glibc-2.2.4-orig/sysdeps/hppa/dl-machine.h glibc-2.2.4/sysdeps/hppa/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/hppa/dl-machine.h	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/hppa/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -28,8 +28,15 @@
 #include <link.h>
 #include <assert.h>
 
+# define VALID_ELF_OSABI(osabi)		((osabi == ELFOSABI_SYSV) || (osabi == ELFOSABI_LINUX))
+# define VALID_ELF_ABIVERSION(ver)	(ver == 0)
+# define VALID_ELF_HEADER(hdr,exp,size) \
+  memcmp (hdr,exp,size-2) == 0 \
+  && VALID_ELF_OSABI (hdr[EI_OSABI]) \
+  && VALID_ELF_ABIVERSION (hdr[EI_ABIVERSION])
+
 /* These must match the definition of the stub in bfd/elf32-hppa.c. */
-#define SIZEOF_PLT_STUB (4*4)
+#define SIZEOF_PLT_STUB (7*4)
 #define GOT_FROM_PLT_STUB (4*4)
 
 /* A PLABEL is a function descriptor.  Properly they consist of just
@@ -66,45 +73,41 @@
   return ehdr->e_machine == EM_PARISC;
 }
 
-
 /* Return the link-time address of _DYNAMIC.  */
 static inline Elf32_Addr
+elf_machine_dynamic (void) __attribute__ ((const));
+
+static inline Elf32_Addr
 elf_machine_dynamic (void)
 {
   Elf32_Addr dynamic;
 
-#if 0
-  /* Use this method if GOT address not yet set up.  */
-  asm (
-"	b,l	1f,%0\n"
+  asm ("b,l	1f,%0\n"
 "	depi	0,31,2,%0\n"
 "1:	addil	L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 8),%0\n"
 "	ldw	R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 12)(%%r1),%0\n"
-      : "=r" (dynamic) : : "r1");
-#else
-  /* This works because we already have our GOT address available.  */
-  dynamic = (Elf32_Addr) &_DYNAMIC;
-#endif
+       : "=r" (dynamic) : : "r1");
 
   return dynamic;
 }
 
 /* Return the run-time load address of the shared object.  */
 static inline Elf32_Addr
+elf_machine_load_address (void) __attribute__ ((const));
+
+static inline Elf32_Addr
 elf_machine_load_address (void)
 {
-  Elf32_Addr dynamic, dynamic_linkaddress;
+  Elf32_Addr dynamic;
 
   asm (
 "	b,l	1f,%0\n"
 "	depi	0,31,2,%0\n"
 "1:	addil	L'_DYNAMIC - ($PIC_pcrel$0 - 8),%0\n"
-"	ldo	R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%%r1),%1\n"
-"	addil	L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 16),%0\n"
-"	ldw	R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 20)(%%r1),%0\n"
-   : "=r" (dynamic_linkaddress), "=r" (dynamic) : : "r1");
+"	ldo	R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%%r1),%0\n"
+   : "=r" (dynamic) : : "r1");
 
-  return dynamic - dynamic_linkaddress;
+  return dynamic - elf_machine_dynamic ();
 }
 
 /* Fixup a PLT entry to bounce directly to the function at VALUE.  */
@@ -167,41 +170,39 @@
 	      fptr = (struct hppa_fptr *) (reloc->r_offset + l_addr);
 	      if (r_sym != 0)
 		{
-		  /* Relocate the pointer to the stub.  */
-		  fptr->func += l_addr;
-		  /* Instead of the LTP value, we put the reloc offset
-		     here.  The trampoline code will load the proper
-		     LTP and pass the reloc offset to the fixup
-		     function.  */
-		  fptr->gp = iplt - jmprel;
 		  if (!got)
 		    {
 		      static union {
 			unsigned char c[8];
 			Elf32_Addr i[2];
 		      } sig = {{0x00,0xc0,0xff,0xee, 0xde,0xad,0xbe,0xef}};
+		      const Elf32_Rela *last_rel;
+
+		      last_rel = (const Elf32_Rela *) end_jmprel - 1;
+
+		      /* The stub is immediately after the last .plt
+			 entry.  Rely on .plt relocs being ordered.  */
+		      if (last_rel->r_offset == 0)
+			return 0;
 
 		      /* Find our .got section.  It's right after the
 			 stub.  */
-		      got = (Elf32_Addr *) (fptr->func + GOT_FROM_PLT_STUB);
+		      got = (Elf32_Addr *) (last_rel->r_offset + l_addr
+					    + 8 + SIZEOF_PLT_STUB);
 
-		      /* Sanity check to see if the address we are
-                         going to check below is within a reasonable
-                         approximation of the bounds of the PLT (or,
-                         at least, is at an address that won't fault
-                         on read).  Then check for the magic signature
-                         above. */
-		      if (fptr->func < (Elf32_Addr) fptr + sizeof(*fptr))
-			  return 0;
-		      if (fptr->func >
-			  ((Elf32_Addr) fptr
-			   + SIZEOF_PLT_STUB
-			   + ((l->l_info[DT_PLTRELSZ]->d_un.d_val / sizeof (Elf32_Rela))
-			      * 8)))
-			return 0;
+		      /* Check the magic signature.  */
 		      if (got[-2] != sig.i[0] || got[-1] != sig.i[1])
 			return 0; /* No lazy linking for you! */
 		    }
+
+		  /* Relocate the pointer to the stub.  */
+		  fptr->func = (Elf32_Addr) got - GOT_FROM_PLT_STUB;
+
+		  /* Instead of the LTP value, we put the reloc offset
+		     here.  The trampoline code will load the proper
+		     LTP and pass the reloc offset to the fixup
+		     function.  */
+		  fptr->gp = iplt - jmprel;
 		}
 	      else
 		{
@@ -271,22 +272,24 @@
 "	stw	%r25,-40(%sp)\n" /* argc */				\
 "	stw	%r24,-44(%sp)\n" /* argv */				\
 									\
-	/* We need the LTP, and we need it now. */			\
-	/* $PIC_pcrel$0 points 8 bytes past the current instruction,	\
-	   just like a branch reloc.  This sequence gets us the runtime	\
-	   address of _DYNAMIC. */					\
+	/* We need the LTP, and we need it now.				\
+	   $PIC_pcrel$0 points 8 bytes past the current instruction,	\
+	   just like a branch reloc.  This sequence gets us the		\
+	   runtime address of _DYNAMIC. */				\
 "	bl	0f,%r19\n"						\
 "	depi	0,31,2,%r19\n"	/* clear priviledge bits */		\
 "0:	addil	L'_DYNAMIC - ($PIC_pcrel$0 - 8),%r19\n"			\
 "	ldo	R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%r1),%r26\n"		\
 									\
-	/* Also get the link time address from the first entry of the GOT.  */ \
+	/* The link time address is stored in the first entry of the	\
+	   GOT.  */							\
 "	addil	L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 16),%r19\n"	\
 "	ldw	R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 20)(%r1),%r20\n" \
 									\
 "	sub	%r26,%r20,%r20\n"	/* Calculate load offset */	\
 									\
-	/* Rummage through the dynamic entries, looking for DT_PLTGOT.  */ \
+	/* Rummage through the dynamic entries, looking for		\
+	   DT_PLTGOT.  */						\
 "	ldw,ma	8(%r26),%r19\n"						\
 "1:	cmpib,=,n 3,%r19,2f\n"	/* tag == DT_PLTGOT? */			\
 "	cmpib,<>,n 0,%r19,1b\n"						\
@@ -306,8 +309,8 @@
 	   |         32 bytes of magic       |				\
 	   |---------------------------------|				\
 	   | 32 bytes argument/sp save area  |				\
-	   |---------------------------------|  ((current->mm->env_end) + 63 & ~63) \
-	   |         N bytes of slack        |				\
+	   |---------------------------------|  ((current->mm->env_end)	\
+	   |         N bytes of slack        |	 + 63 & ~63)		\
 	   |---------------------------------|				\
 	   |      envvar and arg strings     |				\
 	   |---------------------------------|				\
@@ -375,7 +378,7 @@
 "	bl	_dl_init,%r2\n"						\
 "	ldo	4(%r23),%r23\n"	/* delay slot */			\
 									\
-	/* Reload argc, argv  to the registers start.S expects them in (feh) */ \
+	/* Reload argc, argv to the registers start.S expects.  */	\
 "	ldw	-40(%sp),%r25\n"					\
 "	ldw	-44(%sp),%r24\n"					\
 									\
@@ -387,8 +390,8 @@
 "	.word	0xdeadbeef\n"						\
 "	.previous\n"							\
 									\
-	/* %r3 contains a function pointer, we need to mask out the lower \
-	 * bits and load the gp and jump address. */			\
+	/* %r3 contains a function pointer, we need to mask out the	\
+	   lower bits and load the gp and jump address. */		\
 "	depi	0,31,2,%r3\n"						\
 "	ldw	0(%r3),%r2\n"						\
 "	addil	LT'__dl_fini_plabel,%r19\n"				\
@@ -406,42 +409,40 @@
    Enter with r19 = reloc offset, r20 = got-8, r21 = fixup ltp.  */
 #define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \
   extern void tramp_name (void);		    \
-  asm ( "\
-	/* Trampoline for " #tramp_name " */
-	.globl " #tramp_name "
-	.type " #tramp_name ",@function
-" #tramp_name ":
-	/* Save return pointer */
-	stw	%r2,-20(%sp)
-	/* Save argument registers in the call stack frame. */
-	stw	%r26,-36(%sp)
-	stw	%r25,-40(%sp)
-	stw	%r24,-44(%sp)
-	stw	%r23,-48(%sp)
-	/* Build a call frame. */
-	stwm	%sp,64(%sp)
-
-	/* Set up args to fixup func.  */
-	ldw	8+4(%r20),%r26	/* got[1] == struct link_map *  */
-	copy	%r19,%r25	/* reloc offset  */
-
-	/* Call the real address resolver. */
-	bl	" #fixup_name ",%r2
-	copy	%r21,%r19	/* delay slot, set fixup func ltp */
-
-	ldwm	-64(%sp),%sp
-	/* Arguments. */
-	ldw	-36(%sp),%r26
-	ldw	-40(%sp),%r25
-	ldw	-44(%sp),%r24
-	ldw	-48(%sp),%r23
-	/* Return pointer. */
-	ldw	-20(%sp),%r2
-	/* Call the real function. */
-	ldw	0(%r28),%r22
-	bv	%r0(%r22)
-	ldw	4(%r28),%r19
-");
+  asm (".globl " #tramp_name "\n"					\
+"	.type " #tramp_name ",@function\n"				\
+ #tramp_name ":\n"							\
+	/* Save return pointer */					\
+"	stw	%r2,-20(%sp)\n"						\
+	/* Save argument registers in the call stack frame. */		\
+"	stw	%r26,-36(%sp)\n"					\
+"	stw	%r25,-40(%sp)\n"					\
+"	stw	%r24,-44(%sp)\n"					\
+"	stw	%r23,-48(%sp)\n"					\
+	/* Build a call frame, and save structure pointer. */		\
+"	stwm	%r28,64(%sp)\n"						\
+									\
+	/* Set up args to fixup func.  */				\
+"	ldw	8+4(%r20),%r26\n" /* got[1] == struct link_map *  */	\
+"	copy	%r19,%r25\n"	  /* reloc offset  */			\
+									\
+	/* Call the real address resolver. */				\
+"	bl	" #fixup_name ",%r2\n"					\
+"	copy	%r21,%r19\n"	  /* delay slot, set fixup func ltp */	\
+									\
+"	ldw	0(%r28),%r22\n"	  /* load up the returned func ptr */	\
+"	ldw	4(%r28),%r19\n"						\
+"	ldwm	-64(%sp),%r28\n"					\
+	/* Arguments. */						\
+"	ldw	-36(%sp),%r26\n"					\
+"	ldw	-40(%sp),%r25\n"					\
+"	ldw	-44(%sp),%r24\n"					\
+"	ldw	-48(%sp),%r23\n"					\
+	/* Call the real function. */					\
+"	bv	%r0(%r22)\n"						\
+	/* Return pointer. */						\
+"	ldw	-20(%sp),%r2\n"						\
+       );
 
 #ifndef PROF
 #define ELF_MACHINE_RUNTIME_TRAMPOLINE			\
@@ -531,7 +532,7 @@
 	return;
 #endif
       /* .eh_frame can have unaligned relocs.  */
-      if (reloc_addr & 3)
+      if ((unsigned long) reloc_addr & 3)
 	{
 	  char *rel_addr = (char *) reloc_addr;
 	  rel_addr[0] = value >> 24;
@@ -567,14 +568,14 @@
 	   probably haven't relocated the necessary values by this
 	   point so we have to find them ourselves. */
 
-	asm ("bl	0f,%0
-	      depi	0,31,2,%0
-0:	      addil	L'__boot_ldso_fptr - ($PIC_pcrel$0 - 8),%0
-	      ldo	R'__boot_ldso_fptr - ($PIC_pcrel$0 - 12)(%%r1),%1
-	      addil	L'__fptr_root - ($PIC_pcrel$0 - 16),%0
-	      ldo	R'__fptr_root - ($PIC_pcrel$0 - 20)(%%r1),%2
-	      addil	L'__fptr_count - ($PIC_pcrel$0 - 24),%0
-	      ldo	R'__fptr_count - ($PIC_pcrel$0 - 28)(%%r1),%3"
+	asm ("bl	0f,%0\n\t"
+	     "depi	0,31,2,%0\n\t"
+	     "0:\taddil	L'__boot_ldso_fptr - ($PIC_pcrel$0 - 8),%0\n\t"
+	     "ldo	R'__boot_ldso_fptr - ($PIC_pcrel$0 - 12)(%%r1),%1\n\t"
+	     "addil	L'__fptr_root - ($PIC_pcrel$0 - 16),%0\n\t"
+	     "ldo	R'__fptr_root - ($PIC_pcrel$0 - 20)(%%r1),%2\n\t"
+	     "addil	L'__fptr_count - ($PIC_pcrel$0 - 24),%0\n\t"
+	     "ldo	R'__fptr_count - ($PIC_pcrel$0 - 28)(%%r1),%3"
 	     :
 	     "=r" (dot),
 	     "=r" (p_boot_ldso_fptr),
@@ -628,11 +629,51 @@
   *reloc_addr = value;
 }
 
+/* hppa doesn't have an R_PARISC_RELATIVE reloc, but uses relocs with
+   ELF32_R_SYM (info) == 0 for a similar purpose.  */
 static inline void
-elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
+elf_machine_rela_relative (struct link_map *map, Elf32_Addr l_addr,
+			   const Elf32_Rela *reloc,
 			   Elf32_Addr *const reloc_addr)
 {
-  /* XXX Nothing to do.  There is no relative relocation, right?  */
+  unsigned long const r_type = ELF32_R_TYPE (reloc->r_info);
+  Elf32_Addr value;
+
+  value = l_addr + reloc->r_addend;
+
+  if (ELF32_R_SYM (reloc->r_info) != 0)
+    asm volatile ("iitlbp	%r0,(%r0)");  /* Crash. */
+
+  switch (r_type)
+    {
+    case R_PARISC_DIR32:
+      /* .eh_frame can have unaligned relocs.  */
+      if ((unsigned long) reloc_addr & 3)
+	{
+	  char *rel_addr = (char *) reloc_addr;
+	  rel_addr[0] = value >> 24;
+	  rel_addr[1] = value >> 16;
+	  rel_addr[2] = value >> 8;
+	  rel_addr[3] = value;
+	  return;
+	}
+      break;
+
+    case R_PARISC_PLABEL32:
+      break;
+
+    case R_PARISC_IPLT:
+      elf_machine_fixup_plt (NULL, map, reloc, reloc_addr, value);
+      return;
+
+    case R_PARISC_NONE:
+      return;
+
+    default:
+      _dl_reloc_bad_type (map, r_type, 0);
+    }
+
+  *reloc_addr = value;
 }
 
 static inline void
diff -uNr glibc-2.2.4-orig/sysdeps/i386/dl-machine.h glibc-2.2.4/sysdeps/i386/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/i386/dl-machine.h	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/i386/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -379,7 +379,8 @@
 }
 
 static inline void
-elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
+elf_machine_rel_relative (struct link_map *map, Elf32_Addr l_addr,
+			  const Elf32_Rel *reloc,
 			  Elf32_Addr *const reloc_addr)
 {
   assert (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE);
diff -uNr glibc-2.2.4-orig/sysdeps/ia64/dl-fptr.c glibc-2.2.4/sysdeps/ia64/dl-fptr.c
--- glibc-2.2.4-orig/sysdeps/ia64/dl-fptr.c	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/ia64/dl-fptr.c	Fri Nov  9 13:51:28 2001
@@ -40,7 +40,7 @@
     struct ia64_fdesc *free_list;
     unsigned int npages;		/* # of pages to allocate */
 #ifdef _LIBC_REENTRANT
-    volatile int lock;
+    __atomic_lock_t lock;
     sigset_t full_sigset;
 #endif
     /* the next to members MUST be consecutive! */
@@ -73,7 +73,7 @@
   if (!__sigismember (&(l)->full_sigset, SIGINT))		\
     __sigfillset (&(l)->full_sigset);				\
 								\
-  while (testandset ((int *) &(l)->lock))			\
+  while (try_lock (&(l)->lock))					\
     {								\
       struct timespec ts;					\
       if (i > 0)						\
@@ -88,7 +88,7 @@
   __sigprocmask (SIG_BLOCK, &(l)->full_sigset, &_saved_set);
 # define unlock(l)						\
   __sigprocmask (SIG_SETMASK, &_saved_set, NULL);		\
-  (l)->lock = 0;						\
+  (l)->lock = __ATOMIC_LOCK_INIT;				\
 }
 #else
 # define lock(l)
diff -uNr glibc-2.2.4-orig/sysdeps/ia64/dl-machine.h glibc-2.2.4/sysdeps/ia64/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/ia64/dl-machine.h	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/ia64/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -580,7 +580,8 @@
 }
 
 static inline void
-elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
+elf_machine_rela_relative (struct link_map *map, Elf64_Addr l_addr,
+			   const Elf64_Rela *reloc,
 			   Elf64_Addr *const reloc_addr)
 {
   /* ??? Ignore MSB and Instruction format for now.  */
diff -uNr glibc-2.2.4-orig/sysdeps/m68k/dl-machine.h glibc-2.2.4/sysdeps/m68k/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/m68k/dl-machine.h	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/m68k/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -299,7 +299,8 @@
 }
 
 static inline void
-elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
+elf_machine_rela_relative (struct link_map *map, Elf32_Addr l_addr,
+			   const Elf32_Rela *reloc,
 			   Elf32_Addr *const reloc_addr)
 {
   *reloc_addr = l_addr + reloc->r_addend;
diff -uNr glibc-2.2.4-orig/sysdeps/mips/dl-machine.h glibc-2.2.4/sysdeps/mips/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/mips/dl-machine.h	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/mips/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -535,7 +535,8 @@
 }
 
 static inline void
-elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
+elf_machine_rel_relative (struct link_map *map, ElfW(Addr) l_addr,
+			  const ElfW(Rel) *reloc,
 			  ElfW(Addr) *const reloc_addr)
 {
   /* XXX Nothing to do.  There is no relative relocation, right?  */
diff -uNr glibc-2.2.4-orig/sysdeps/mips/mips64/dl-machine.h glibc-2.2.4/sysdeps/mips/mips64/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/mips/mips64/dl-machine.h	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/mips/mips64/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -576,7 +576,8 @@
 }
 
 static inline void
-elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
+elf_machine_rel_relative (struct link_map *map, ElfW(Addr) l_addr,
+			  const ElfW(Rel) *reloc,
 			  ElfW(Addr) *const reloc_addr)
 {
   /* XXX Nothing to do.  There is no relative relocation, right?  */
diff -uNr glibc-2.2.4-orig/sysdeps/powerpc/dl-machine.h glibc-2.2.4/sysdeps/powerpc/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/powerpc/dl-machine.h	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/powerpc/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -394,7 +394,8 @@
 }
 
 static inline void
-elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
+elf_machine_rela_relative (struct link_map *map, Elf32_Addr l_addr,
+			   const Elf32_Rela *reloc,
 			   Elf32_Addr *const reloc_addr)
 {
   *reloc_addr = l_addr + reloc->r_addend;
diff -uNr glibc-2.2.4-orig/sysdeps/s390/s390-32/dl-machine.h glibc-2.2.4/sysdeps/s390/s390-32/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/s390/s390-32/dl-machine.h	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/s390/s390-32/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -440,7 +440,8 @@
 }
 
 static inline void
-elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
+elf_machine_rela_relative (struct link_map *map, Elf32_Addr l_addr,
+			   const Elf32_Rela *reloc,
 			   Elf32_Addr *const reloc_addr)
 {
   *reloc_addr = l_addr + reloc->r_addend;
diff -uNr glibc-2.2.4-orig/sysdeps/s390/s390-64/dl-machine.h glibc-2.2.4/sysdeps/s390/s390-64/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/s390/s390-64/dl-machine.h	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/s390/s390-64/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -420,7 +420,8 @@
 }
 
 static inline void
-elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
+elf_machine_rela_relative (struct link_map *map, Elf64_Addr l_addr,
+			   const Elf64_Rela *reloc,
 			   Elf64_Addr *const reloc_addr)
 {
   *reloc_addr = l_addr + reloc->r_addend;
diff -uNr glibc-2.2.4-orig/sysdeps/sh/dl-machine.h glibc-2.2.4/sysdeps/sh/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/sh/dl-machine.h	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/sh/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -558,7 +558,8 @@
 }
 
 static inline void
-elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
+elf_machine_rela_relative (struct link_map *map, Elf32_Addr l_addr,
+			   const Elf32_Rela *reloc,
 			   Elf32_Addr *const reloc_addr)
 {
   Elf32_Addr value;
diff -uNr glibc-2.2.4-orig/sysdeps/sparc/sparc32/dl-machine.h glibc-2.2.4/sysdeps/sparc/sparc32/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/sparc/sparc32/dl-machine.h	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/sparc/sparc32/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -461,7 +461,8 @@
 }
 
 static inline void
-elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
+elf_machine_rela_relative (struct link_map *map, Elf32_Addr l_addr,
+			   const Elf32_Rela *reloc,
 			   Elf32_Addr *const reloc_addr)
 {
   *reloc_addr += l_addr + reloc->r_addend;
diff -uNr glibc-2.2.4-orig/sysdeps/sparc/sparc64/dl-machine.h glibc-2.2.4/sysdeps/sparc/sparc64/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/sparc/sparc64/dl-machine.h	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/sparc/sparc64/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -413,7 +413,8 @@
 }
 
 static inline void
-elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
+elf_machine_rela_relative (struct link_map *map, Elf64_Addr l_addr,
+			   const Elf64_Rela *reloc,
 			   Elf64_Addr *const reloc_addr)
 {
   *reloc_addr = l_addr + reloc->r_addend;
--- glibc-2.2.4-orig/sysdeps/unix/sysv/linux/hppa/msgctl.c	Wed Dec 31 16:00:00 1969
+++ glibc-2.2.4/sysdeps/unix/sysv/linux/hppa/msgctl.c	Fri Nov  9 13:51:28 2001
@@ -0,0 +1 @@
+#include "../alpha/msgctl.c"
diff -uNr glibc-2.2.4-orig/sysdeps/unix/sysv/linux/hppa/semctl.c glibc-2.2.4/sysdeps/unix/sysv/linux/hppa/semctl.c
--- glibc-2.2.4-orig/sysdeps/unix/sysv/linux/hppa/semctl.c	Wed Dec 31 16:00:00 1969
+++ glibc-2.2.4/sysdeps/unix/sysv/linux/hppa/semctl.c	Fri Nov  9 13:51:28 2001
@@ -0,0 +1 @@
+#include "../alpha/semctl.c"
diff -uNr glibc-2.2.4-orig/sysdeps/unix/sysv/linux/hppa/shmctl.c glibc-2.2.4/sysdeps/unix/sysv/linux/hppa/shmctl.c
--- glibc-2.2.4-orig/sysdeps/unix/sysv/linux/hppa/shmctl.c	Wed Dec 31 16:00:00 1969
+++ glibc-2.2.4/sysdeps/unix/sysv/linux/hppa/shmctl.c	Fri Nov  9 13:51:28 2001
@@ -0,0 +1 @@
+#include "../alpha/shmctl.c"
diff -uNr glibc-2.2.4-orig/sysdeps/unix/sysv/linux/hppa/syscalls.list glibc-2.2.4/sysdeps/unix/sysv/linux/hppa/syscalls.list
--- glibc-2.2.4-orig/sysdeps/unix/sysv/linux/hppa/syscalls.list	Fri Nov  9 10:38:24 2001
+++ glibc-2.2.4/sysdeps/unix/sysv/linux/hppa/syscalls.list	Fri Nov  9 13:51:28 2001
@@ -1,17 +1,17 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # semaphore and shm system calls
-msgctl		-	msgctl		i:iip	__msgctl	msgctl
+#msgctl		-	msgctl		i:iip	__msgctl	msgctl
 msgget		-	msgget		i:ii	__msgget	msgget
 msgrcv		-	msgrcv		i:ibnii	__msgrcv	msgrcv
 msgsnd		-	msgsnd		i:ibni	__msgsnd	msgsnd
 shmat		-	shmat		i:ipi	__shmat		shmat
-shmctl		-	shmctl		i:iip	__shmctl	shmctl
+#shmctl		-	shmctl		i:iip	__shmctl	shmctl
 shmdt		-	shmdt		i:s	__shmdt		shmdt
 shmget		-	shmget		i:iii	__shmget	shmget
 semop		-	semop		i:ipi	__semop		semop
 semget		-	semget		i:iii	__semget	semget
-semctl		-	semctl		i:iiii	__semctl	semctl
+#semctl		-	semctl		i:iiii	__semctl	semctl
 
 # proper socket implementations:
 accept		-	accept		i:iBN	__libc_accept	__accept accept
diff -uNr glibc-2.2.4-orig/sysdeps/x86_64/dl-machine.h glibc-2.2.4/sysdeps/x86_64/dl-machine.h
--- glibc-2.2.4-orig/sysdeps/x86_64/dl-machine.h	Fri Nov  9 10:38:25 2001
+++ glibc-2.2.4/sysdeps/x86_64/dl-machine.h	Fri Nov  9 13:51:28 2001
@@ -393,7 +393,8 @@
 }
 
 static inline void
-elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
+elf_machine_rela_relative (struct link_map *map, Elf64_Addr l_addr,
+			   const Elf64_Rela *reloc,
 			   Elf64_Addr *const reloc_addr)
 {
   assert (ELF64_R_TYPE (reloc->r_info) == R_X86_64_RELATIVE);
