This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: gold patch committed: Put .interp first
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 5 Nov 2009 10:37:39 -0700
- Subject: Re: gold patch committed: Put .interp first
- References: <mcrmy32nurj.fsf@dhcp-172-17-9-151.mtv.corp.google.com>
On Wed, Nov 4, 2009 at 9:02 AM, Ian Lance Taylor <iant@google.com> wrote:
> I got a report that on FreeBSD the .interp section must be in the
> first page of the executable. ?That is a good idea anyhow, since it
> tends to reduce the reading required by the kernel. ?This patch moves
> .interp first, followed by allocated non-writable note sections,
> followed by other sections used by the dynamic linker. ?This is what
> the GNU linker does.
>
> While implementing this, I discovered that if the first sections in
> the text segment are dynamic relocation sections, that objcopy and
> strip fail. ?The problem is in copy_elf_program_header: it ignores the
> relocation sections when setting first_section, and thus gets the
> wrong value for the program header size, and then later fails when it
> finds that it can't put the relocation sections at the offset they
> need. ?I didn't debug it further than that, since this is kind of an
> unusual case.
>
> This patch looks large but is almost entirely the mechanical addition
> of new parameters.
>
> Committed to mainline and 2.20 branch.
>
> Ian
>
>
> 2009-11-04 ?Ian Lance Taylor ?<iant@google.com>
>
> ? ? ? ?* layout.cc (Layout::get_output_section): Add is_interp and
> ? ? ? ?is_dynamic_linker_section parameters. ?Change all callers.
> ? ? ? ?(Layout::choose_output_section): Likewise.
> ? ? ? ?(Layout::make_output_section): Likewise.
> ? ? ? ?(Layout::add_output_section_data): Add is_dynamic_linker_section
> ? ? ? ?parameter. ?Change all callers.
> ? ? ? ?* layout.h (class Layout): Update declarations.
> ? ? ? ?* output.h (class Output_section): Add is_interp, set_is_interp,
> ? ? ? ?is_dynamic_linker_section, set_is_dynamic_linker_section methods.
> ? ? ? ?Add is_interp_, is_dynamic_linker_section_ fields. ?Change
> ? ? ? ?generate_code_fills_at_write_ to a bitfield.
> ? ? ? ?* output.cc (Output_section::Output_sections): Initialize new
> ? ? ? ?fields.
> ? ? ? ?(Output_segment::add_output_section): Add do_sort parameter.
> ? ? ? ?Change all callers.
>
>
>
This patch breaks gold:
http://www.sourceware.org/bugzilla/show_bug.cgi?id=10910
Also its ChangeLog entries didn't list all changes:
# modified: gold/arm.cc
# modified: gold/common.cc
# modified: gold/copy-relocs.cc
# modified: gold/i386.cc
# modified: gold/layout.cc
# modified: gold/layout.h
# modified: gold/output.cc
# modified: gold/output.h
# modified: gold/powerpc.cc
# modified: gold/script-sections.cc
# modified: gold/sparc.cc
# modified: gold/x86_64.cc
--
H.J.