From fa19d5c48a6b36518ce68412e3bdde6bfa8aa4a6 Mon Sep 17 00:00:00 2001 From: Petar Jovanovic Date: Wed, 20 Aug 2014 00:50:54 +0200 Subject: 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. --- elf/dynamic-link.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'elf/dynamic-link.h') 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); \ } \ } \ \ -- cgit v1.2.3