This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Fix powerpc-linux ld.so segfault
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: libc-alpha at sources dot redhat dot com, drepper at redhat dot com
- Date: Tue, 25 Jan 2005 17:38:20 +1030
- Subject: Fix powerpc-linux ld.so segfault
This change to sysdeps/powerpc/powerpc32/dl-machine.h
revision 1.10
date: 2005/01/07 23:11:29; author: drepper; state: Exp; lines: +8 -165
Remove trampoline code here. Define ARCH_LA_PLTENTER and ARCH_LA_PLTEXIT.
also changed elf_machine_rela (without mentioning it in the changelog)
to always use RESOLVE_MAP. I don't know whether the change was
intentional, but as it is, ld.so can no longer relocate itself.
This undefined weak sym
14: 00000000 0 NOTYPE WEAK DEFAULT UND __pthread_mutex_lock
using the definition of RESOLVE_MAP in rtld.c
#define RESOLVE_MAP(sym, version, flags) \
((*(sym))->st_shndx == SHN_UNDEF ? 0 : &bootstrap_map)
gives a sym_map of zero, leading to a segfault at dl-machine.h:236
Assuming the elf_machine_rela changes were intentional, the following
brings us back to a working glibc.
* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Test
sym_map, not sym, against zero.
Index: sysdeps/powerpc/powerpc32/dl-machine.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/powerpc/powerpc32/dl-machine.h,v
retrieving revision 1.10
diff -u -p -r1.10 dl-machine.h
--- sysdeps/powerpc/powerpc32/dl-machine.h 7 Jan 2005 23:11:29 -0000 1.10
+++ sysdeps/powerpc/powerpc32/dl-machine.h 25 Jan 2005 06:05:59 -0000
@@ -233,7 +233,7 @@ elf_machine_rela (struct link_map *map,
else
{
sym_map = RESOLVE_MAP (&sym, version, r_type);
- value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
+ value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value;
}
value += reloc->r_addend;
#else
--
Alan Modra
IBM OzLabs - Linux Technology Centre