public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: binutils@sourceware.org
Subject: Re: BFD_RELOC_MIPS_16
Date: Thu, 4 Aug 2022 13:07:23 +0930	[thread overview]
Message-ID: <Yus+80qfhldCWxy0@squeak.grove.modra.org> (raw)
In-Reply-To: <alpine.DEB.2.21.2208030034410.27239@angie.orcam.me.uk>

On Wed, Aug 03, 2022 at 12:59:09AM +0100, Maciej W. Rozycki wrote:
> On Tue, 14 Jun 2022, Alan Modra via Binutils wrote:
> 
> > time.  Like BFD_RELOC_8, BFD_RELOC_16 now has no corresponding object
> > file relocation, and thus .half, .hword, .short and .dc.w must be
> > resolved at assembly time.
> 
>  That should be R_MIPS_REL16 AFAICT, reloc #33 according to MIPS NewABI 
> documentation[1]:
> 
>     Name      Value  Field   Symbol  Calculation
> R_MIPS_REL16   33    V-hw16   any        S+A

Huh.  So R_MIPS_REL16 isn't a pc-relative reloc as the name might
indicate.  I'll apply the following.

	* elf64-mips.c (mips_reloc_map): Map BFD_RELOC_16 to R_MIPS_REL16.
	* elfn32-mips.c (mips_reloc_map): Likewise.

diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index 8097e7cd49d..c2c6604ef68 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -3684,6 +3684,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
 {
   { BFD_RELOC_NONE, R_MIPS_NONE },
   { BFD_RELOC_MIPS_16, R_MIPS_16 },
+  { BFD_RELOC_16, R_MIPS_REL16 },
   { BFD_RELOC_32, R_MIPS_32 },
   /* There is no BFD reloc for R_MIPS_REL32.  */
   { BFD_RELOC_64, R_MIPS_64 },
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index 7cae394bfa0..af984545796 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -3514,6 +3514,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
 {
   { BFD_RELOC_NONE, R_MIPS_NONE },
   { BFD_RELOC_MIPS_16, R_MIPS_16 },
+  { BFD_RELOC_16, R_MIPS_REL16 },
   { BFD_RELOC_32, R_MIPS_32 },
   /* There is no BFD reloc for R_MIPS_REL32.  */
   { BFD_RELOC_CTOR, R_MIPS_32 },


-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2022-08-04  3:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14  0:34 BFD_RELOC_MIPS_16 Alan Modra
2022-08-02 23:59 ` BFD_RELOC_MIPS_16 Maciej W. Rozycki
2022-08-04  3:37   ` Alan Modra [this message]
2022-08-05 15:13     ` BFD_RELOC_MIPS_16 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=Yus+80qfhldCWxy0@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=macro@orcam.me.uk \
    /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).