From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
Date: Sat, 18 Oct 2025 08:04:01 +0000 (UTC) [thread overview]
Message-ID: <1760774635.389be9bc3a5f0d16f7f4214c69440b4bb4828a96.sam@gentoo> (raw)
commit: 389be9bc3a5f0d16f7f4214c69440b4bb4828a96
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 18 08:03:55 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 18 08:03:55 2025 +0000
URL: https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=389be9bc
9999: update symbol caching patch
Signed-off-by: Sam James <sam <AT> gentoo.org>
...-internal-symbol-table-in-relocatable-BFD.patch | 201 +--------------------
1 file changed, 8 insertions(+), 193 deletions(-)
diff --git a/9999/0005-elf-Cache-internal-symbol-table-in-relocatable-BFD.patch b/9999/0005-elf-Cache-internal-symbol-table-in-relocatable-BFD.patch
index 3aebf29..4ef3fbd 100644
--- a/9999/0005-elf-Cache-internal-symbol-table-in-relocatable-BFD.patch
+++ b/9999/0005-elf-Cache-internal-symbol-table-in-relocatable-BFD.patch
@@ -1,8 +1,8 @@
-From 9cf16688a03d54c4788398d9481d798935a71d40 Mon Sep 17 00:00:00 2001
+From cc559d319379dc169fa2e4bce2c584b2684e1c90 Mon Sep 17 00:00:00 2001
+Message-ID: <cc559d319379dc169fa2e4bce2c584b2684e1c90.1760774616.git.sam@gentoo.org>
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 9 Oct 2025 13:16:19 +0800
-Subject: [PATCH v2] elf: Cache full internal symbol table for relocatable
- input
+Subject: [PATCH] elf: Cache full internal symbol table for relocatable input
Add bfd_elf_get_elf_syms_cached to cache internal symbol table for
relocatable input and use the internal symbol table cache for both local
@@ -80,18 +80,6 @@ bfd/
(bfd_elf_final_link): Don't clear flinfo fields after cleared
with memset. Don't set flinfo.external_syms,
flinfo.internal_syms nor flinfo.locsym_shndx.
- (init_reloc_cookie): Remove the keep_memory argument. Don't
- cache internal symbol table in symtab_hdr.
- (fini_reloc_cookie): Removed.
- (init_reloc_cookie_for_section): Don't call fini_reloc_cookie on
- error.
- (_bfd_elf_gc_mark): Replace fini_reloc_cookie_for_section with
- fini_reloc_cookie_rels.
- (bfd_elf_gc_sections): Likewise. Free the internal symbol table
- cache.
- (bfd_elf_discard_info): Replace fini_reloc_cookie_for_section with
- fini_reloc_cookie_rels. Don't call fini_reloc_cookie.
- (bfd_elf_parse_eh_frame_entries): Updated.
* elfxx-x86.c (_bfd_x86_elf_link_relax_section): Call
bfd_elf_get_elf_syms_cached instead of bfd_elf_get_elf_syms.
Cache internal symbol table in symtab_hdr->contents if it has
@@ -110,10 +98,10 @@ Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
bfd/elf-eh-frame.c | 17 +---
bfd/elf.c | 189 +++++++++++++++++++++++++++++++++---------
bfd/elfcode.h | 10 +--
- bfd/elflink.c | 172 +++++++++++---------------------------
+ bfd/elflink.c | 95 +++++++--------------
bfd/elfxx-x86.c | 22 +++--
libctf/ctf-open-bfd.c | 6 +-
- 7 files changed, 239 insertions(+), 194 deletions(-)
+ 7 files changed, 219 insertions(+), 137 deletions(-)
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 5d19529d972..28179647e9d 100644
@@ -536,7 +524,7 @@ index 5224a1abee6..ae5e814cdcc 100644
}
diff --git a/bfd/elflink.c b/bfd/elflink.c
-index 3f3ea2cce51..1566dcbb677 100644
+index 3f3ea2cce51..1259bd20f94 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -851,8 +851,6 @@ bfd_elf_link_record_local_dynamic_symbol (struct bfd_link_info *info,
@@ -795,181 +783,6 @@ index 3f3ea2cce51..1566dcbb677 100644
if (htab->tls_sec)
{
bfd_vma base, end = 0; /* Both bytes. */
-@@ -13890,8 +13855,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
-
- static bool
- init_reloc_cookie (struct elf_reloc_cookie *cookie,
-- struct bfd_link_info *info, bfd *abfd,
-- bool keep_memory)
-+ struct bfd_link_info *info, bfd *abfd)
- {
- Elf_Internal_Shdr *symtab_hdr;
- const struct elf_backend_data *bed;
-@@ -13918,39 +13882,21 @@ init_reloc_cookie (struct elf_reloc_cookie *cookie,
- else
- cookie->r_sym_shift = 32;
-
-- cookie->locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
-- if (cookie->locsyms == NULL && cookie->locsymcount != 0)
-+ if (cookie->locsymcount != 0)
- {
-- cookie->locsyms = bfd_elf_get_elf_syms (abfd, symtab_hdr,
-- cookie->locsymcount, 0,
-- NULL, NULL, NULL);
-+ cookie->locsyms = bfd_elf_get_elf_syms_cached (abfd, symtab_hdr,
-+ cookie->locsymcount,
-+ 0, NULL, NULL,
-+ NULL);
- if (cookie->locsyms == NULL)
- {
- info->callbacks->einfo (_("%P%X: can not read symbols: %E\n"));
- return false;
- }
-- if (keep_memory || _bfd_elf_link_keep_memory (info))
-- {
-- symtab_hdr->contents = (bfd_byte *) cookie->locsyms;
-- info->cache_size += (cookie->locsymcount
-- * sizeof (Elf_Internal_Sym));
-- }
- }
- return true;
- }
-
--/* Free the memory allocated by init_reloc_cookie, if appropriate. */
--
--static void
--fini_reloc_cookie (struct elf_reloc_cookie *cookie, bfd *abfd)
--{
-- Elf_Internal_Shdr *symtab_hdr;
--
-- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-- if (symtab_hdr->contents != (unsigned char *) cookie->locsyms)
-- free (cookie->locsyms);
--}
--
- /* Initialize the relocation information in COOKIE for input section SEC
- of input bfd ABFD. */
-
-@@ -13996,28 +13942,9 @@ init_reloc_cookie_for_section (struct elf_reloc_cookie *cookie,
- struct bfd_link_info *info,
- asection *sec, bool keep_memory)
- {
-- if (!init_reloc_cookie (cookie, info, sec->owner, keep_memory))
-- goto error1;
-- if (!init_reloc_cookie_rels (cookie, info, sec->owner, sec,
-- keep_memory))
-- goto error2;
-- return true;
--
-- error2:
-- fini_reloc_cookie (cookie, sec->owner);
-- error1:
-- return false;
--}
--
--/* Free the memory allocated by init_reloc_cookie_for_section,
-- if appropriate. */
--
--static void
--fini_reloc_cookie_for_section (struct elf_reloc_cookie *cookie,
-- asection *sec)
--{
-- fini_reloc_cookie_rels (cookie, sec);
-- fini_reloc_cookie (cookie, sec->owner);
-+ return (init_reloc_cookie (cookie, info, sec->owner)
-+ && init_reloc_cookie_rels (cookie, info, sec->owner, sec,
-+ keep_memory));
- }
- \f
- /* Garbage collect unused sections. */
-@@ -14209,7 +14136,7 @@ _bfd_elf_gc_mark (struct bfd_link_info *info,
- ret = false;
- break;
- }
-- fini_reloc_cookie_for_section (&cookie, sec);
-+ fini_reloc_cookie_rels (&cookie, sec);
- }
- }
-
-@@ -14231,7 +14158,7 @@ _bfd_elf_gc_mark (struct bfd_link_info *info,
- if (!_bfd_elf_gc_mark_fdes (info, sec, eh_frame,
- gc_mark_hook, &cookie))
- ret = false;
-- fini_reloc_cookie_for_section (&cookie, eh_frame);
-+ fini_reloc_cookie_rels (&cookie, eh_frame);
- }
- }
-
-@@ -14665,7 +14592,7 @@ bfd_elf_parse_eh_frame_entries (bfd *abfd ATTRIBUTE_UNUSED,
- if (sec == NULL || sec->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
- continue;
-
-- if (!init_reloc_cookie (&cookie, info, ibfd, false))
-+ if (!init_reloc_cookie (&cookie, info, ibfd))
- return false;
-
- for (sec = ibfd->sections; sec; sec = sec->next)
-@@ -14724,7 +14651,7 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
- if (elf_section_data (sec)->sec_info
- && (sec->flags & SEC_LINKER_CREATED) == 0)
- elf_eh_frame_section (sub) = sec;
-- fini_reloc_cookie_for_section (&cookie, sec);
-+ fini_reloc_cookie_rels (&cookie, sec);
- sec = bfd_get_next_section_by_name (NULL, sec);
- }
- }
-@@ -14784,6 +14711,9 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
- if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
- return false;
- }
-+
-+ if (!_bfd_elf_link_keep_memory (info))
-+ bfd_elf_free_symtab (sub);
- }
-
- /* Allow the backend to mark additional target specific sections. */
-@@ -15239,7 +15169,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
- &cookie))
- changed = 1;
-
-- fini_reloc_cookie_for_section (&cookie, i);
-+ fini_reloc_cookie_rels (&cookie, i);
- }
- }
-
-@@ -15274,7 +15204,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
- changed = 1;
- }
-
-- fini_reloc_cookie_for_section (&cookie, i);
-+ fini_reloc_cookie_rels (&cookie, i);
- }
-
- eh_alignment = ((1 << o->alignment_power)
-@@ -15339,7 +15269,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
- changed = 1;
- }
- }
-- fini_reloc_cookie_for_section (&cookie, i);
-+ fini_reloc_cookie_rels (&cookie, i);
- }
- /* Update the reference to the output .sframe section. Used to
- determine later if PT_GNU_SFRAME segment is to be generated. */
-@@ -15362,13 +15292,11 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
-
- if (bed->elf_backend_discard_info != NULL)
- {
-- if (!init_reloc_cookie (&cookie, info, abfd, false))
-+ if (!init_reloc_cookie (&cookie, info, abfd))
- return -1;
-
- if ((*bed->elf_backend_discard_info) (abfd, &cookie, info))
- changed = 1;
--
-- fini_reloc_cookie (&cookie, abfd);
- }
- }
-
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 140e86888a6..a44b0bb9124 100644
--- a/bfd/elfxx-x86.c
@@ -1029,6 +842,8 @@ index 7241de70709..0cabab8dc1f 100644
if (isymbuf == NULL)
{
bfderrstr = N_("cannot read symbol table");
+
+base-commit: 865101d377d06b428c7f6843d70001dd00857b2a
--
2.51.0
next reply other threads:[~2025-10-18 8:04 UTC|newest]
Thread overview: 105+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-18 8:04 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-09-25 13:08 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 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 13:32 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=1760774635.389be9bc3a5f0d16f7f4214c69440b4bb4828a96.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