public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rdsandiford@googlemail.com>
To: "Fu\, Chao-Ying" <fu@mips.com>
Cc: "Maciej W. Rozycki" <macro@codesourcery.com>,  "Garbacea\,
	Ilie" <ilie@mips.com>,  Joseph Myers <joseph@codesourcery.com>,
	 "binutils\@sourceware.org" <binutils@sourceware.org>,  "Fuhler\,
	Rich" <rich@mips.com>,  "Lau\, David" <davidlau@mips.com>,
	 "Mills\, Kevin" <kevinm@mips.com>,
	 Catherine Moore <clm@codesourcery.com>,
	 Nathan Sidwell <nathan@codesourcery.com>,
	 Nathan Froyd <froydnj@codesourcery.com>
Subject: Re: [PATCH] MIPS: microMIPS ASE support
Date: Sat, 18 Dec 2010 10:09:00 -0000	[thread overview]
Message-ID: <871v5fbeg9.fsf@firetop.home> (raw)
In-Reply-To: <7C6479EB2BF52547AC332FD6034646DA3018F765@exchdb02.mips.com>	(Chao-Ying Fu's message of "Fri, 17 Dec 2010 19:55:44 +0000")

"Fu, Chao-Ying" <fu@mips.com> writes:
>> > > +  /* Now adjust the global symbols defined in this section.  */
>> > > +  symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)
>> > > +	      - symtab_hdr->sh_info);
>> > > +  sym_hashes = start_hashes = elf_sym_hashes (abfd);
>> > > +  end_hashes = sym_hashes + symcount;
>> > > +
>> > > +  for (; sym_hashes < end_hashes; sym_hashes++)
>> > > +    {
>> > > +      struct elf_link_hash_entry *sym_hash = *sym_hashes;
>> > > +
>> > > +      if ((sym_hash->root.type == bfd_link_hash_defined
>> > > +	   || sym_hash->root.type == bfd_link_hash_defweak)
>> > > +	  && sym_hash->root.u.def.section == sec
>> > > +	  && sym_hash->root.u.def.value > addr
>> > > +	  && sym_hash->root.u.def.value < toaddr)
>> > > +	sym_hash->root.u.def.value -= count;
>> > > +    }
>> > 
>> > ...if we're willing to extend the upper bound in this way, I wonder
>> > whether there's really any point having an upper bound at all.
>> > 
>> > Then again, why doesn't the standard range (used by most targets)
>> > include toaddr?  If you define an end marker:
>> > 
>> > end_of_section:
>> > 	# nothing after this
>> > 
>> > then wouldn't end_of_section == toaddr, and shouldn't it be 
>> included?
>> 
>>  Ilie, I'm told you were responsible for this piece of code 
>> -- would you 
>> please respond to these questions?
>
>   I think we should include "end_of_section == toaddr".
> Ex:
> 	  && sym_hash->root.u.def.value <= toaddr)

I agree that's probably the best thing, although I admit the "Then again,"
question was really more general musing than a question about this patch.

To be more specific, the thing that worried me about this code was that:

- if the section ends with a microMIPS instruction and an end marker,
  the "value < toaddr" won't include the end marker.  (The end marker
  would be odd.)

- if the section ends with a normal MIPS instruction and an end marker,
  the "value < toaddr" _would_ include the end marker.  (The end marker
  would be even.)

That's the key difference between "toaddr |= 1 ... value < toaddr"
and "value &= -2 .... value < toaddr".  I think the latter is more
consistent.

I suggest removing:

+  BFD_ASSERT (toaddr % 2 == 0);
+  addr |= 1;
+  toaddr |= 1;

and instead masking the low bit off the u.def.value.  (Keep the other
two asserts though.  I certainly found them useful when reviewing
the code.)

