aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-24 13:56:33 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-24 13:56:33 +0000
commitad427d6e085788c7296c914bb71f9b6afe7eadc7 (patch)
treec1adea731871327f29ffe49050a9ec527bba629b /elf
parentbc7d63ea94ad6f2cdf2d3195e583e3dc21273dd0 (diff)
downloadglibc-ad427d6e085788c7296c914bb71f9b6afe7eadc7.zip
glibc-ad427d6e085788c7296c914bb71f9b6afe7eadc7.tar.gz
glibc-ad427d6e085788c7296c914bb71f9b6afe7eadc7.tar.bz2
(elf_dynamic_do_rel): RELATIVE relocations comes first if RELCOUNT is set.
Diffstat (limited to 'elf')
-rw-r--r--elf/do-rel.h31
1 files changed, 15 insertions, 16 deletions
diff --git a/elf/do-rel.h b/elf/do-rel.h
index b1c6033..f7c2a5b 100644
--- a/elf/do-rel.h
+++ b/elf/do-rel.h
@@ -59,8 +59,21 @@ elf_dynamic_do_rel (struct link_map *map,
(const void *) D_PTR (map, l_info[DT_SYMTAB]);
ElfW(Word) nrelative = (map->l_info[RELCOUNT_IDX] == NULL
? 0 : map->l_info[RELCOUNT_IDX]->d_un.d_val);
- const ElfW(Rel) *endrel = end;
- end -= nrelative;
+ const ElfW(Rel) *endrel = r + nrelative;
+
+#ifndef RTLD_BOOTSTRAP
+ /* This is defined in rtld.c, but nowhere in the static libc.a; make
+ the reference weak so static programs can still link. This
+ declaration cannot be done when compiling rtld.c (i.e. #ifdef
+ RTLD_BOOTSTRAP) because rtld.c contains the common defn for
+ _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. */
+#endif
+ for (; r < endrel; ++r)
+ elf_machine_rel_relative (l_addr, r,
+ (void *) (l_addr + r->r_offset));
if (map->l_info[VERSYMIDX (DT_VERSYM)])
{
@@ -79,20 +92,6 @@ elf_dynamic_do_rel (struct link_map *map,
for (; r < end; ++r)
elf_machine_rel (map, r, &symtab[ELFW(R_SYM) (r->r_info)], NULL,
(void *) (l_addr + r->r_offset));
-
-#ifndef RTLD_BOOTSTRAP
- /* This is defined in rtld.c, but nowhere in the static libc.a; make
- the reference weak so static programs can still link. This
- declaration cannot be done when compiling rtld.c (i.e. #ifdef
- RTLD_BOOTSTRAP) because rtld.c contains the common defn for
- _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. */
-#endif
- for (; r < endrel; ++r)
- elf_machine_rel_relative (l_addr, r,
- (void *) (l_addr + r->r_offset));
}
}