public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
Date: Wed, 20 Aug 2025 22:17:58 +0000 (UTC)	[thread overview]
Message-ID: <1755728266.2020f0c37a487cbf01e87b6e923e9cb3dbed0087.sam@gentoo> (raw)

commit:     2020f0c37a487cbf01e87b6e923e9cb3dbed0087
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 20 22:17:46 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Aug 20 22:17:46 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=2020f0c3

9999: switch to H.J.'s section size patch

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...ntsize-when-clearing-SEC_MERGE-SEC_STRING.patch | 87 ++++++++++++++++++++++
 9999/0006-ld-section-size.patch                    | 75 -------------------
 2 files changed, 87 insertions(+), 75 deletions(-)

diff --git a/9999/0006-elf-Clear-entsize-when-clearing-SEC_MERGE-SEC_STRING.patch b/9999/0006-elf-Clear-entsize-when-clearing-SEC_MERGE-SEC_STRING.patch
new file mode 100644
index 0000000..b9c30be
--- /dev/null
+++ b/9999/0006-elf-Clear-entsize-when-clearing-SEC_MERGE-SEC_STRING.patch
@@ -0,0 +1,87 @@
+From 3e39ade99e4e24f741c7d5631412e89d1bc5bde4 Mon Sep 17 00:00:00 2001
+Message-ID: <3e39ade99e4e24f741c7d5631412e89d1bc5bde4.1755728184.git.sam@gentoo.org>
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Wed, 20 Aug 2025 12:27:53 -0700
+Subject: [PATCH] elf: Clear entsize when clearing SEC_MERGE|SEC_STRINGS
+
+When generating an output from input SEC_MERGE|SEC_STRINGS sections with
+different entsize, we clear the SEC_MERGE|SEC_STRINGS bits.  We also need
+to clear entsize.
+
+	PR ld/33291
+	* ldlang.c (lang_add_section): Clearing entsize when clearing
+	SEC_MERGE|SEC_STRINGS.
+	* testsuite/ld-elf/pr33291.d: New file.
+	* testsuite/ld-elf/pr33291a.s: Likewise.
+	* testsuite/ld-elf/pr33291b.s: Likewise.
+
+Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
+---
+ ld/ldlang.c                    | 1 +
+ ld/testsuite/ld-elf/pr33291.d  | 9 +++++++++
+ ld/testsuite/ld-elf/pr33291a.s | 8 ++++++++
+ ld/testsuite/ld-elf/pr33291b.s | 7 +++++++
+ 4 files changed, 25 insertions(+)
+ create mode 100644 ld/testsuite/ld-elf/pr33291.d
+ create mode 100644 ld/testsuite/ld-elf/pr33291a.s
+ create mode 100644 ld/testsuite/ld-elf/pr33291b.s
+
+diff --git a/ld/ldlang.c b/ld/ldlang.c
+index 8ba95b04e23..0bb4a17df19 100644
+--- a/ld/ldlang.c
++++ b/ld/ldlang.c
+@@ -2861,6 +2861,7 @@ lang_add_section (lang_statement_list_type *ptr,
+ 	      && output->bfd_section->entsize != section->entsize))
+ 	{
+ 	  output->bfd_section->flags &= ~ (SEC_MERGE | SEC_STRINGS);
++	  output->bfd_section->entsize = 0;
+ 	  flags &= ~ (SEC_MERGE | SEC_STRINGS);
+ 	}
+     }
+diff --git a/ld/testsuite/ld-elf/pr33291.d b/ld/testsuite/ld-elf/pr33291.d
+new file mode 100644
+index 00000000000..9f08118433e
+--- /dev/null
++++ b/ld/testsuite/ld-elf/pr33291.d
+@@ -0,0 +1,9 @@
++#source: pr33291a.s
++#source: pr33291b.s
++#ld: -shared
++#readelf: -S --wide
++#xfail: ![check_shared_lib_support] 
++
++#...
++  \[[ 0-9]+\] \.rodata[ 	]+PROGBITS[ 	]+[0-9a-f]+ [0-9a-f]+ 0+9 00 +A +0 +0 +8
++#...
+diff --git a/ld/testsuite/ld-elf/pr33291a.s b/ld/testsuite/ld-elf/pr33291a.s
+new file mode 100644
+index 00000000000..07e9f7c2c21
+--- /dev/null
++++ b/ld/testsuite/ld-elf/pr33291a.s
+@@ -0,0 +1,8 @@
++	.globl	foo
++	.section	.rodata.cst8,"aM",%progbits,8
++	.align 8
++	.type	foo, %object
++	.size	foo, 8
++foo:
++	.quad	131073
++	.section	.note.GNU-stack,"",%progbits
+diff --git a/ld/testsuite/ld-elf/pr33291b.s b/ld/testsuite/ld-elf/pr33291b.s
+new file mode 100644
+index 00000000000..69f6b3db594
+--- /dev/null
++++ b/ld/testsuite/ld-elf/pr33291b.s
+@@ -0,0 +1,7 @@
++	.globl	bar
++	.section	.rodata.cst1,"aM",%progbits,1
++	.type	bar, %object
++	.size	bar, 1
++bar:
++	.byte	1
++	.section	.note.GNU-stack,"",%progbits
+
+base-commit: fbcdc06c238be4fd6da7fb9bff4dd4c7f749ae07
+-- 
+2.51.0
+

