public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@codesourcery.com>
To: Richard Sandiford <rdsandiford@googlemail.com>
Cc: <binutils@sourceware.org>
Subject: Re: [PATCH 2/3] MIPS/BFD: Correct IRIX 6 DT_MIPS_OPTIONS processing
Date: Mon, 13 Aug 2012 14:10:00 -0000	[thread overview]
Message-ID: <alpine.DEB.1.10.1208131408250.20608@tp.orcam.me.uk> (raw)
In-Reply-To: <87mx20t0h9.fsf@talisman.home>

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;
 	}

  reply	other threads:[~2012-08-13 13:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-08 22:49 [PATCH 1/3] MIPS/BFD: Correct protected symbol relocation processing Maciej W. Rozycki
2012-08-08 22:50 ` [PATCH 2/3] MIPS/BFD: Correct IRIX 6 DT_MIPS_OPTIONS processing Maciej W. Rozycki
2012-08-12 18:50   ` Richard Sandiford
2012-08-13 14:10     ` Maciej W. Rozycki [this message]
2012-08-13 19:44       ` Richard Sandiford
2012-08-13 19:53         ` Maciej W. Rozycki
2012-08-09  1:28 ` [PATCH 3/3] MIPS/LD/test: Protected symbol relocation processing Maciej W. Rozycki
2012-08-12 18:51   ` Richard Sandiford
2012-08-13 21:41     ` Maciej W. Rozycki
2012-08-12 18:43 ` [PATCH 1/3] MIPS/BFD: Correct protected " Richard Sandiford
2012-08-13 13:24   ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.1.10.1208131408250.20608@tp.orcam.me.uk \
    --to=macro@codesourcery.com \
    --cc=binutils@sourceware.org \
    --cc=rdsandiford@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).