[PATCH] A little do-rel.h fix (take 2)
Jakub Jelinek
jakub@redhat.com
Fri Aug 24 09:45:00 GMT 2001
On Fri, Aug 24, 2001 at 09:17:39AM -0700, Ulrich Drepper wrote:
> Jakub Jelinek <jakub@redhat.com> writes:
>
> > The first one is only if you think it is a good idea to put it in now
> > (otherwise I'll keep it in my prelink patchset where it is obvisously very
> > useful e.g. for dlopening prelinked libs).
>
> Is this always correct for rela platforms? Are the relocation
> addresses required to contain the same value as the r_addend? I'd
> expect not and then it patch is wrong.
>
> What does m68k do for instance?
You're right.
For REL this should work always though, for RELA the check will have to be
something like
&& (l_addr || map->l_info[VALIDX(DT_GNU_PRELINKED)])
(if prelinking works, the RELATIVE memory really needs to be set up
properly).
But I was especially interested in the r = endrel; line since that matters
even for non-prelinked binaries (there are couple dozens of RELATIVE relocs
in ld.so).
2001-08-24 Jakub Jelinek <jakub@redhat.com>
* elf/do-rel.h (elf_dynamic_do_rel): If l_addr is 0, skip relative
records. Set r unconditionally to first non-relative record.
--- libc/elf/do-rel.h.jj Fri Aug 24 18:15:24 2001
+++ libc/elf/do-rel.h Fri Aug 24 18:18:23 2001
@@ -70,11 +70,17 @@ elf_dynamic_do_rel (struct link_map *map
_dl_rtld_map, which is incompatible with a weak decl in the same
file. */
weak_extern (_dl_rtld_map);
- if (map != &_dl_rtld_map) /* Already done in rtld itself. */
+ if (map != &_dl_rtld_map /* Already done in rtld itself. */
+#ifndef DO_RELA
+ && l_addr
+#endif
+ )
#endif
for (; r < endrel; ++r)
elf_machine_rel_relative (l_addr, r,
(void *) (l_addr + r->r_offset));
+ r = endrel;
if (map->l_info[VERSYMIDX (DT_VERSYM)])
{
Jakub
More information about the Libc-hacker
mailing list