diff --git a/9999/0006-ld-section-size.patch b/9999/0006-ld-section-size.patch
deleted file mode 100644
index 7526cbd..0000000
--- a/9999/0006-ld-section-size.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 79b01a9700c96203028dc8c9472e91c38eda5e83 Mon Sep 17 00:00:00 2001
-Message-ID: <79b01a9700c96203028dc8c9472e91c38eda5e83.1755600645.git.sam@gentoo.org>
-From: Jan Beulich <jbeulich@suse.com>
-Date: Tue, 19 Aug 2025 10:35:38 +0200
-Subject: [PATCH] ld: entry size and merge/strings attributes propagation
-
-PR ld/33291
-
-As indicated in other recent commits, the three properties can be
-largely independent (ELF generally being the target here): Entry size
-doesn't require either of merge/strings, and strings also doesn't
-require merge. Commit 98e6d3f5bd4e ("gas/ELF: allow specifying entity
-size for arbitrary sections") uncovered issues with ld's handling.
-
-Zap entry size when it doesn't match between input sections. In that
-case SEC_MERGE and SEC_STRINGS also need to be removed, as their
-underlying granularity is lost. Then deal with SEC_MERGE and
-SEC_STRINGS separately.
-
-Otoh record entry size from the first input independent of SEC_MERGE.
----
- ld/ldlang.c | 27 ++++++++++++++++++---------
- 1 file changed, 18 insertions(+), 9 deletions(-)
-
-diff --git a/ld/ldlang.c b/ld/ldlang.c
-index 8ba95b04e23..54292a8dfe1 100644
---- a/ld/ldlang.c
-+++ b/ld/ldlang.c
-@@ -2854,14 +2854,24 @@ lang_add_section (lang_statement_list_type *ptr,
-       /* Only set SEC_READONLY flag on the first input section.  */
-       flags &= ~ SEC_READONLY;
- 
--      /* Keep SEC_MERGE and SEC_STRINGS only if they are the same.  */
--      if ((output->bfd_section->flags & (SEC_MERGE | SEC_STRINGS))
--	  != (flags & (SEC_MERGE | SEC_STRINGS))
--	  || ((flags & SEC_MERGE) != 0
--	      && output->bfd_section->entsize != section->entsize))
-+      /* Keep entry size, SEC_MERGE, and SEC_STRINGS only if entry sizes are
-+	 the same.  */
-+      if (output->bfd_section->entsize != section->entsize)
- 	{
--	  output->bfd_section->flags &= ~ (SEC_MERGE | SEC_STRINGS);
--	  flags &= ~ (SEC_MERGE | SEC_STRINGS);
-+	  output->bfd_section->entsize = 0;
-+	  flags &= ~(SEC_MERGE | SEC_STRINGS);
-+	}
-+
-+      /* Keep SEC_MERGE and SEC_STRINGS (each) only if they are the same.  */
-+      if ((output->bfd_section->flags ^ flags) & SEC_MERGE)
-+	{
-+	  output->bfd_section->flags &= ~SEC_MERGE;
-+	  flags &= ~SEC_MERGE;
-+	}
-+      if ((output->bfd_section->flags ^ flags) & SEC_STRINGS)
-+	{
-+	  output->bfd_section->flags &= ~SEC_STRINGS;
-+	  flags &= ~SEC_STRINGS;
- 	}
-     }
-   output->bfd_section->flags |= flags;
-@@ -2876,8 +2886,7 @@ lang_add_section (lang_statement_list_type *ptr,
- 				     link_info.output_bfd,
- 				     output->bfd_section,
- 				     &link_info);
--      if ((flags & SEC_MERGE) != 0)
--	output->bfd_section->entsize = section->entsize;
-+      output->bfd_section->entsize = section->entsize;
-     }
- 
-   if ((flags & SEC_TIC54X_BLOCK) != 0
-
-base-commit: 09292f4ae2ccb46130652f6b310ee7a5227326d3
--- 
-2.51.0
-


             reply	other threads:[~2025-08-20 22:18 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 22:17 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-10-11  6:40 [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/ Sam James
2025-10-11  0:46 Sam James
2025-10-11  0:46 Sam James
2025-10-10  5:41 Sam James
2025-10-10  5:28 Sam James
2025-10-10  5:28 Sam James
2025-10-10  5:25 Sam James
2025-10-10  4:57 Sam James
2025-08-29 13:40 Sam James
2025-08-28 20:21 Sam James
2025-08-28 13:51 Sam James
2025-08-28  5:32 Sam James
2025-08-27 16:26 Sam James
2025-08-27  4:05 Sam James
2025-08-27  2:49 Sam James
2025-08-25  2:49 Sam James
2025-08-20 23:30 Sam James
2025-08-20 22:17 Sam James
2025-08-20 20:44 Sam James
2025-08-20  4:39 Sam James
2025-08-19 20:54 Sam James
2025-08-19 17:11 Sam James
2025-08-19 16:28 Sam James
2025-08-19 10:51 Sam James
2025-08-19  3:48 Sam James
2025-08-18 20:21 Sam James
2025-08-18 20:21 Sam James
2025-08-18 20:19 Sam James
2025-08-18 15:39 Sam James
2025-08-17 20:58 Sam James
2025-08-17 19:45 Sam James
2025-08-06 13:19 Sam James
2025-08-06  4:07 Sam James
2025-08-06  1:08 Sam James
2025-08-05 20:21 Sam James
2025-08-04 21:43 Sam James
2025-08-04 21:05 Sam James
2025-08-04 15:32 Sam James
2025-08-04 11:06 Sam James
2025-08-03 23:43 Sam James
2025-08-01 11:28 Sam James
2025-08-01  8:17 Sam James
2025-07-31 11:39 Sam James
2025-07-28 12:24 Andreas K. Hüttel
2025-07-24 17:25 Sam James
2025-07-24  4:03 Sam James
2025-07-24  3:46 Sam James
2025-07-23 22:37 Sam James
2025-06-14 21:52 Sam James
2025-06-13  8:00 Sam James
2025-05-14  7:14 Sam James
2025-05-14  3:59 Sam James
2025-05-05  9:46 Sam James
2025-05-05  3:06 Sam James
2025-05-04 10:15 Sam James
2025-04-10 17:35 Sam James
2025-04-09  2:24 Sam James
2025-04-08  0:36 Sam James
2025-03-29 14:18 Sam James
2025-03-12 20:21 Sam James
2025-03-06 12:54 Sam James
2025-03-06  4:54 Sam James
2025-02-03 18:02 Andreas K. Hüttel
2025-01-14  2:09 Sam James
2025-01-13  6:11 Sam James
2025-01-02 13:48 Sam James
2025-01-01 14:05 Sam James
2024-12-26  1:21 Sam James
2024-12-24  6:27 Sam James
2024-12-21  0:09 Sam James
2024-08-03 22:43 Andreas K. Hüttel
2024-06-29 17:05 Andreas K. Hüttel
2024-06-29 16:32 Andreas K. Hüttel
2024-06-29 16:32 Andreas K. Hüttel
2024-06-28 21:48 Andreas K. Hüttel
2023-10-27  0:44 Sam James
2023-10-27  0:44 Sam James
2023-07-30 14:49 Andreas K. Hüttel
2023-07-28 16:23 Andreas K. Hüttel
2023-06-30  9:21 WANG Xuerui
2023-04-02 11:44 Andreas K. Hüttel
2023-01-05 16:22 Andreas K. Hüttel
2023-01-05 16:21 Andreas K. Hüttel
2023-01-03 23:03 Andreas K. Hüttel
2023-01-02 23:50 Andreas K. Hüttel
2022-10-08 12:15 WANG Xuerui
2022-07-29  7:55 WANG Xuerui
2022-01-15 22:27 Andreas K. Hüttel
2021-08-17 20:07 Andreas K. Hüttel
2021-07-30 23:25 Andreas K. Hüttel
2021-07-24 20:57 Andreas K. Hüttel
2021-07-20 19:53 Andreas K. Hüttel
2021-07-20 19:50 Andreas K. Hüttel
2021-07-06  7:04 Sergei Trofimovich
2021-07-06  7:04 Sergei Trofimovich
2021-07-06  7:04 Sergei Trofimovich
2020-07-25 17:27 Andreas K. Hüttel
2020-07-25 12:26 Andreas K. Hüttel
2020-07-25 12:23 Andreas K. Hüttel
2020-07-25 12:20 Andreas K. Hüttel
2020-05-19 21:12 Andreas K. Hüttel

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=1755728266.2020f0c37a487cbf01e87b6e923e9cb3dbed0087.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /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