This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: ld/2462: -Wl,-s always output unused bytes at the end
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Paul Brook <paul at codesourcery dot com>
- Cc: binutils at sourceware dot org, Richard Sandiford <richard at codesourcery dot com>
- Date: Fri, 17 Mar 2006 06:32:22 -0800
- Subject: Re: PATCH: ld/2462: -Wl,-s always output unused bytes at the end
- References: <20060317140251.GA18212@lucon.org> <200603171418.24813.paul@codesourcery.com>
On Fri, Mar 17, 2006 at 02:18:24PM +0000, Paul Brook wrote:
> On Friday 17 March 2006 14:02, H. J. Lu wrote:
> > This is a regression caused by
> >
> > http://sourceware.org/ml/binutils/2005-05/msg00170.html
> >
> > If Paul has no problems with vxworks, I'd like to check it as an
> > obvious fix.
>
> > 2006-03-17 ?H.J. Lu ?<hongjiu.lu@intel.com>
> >
> > ????????PR ld/2462
> > ????????* elflink.c (elf_emit_relocs): New.
> > ????????(elf_link_input_bfd): Emit relocations only when needed. Call
> > ????????elf_emit_relocs instead of bed->elf_backend_emit_relocs.
> >
> > ????????* elfxx-target.h (elf_backend_emit_relocs): Default to NULL.
>
> I don't think this patch is even close to being "obvious".
>
Before your patch, _bfd_elf_link_output_relocs was called only for
relocatable files or finfo->info->emitrelocations is true. Now it
called on all ELF targets for all cases. My patch changes it back to
what it was before your change for all targets, except for those which
define elf_backend_emit_relocs. For those targets, elf_backend_emit_relocs
will always be called. If a target expects to call
_bfd_elf_link_output_relocs unconditionally, it should define
elf_backend_emit_relocs.
H.J.