public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: binutils@sourceware.org
Subject: [PATCH] ld: Always output local symbol for relocatable link
Date: Tue,  8 Nov 2022 14:50:30 -0800	[thread overview]
Message-ID: <20221108225030.371817-1-hjl.tools@gmail.com> (raw)

	PR ld/29761
	* elflink.c (elf_link_output_symstrtab): Don't skip local symbol
	in SEC_EXCLUDE section for relocatable link.
---
 bfd/elflink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bfd/elflink.c b/bfd/elflink.c
index 019ac302905..4ef07394160 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -9997,7 +9997,8 @@ elf_link_output_symstrtab (void *finf,
 
   if (name == NULL
       || *name == '\0'
-      || (input_sec->flags & SEC_EXCLUDE))
+      || (!bfd_link_relocatable (flinfo->info)
+	  && (input_sec->flags & SEC_EXCLUDE)))
     elfsym->st_name = (unsigned long) -1;
   else
     {
-- 
2.37.3


             reply	other threads:[~2022-11-08 22:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 22:50 H.J. Lu [this message]
2022-11-09  1:00 ` Alan Modra

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=20221108225030.371817-1-hjl.tools@gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).