[PATCH] MIPS: N64, mark .interp as INITIAL_READONLY_SECTIONS

YunQiang Su wzssyqa@gmail.com
Thu Jul 13 05:40:27 GMT 2023


YunQiang Su <yunqiang.su@cipunited.com> 于2023年6月30日周五 14:46写道:
>
> 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.
>

ping

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


-- 
YunQiang Su


More information about the Binutils mailing list