commit:     db510fe7b24c057ed7e420dc88ab7a4108b256a9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 19 10:51:04 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 19 10:51:04 2025 +0000
URL:        
https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=db510fe7

9999: update section size patch

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

 9999/0006-ld-section-size.patch | 41 +++++++++++++++++++++++++++++++++++------
 1 file changed, 35 insertions(+), 6 deletions(-)

diff --git a/9999/0006-ld-section-size.patch b/9999/0006-ld-section-size.patch
index 70f6f28..7526cbd 100644
--- a/9999/0006-ld-section-size.patch
+++ b/9999/0006-ld-section-size.patch
@@ -1,7 +1,32 @@
-https://sourceware.org/bugzilla/show_bug.cgi?id=33291#c10
+From 79b01a9700c96203028dc8c9472e91c38eda5e83 Mon Sep 17 00:00:00 2001
+Message-ID: 
<79b01a9700c96203028dc8c9472e91c38eda5e83.1755600645.git....@gentoo.org>
+From: Jan Beulich <[email protected]>
+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
-@@ -2857,14 +2857,24 @@ lang_add_section (lang_statement_list_ty
+@@ -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;
  
@@ -33,14 +58,18 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=33291#c10
        }
      }
    output->bfd_section->flags |= flags;
-@@ -2879,8 +2889,9 @@ lang_add_section (lang_statement_list_ty
+@@ -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)
-+      //todo if (no earlier data statements)
-       output->bfd_section->entsize = section->entsize;
-+      //todo also need to deal with later data statements
+-      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 via email to