summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@rt-rk.com>2014-08-20 00:50:54 +0200
committerH.J. Lu <hjl.tools@gmail.com>2015-08-19 05:37:01 -0700
commitfa19d5c48a6b36518ce68412e3bdde6bfa8aa4a6 (patch)
treefeace153d8cbcbcf965076a32bdceee33d5c9895 /elf
parent33c898d1607c1b8dac69c76eec289980292ebfc2 (diff)
downloadglibc-fa19d5c48a6b36518ce68412e3bdde6bfa8aa4a6.tar.gz
Fix dynamic linker issue with bind-now
Fix the bind-now case when DT_REL and DT_JMPREL sections are separate and there is a gap between them. [BZ #14341] * elf/dynamic-link.h (elf_machine_lazy_rel): Properly handle the case when there is a gap between DT_REL and DT_JMPREL sections. * sysdeps/x86_64/Makefile (tests): Add tst-split-dynreloc. (LDFLAGS-tst-split-dynreloc): New. (tst-split-dynreloc-ENV): Likewise. * sysdeps/x86_64/tst-split-dynreloc.c: New file. * sysdeps/x86_64/tst-split-dynreloc.lds: Likewise.
Diffstat (limited to 'elf')
-rw-r--r--elf/dynamic-link.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index 8d428e20d3..d7cff482d4 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -135,16 +135,18 @@ elf_machine_lazy_rel (struct link_map *map,
\
if (ranges[0].start + ranges[0].size == (start + size)) \
ranges[0].size -= size; \
- if (! ELF_DURING_STARTUP && ((do_lazy) || ranges[0].size == 0)) \
+ if (ELF_DURING_STARTUP \
+ || (!(do_lazy) \
+ && (ranges[0].start + ranges[0].size) == start)) \
{ \
- ranges[1].start = start; \
- ranges[1].size = size; \
- ranges[1].lazy = (do_lazy); \
+ /* Combine processing the sections. */ \
+ ranges[0].size += size; \
} \
else \
{ \
- /* Combine processing the sections. */ \
- ranges[0].size += size; \
+ ranges[1].start = start; \
+ ranges[1].size = size; \
+ ranges[1].lazy = (do_lazy); \
} \
} \
\