>> > > +static unsigned long
>> > > +find_match (unsigned long opcode, const struct 
>> opcode_descriptor insn[])
>> > > +{
>> > > +    unsigned long indx;
>> > > +
>> > > +    /* First opcode_table[] entry is ignored.  */
>> > > +    for (indx = 1; insn[indx].mask != 0; indx++)
>> > > +      if (MATCH (opcode, insn[indx]))
>> > > +	return indx;
>> > > +
>> > > +    return 0;
>> > > +}
>> > 
>> > But _why_ is the first entry ignored?
>> 
>>  There must be a reason, Ilie?
>
>   I guess Ilie tries to avoid passing a single-entry table into find_match().
> But if we do pass a single-entry table into find_match(), 
> find_match() may not find the end marker and it will be wrong anyway.
> Maybe we just delete all the { 1, 1 } entry in opcode_descriptor [] tables, and
> find_match() doesn't ignore the first entry.
> And we make sure that each table has end marker at the end.

Yeah, I think that'd be better, thanks.

Richard

  reply	other threads:[~2010-12-18  9:47 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18 18:19 [PATCH] MIPS: microMIPS and MCU ASE instruction set support Maciej W. Rozycki
2010-05-23 21:38 ` Richard Sandiford
2010-05-24 22:25   ` Fu, Chao-Ying
2010-05-26 19:47     ` Richard Sandiford
2010-06-01 14:21   ` Maciej W. Rozycki
2010-06-01 14:39     ` Catherine Moore
2010-06-01 22:04     ` Richard Sandiford
2010-06-01 22:47     ` Fu, Chao-Ying
2010-06-05  9:17     ` Richard Sandiford
2010-07-26 10:56   ` [PATCH] MIPS: microMIPS ASE support Maciej W. Rozycki
2010-07-26 13:25     ` Nathan Froyd
2010-07-26 13:53       ` Maciej W. Rozycki
2010-07-26 19:03     ` Richard Sandiford
2010-12-07  1:13       ` Maciej W. Rozycki
2010-12-12 14:59         ` Richard Sandiford
2010-12-14 13:30           ` Maciej W. Rozycki
2010-12-14 14:51             ` Richard Sandiford
2010-12-16 11:54               ` Maciej W. Rozycki
2010-12-18 10:26                 ` Richard Sandiford
2010-12-14 17:56             ` Joseph S. Myers
2010-12-16 15:28               ` Maciej W. Rozycki
2010-12-17 20:56             ` Fu, Chao-Ying
2010-12-18 10:09               ` Richard Sandiford [this message]
2011-01-02 11:36         ` Richard Sandiford
2011-02-21 15:35           ` Maciej W. Rozycki
2011-02-22 20:12             ` Fu, Chao-Ying
2011-02-22 20:19             ` Fu, Chao-Ying
2011-02-24 10:46               ` Maciej W. Rozycki
2011-02-26 11:41                 ` Richard Sandiford
2011-02-28 16:41                   ` Maciej W. Rozycki
2011-02-26  0:00             ` Maciej W. Rozycki
2011-03-13  9:23               ` Richard Sandiford
2011-07-25  7:49                 ` Richard Sandiford
2011-07-26  2:01                   ` Maciej W. Rozycki
2011-07-29  0:58                     ` Maciej W. Rozycki
2011-07-29 11:30                       ` Richard Sandiford
2011-07-29 22:52                         ` Maciej W. Rozycki
2011-02-26 11:36             ` Richard Sandiford
2011-07-26 14:00               ` Maciej W. Rozycki
2010-05-26 20:19 ` [PATCH] MIPS: microMIPS and MCU ASE instruction set support Richard Sandiford
2010-05-27 21:39 ` Richard Sandiford

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=871v5fbeg9.fsf@firetop.home \
    --to=rdsandiford@googlemail.com \
    --cc=binutils@sourceware.org \
    --cc=clm@codesourcery.com \
    --cc=davidlau@mips.com \
    --cc=froydnj@codesourcery.com \
    --cc=fu@mips.com \
    --cc=ilie@mips.com \
    --cc=joseph@codesourcery.com \
    --cc=kevinm@mips.com \
    --cc=macro@codesourcery.com \
    --cc=nathan@codesourcery.com \
    --cc=rich@mips.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).