This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v7] Fix dynamic linker issue with bind-now
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Petar Jovanovic <petar dot jovanovic at rt-rk dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, Roland McGrath <roland at hack dot frob dot com>, Mike Frysinger <vapier at gentoo dot org>, Andreas Schwab <schwab at linux-m68k dot org>
- Date: Wed, 15 Jul 2015 19:33:00 -0700
- Subject: Re: [PATCH v7] Fix dynamic linker issue with bind-now
- Authentication-results: sourceware.org; auth=none
- References: <000301d0bf45$1789a650$469cf2f0$ at rt-rk dot com>
On Wed, Jul 15, 2015 at 2:27 PM, Petar Jovanovic
<petar.jovanovic@rt-rk.com> wrote:
> Fix the bind-now case when DT_REL and DT_JMPREL sections are separate
> and there is a gap between them. This patch fixes bug #14341.
> ---
> v7:
> - make "bar" a const, as suggested by H.J. Lu
>
> v6:
> - Addressed comments by H.J. Lu
> - modified the test to fail with the latest binutils
> - style changes addressed
>
> v5:
> - Added a ChangeLog entry and bug number into commit message.
>
> v4:
> - Moved the Makefile part into sysdeps/x86_64/Makefile, so the test is
> executed for x86-64 only
>
> v3:
> - addressed comments raised by Mike Frysinger
> - use of test-skeleton.c
> - use -Wl,-z,now instead of LD_BIND_NOW=1
> - moved comments to the start of the test file
>
> v2:
> - addressed all comments raised by Andreas Schwab
>
> ChangeLog entry:
>
> 2015-07-15 Petar Jovanovic <petar.jovanovic@rt-rk.com>
>
> [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.
> * elf/tst-split-dynreloc.c: New file.
> * elf/tst-split-dynreloc.lds: New file.
> * sysdeps/x86_64/Makefile: Add new test.
How about changing the condition to
if (ELF_DURING_STARTUP \
|| (!(do_lazy) \
&& (ranges[0].start + ranges[0].size) == start)) \
{ \
/* Combine processing the sections. */ \
ranges[0].size += size; \
} \
else \
{ \
ranges[1].start = start; \
ranges[1].size = size; \
ranges[1].lazy = (do_lazy); \
} \
}
It is simpler and easier to understand.
--
H.J.