This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 2/3] MIPS/BFD: Correct IRIX 6 DT_MIPS_OPTIONS processing
On Sun, 12 Aug 2012, Richard Sandiford wrote:
> > Index: binutils-fsf-trunk-quilt/bfd/elfxx-mips.c
> > ===================================================================
> > --- binutils-fsf-trunk-quilt.orig/bfd/elfxx-mips.c 2012-07-26 03:29:00.000000000 +0100
> > +++ binutils-fsf-trunk-quilt/bfd/elfxx-mips.c 2012-07-26 04:45:31.560520511 +0100
> > @@ -9268,11 +9268,17 @@ _bfd_mips_elf_size_dynamic_sections (bfd
> > && ! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_HIPAGENO, 0))
> > return FALSE;
> >
> > - if (IRIX_COMPAT (dynobj) == ict_irix6
> > - && (bfd_get_section_by_name
> > - (dynobj, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj)))
> > - && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0))
> > - return FALSE;
> > + if (IRIX_COMPAT (dynobj) == ict_irix6)
> > + {
> > + const char *const name = MIPS_ELF_OPTIONS_SECTION_NAME (dynobj);
> > + asection *opt_sec;
> > +
> > + opt_sec = bfd_get_section_by_name (dynobj, name);
> > + if (opt_sec != NULL
> > + && opt_sec->output_section != bfd_abs_section_ptr
> > + && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0))
> > + return FALSE;
> > + }
> > }
>
> Looks to me like the code was simply checking the wrong bfd.
> It should be checking output_bfd instead.
Doh, this seems to work for me. No regressions on the 23 MIPS targets.
OK for this one instead?
2012-08-13 Maciej W. Rozycki <macro@codesourcery.com>
bfd/
* elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Look up
the options section in the output rather than input BFD to
decide if to add a DT_MIPS_OPTIONS tag.
Maciej
binutils-bfd-mips-irix-options.diff
Index: binutils-fsf-trunk-quilt/bfd/elfxx-mips.c
===================================================================
--- binutils-fsf-trunk-quilt.orig/bfd/elfxx-mips.c 2012-08-13 12:40:13.090607382 +0100
+++ binutils-fsf-trunk-quilt/bfd/elfxx-mips.c 2012-08-13 12:41:25.821821636 +0100
@@ -9282,7 +9282,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd
if (IRIX_COMPAT (dynobj) == ict_irix6
&& (bfd_get_section_by_name
- (dynobj, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj)))
+ (output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj)))
&& !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0))
return FALSE;
}