public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] readelf -d RELASZ excludes .rela.plt size
@ 2023-08-09  9:30 mengqinggang
  2023-08-09 15:01 ` Fangrui Song
  0 siblings, 1 reply; 2+ messages in thread
From: mengqinggang @ 2023-08-09  9:30 UTC (permalink / raw)
  To: binutils
  Cc: xuchenghua, chenglulu, liuzhensong, xry111, i.swmail, maskray,
	mengqinggang

Before, readelf -d RELASZ is the sum of .rela.dyn size and .rela.plt size.
To consistent with LoongArch lld, RELASZ chang to only the size of .rela.dyn.
---
 bfd/elfnn-loongarch.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 70a666283af..5d5ca19d490 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -4663,4 +4663,6 @@ elf_loongarch64_hash_symbol (struct elf_link_hash_entry *h)
 #define elf_backend_hash_symbol elf_loongarch64_hash_symbol
 #define bfd_elfNN_bfd_relax_section loongarch_elf_relax_section
 
+#define elf_backend_dtrel_excludes_plt 1
+
 #include "elfNN-target.h"
-- 
2.36.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] readelf -d RELASZ excludes .rela.plt size
  2023-08-09  9:30 [PATCH] readelf -d RELASZ excludes .rela.plt size mengqinggang
@ 2023-08-09 15:01 ` Fangrui Song
  0 siblings, 0 replies; 2+ messages in thread
From: Fangrui Song @ 2023-08-09 15:01 UTC (permalink / raw)
  To: mengqinggang
  Cc: binutils, xuchenghua, chenglulu, liuzhensong, xry111, i.swmail, maskray

On Wed, Aug 9, 2023 at 5:30 AM mengqinggang <mengqinggang@loongson.cn> wrote:
>
> Before, readelf -d RELASZ is the sum of .rela.dyn size and .rela.plt size.
> To consistent with LoongArch lld, RELASZ chang to only the size of .rela.dyn.
> ---
>  bfd/elfnn-loongarch.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
> index 70a666283af..5d5ca19d490 100644
> --- a/bfd/elfnn-loongarch.c
> +++ b/bfd/elfnn-loongarch.c
> @@ -4663,4 +4663,6 @@ elf_loongarch64_hash_symbol (struct elf_link_hash_entry *h)
>  #define elf_backend_hash_symbol elf_loongarch64_hash_symbol
>  #define bfd_elfNN_bfd_relax_section loongarch_elf_relax_section
>
> +#define elf_backend_dtrel_excludes_plt 1
> +
>  #include "elfNN-target.h"
> --
> 2.36.0
>

LGTM. glibc rtld supports overlapping [DT_RELA,DT_RELA+DT_RELASZ) and
[DT_JMPREL,DT_JMPREL+DT_PLTRELSZ).

I suspect that this is inherited (in the 1990s) from older loaders
that added DT_JMPREL as an optimization without breaking existing
loaders not supporting DT_JMPREL. This design choice is not good for
modern architectures that support DT_JMPREL since the beginning.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-09 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-09  9:30 [PATCH] readelf -d RELASZ excludes .rela.plt size mengqinggang
2023-08-09 15:01 ` Fangrui Song

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