public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Cc: Chenghua Xu <paul.hua.gm@gmail.com>,
	"Maciej W. Rozycki" <macro@orcam.me.uk>
Subject: R_MIP16_GOT16 and R_MICROMIPS_GOT16
Date: Tue, 2 Apr 2024 11:37:35 +1030	[thread overview]
Message-ID: <ZgtaVzrSeIqRopT4@squeak.grove.modra.org> (raw)
In-Reply-To: <ZgtaG0H6RkTQlPtf@squeak.grove.modra.org>

In rela howtos these relocations should not be using
_bfd_mips_elf_got16_reloc.  That special function is for extracting
addends from section contents, and only for that (ie. it doesn't
subtract gp).  Make these rela howtos like the corresponding
R_MIPS_GOT16 rela howto.

	* elf64-mips.c (mips16_elf64_howto_table_rela <R_MIPS16_GOT16>):
	Use _bfd_mips_elf_generic_reloc.
	(micromips_elf64_howto_table_rela <R_MICROMIPS_GOT16>): Likewise.
	* elfn32-mips.c (elf_mips16_howto_table_rela <R_MIPS16_GOT16>):
	Likewise.
	(elf_micromips_howto_table_rela <R_MICROMIPS_GOT16>): Likewise.

OK?

diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index b4509fb13f2..e83230cef97 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -1931,7 +1931,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] =
 	 false,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_dont, /* complain_on_overflow */
-	 _bfd_mips_elf_got16_reloc, /* special_function */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS16_GOT16",	/* name */
 	 false,			/* partial_inplace */
 	 0,			/* src_mask */
@@ -2675,7 +2675,7 @@ static reloc_howto_type micromips_elf64_howto_table_rela[] =
 	 false,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 _bfd_mips_elf_got16_reloc, /* special_function */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MICROMIPS_GOT16",	/* name */
 	 false,			/* partial_inplace */
 	 0,			/* src_mask */
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index 3e9153cde14..432805aeeb2 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -1911,7 +1911,7 @@ static reloc_howto_type elf_mips16_howto_table_rela[] =
 	 false,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_dont, /* complain_on_overflow */
-	 _bfd_mips_elf_got16_reloc, /* special_function */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS16_GOT16",	/* name */
 	 false,			/* partial_inplace */
 	 0,			/* src_mask */
@@ -2655,7 +2655,7 @@ static reloc_howto_type elf_micromips_howto_table_rela[] =
 	 false,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 _bfd_mips_elf_got16_reloc, /* special_function */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MICROMIPS_GOT16",	/* name */
 	 false,			/* partial_inplace */
 	 0,			/* src_mask */

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2024-04-02  1:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02  1:05 MIPS HI16 and LO16 reloc howtos Alan Modra
2024-04-02  1:06 ` MIPS reloc howto special_function entries Alan Modra
2024-04-02  1:07   ` Alan Modra [this message]
2024-04-02  1:08     ` MIPS linker changes for TLS HI16/LO16 relocs Alan Modra
2024-04-02 11:19 ` MIPS HI16 and LO16 reloc howtos 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=ZgtaVzrSeIqRopT4@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=macro@orcam.me.uk \
    --cc=paul.hua.gm@gmail.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).