public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: YunQiang Su <yunqiang.su@cipunited.com>
To: binutils@sourceware.org
Cc: macro@orcam.me.uk, YunQiang Su <yunqiang.su@cipunited.com>
Subject: [PATCH] MIPS: N64, mark .interp as INITIAL_READONLY_SECTIONS
Date: Fri, 30 Jun 2023 14:45:59 +0800	[thread overview]
Message-ID: <20230630064559.2282365-1-yunqiang.su@cipunited.com> (raw)

In ld/emulparams/elf64bmip-defs.sh, there is no .interp, which make
the .interp section appears after some other less important sections.

Let's add it, and mark it as INITIAL_READONLY_SECTIONS, just like
O32/N32 do.

This changes fixes ld/pr23658-2.

ld/ChangeLog:
	* emulparams/elf64bmip-defs.sh: mark .interp as
	INITIAL_READONLY_SECTIONS.
	* testsuite/ld-mips-elf/pie-n64.d: adjust addresses.
---
 ld/emulparams/elf64bmip-defs.sh    |  6 +++++-
 ld/testsuite/ld-mips-elf/pie-n64.d | 12 ++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/ld/emulparams/elf64bmip-defs.sh b/ld/emulparams/elf64bmip-defs.sh
index 4165f51e9e5..19d782d8e7a 100644
--- a/ld/emulparams/elf64bmip-defs.sh
+++ b/ld/emulparams/elf64bmip-defs.sh
@@ -1,6 +1,10 @@
 source_sh ${srcdir}/emulparams/elf32bmipn32-defs.sh
 COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
-INITIAL_READONLY_SECTIONS="
+INITIAL_READONLY_SECTIONS=
+if test -z "${CREATE_SHLIB}"; then
+  INITIAL_READONLY_SECTIONS=".interp       ${RELOCATING-0} : { *(.interp) }"
+fi
+INITIAL_READONLY_SECTIONS="${INITIAL_READONLY_SECTIONS}
   .MIPS.abiflags      ${RELOCATING-0} : { *(.MIPS.abiflags) }
   .MIPS.xhash      ${RELOCATING-0} : { *(.MIPS.xhash) }
   .MIPS.options : { *(.MIPS.options) }
diff --git a/ld/testsuite/ld-mips-elf/pie-n64.d b/ld/testsuite/ld-mips-elf/pie-n64.d
index bf7c6b2272a..1fda2512c8e 100644
--- a/ld/testsuite/ld-mips-elf/pie-n64.d
+++ b/ld/testsuite/ld-mips-elf/pie-n64.d
@@ -2,16 +2,16 @@
 #ld: -pie
 #readelf: -d
 
-Dynamic section at offset 0x208 contains 17 entries:
+Dynamic section at offset 0x220 contains 17 entries:
   Tag * Type * Name/Value
- 0x0+00000004 \(HASH\) * 0x368
- 0x0+00000005 \(STRTAB\) * 0x3c8
- 0x0+00000006 \(SYMTAB\) * 0x380
+ 0x0+00000004 \(HASH\) * 0x380
+ 0x0+00000005 \(STRTAB\) * 0x3e0
+ 0x0+00000006 \(SYMTAB\) * 0x398
  0x0+0000000a \(STRSZ\) * 28 \(bytes\)
  0x0+0000000b \(SYMENT\) * 24 \(bytes\)
- 0x0+70000035 \(MIPS_RLD_MAP_REL\) * 0x101c8
+ 0x0+70000035 \(MIPS_RLD_MAP_REL\) * 0x101a0
  0x0+00000015 \(DEBUG\) * 0x0
- 0x0+00000003 \(PLTGOT\) * 0x10430
+ 0x0+00000003 \(PLTGOT\) * 0x10420
  0x0+70000001 \(MIPS_RLD_VERSION\) * 1
  0x0+70000005 \(MIPS_FLAGS\) * NOTPOT
  0x0+70000006 \(MIPS_BASE_ADDRESS\) * 0x0
-- 
2.30.2


             reply	other threads:[~2023-06-30  6:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30  6:45 YunQiang Su [this message]
2023-07-13  5:40 ` YunQiang Su
2023-07-28  5:29 ` Maciej W. Rozycki
2023-07-28  5:50   ` YunQiang Su

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=20230630064559.2282365-1-yunqiang.su@cipunited.com \
    --to=yunqiang.su@cipunited.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).