From: "Torbjörn SVENSSON" <torbjorn.svensson@foss.st.com>
To: <binutils@sourceware.org>
Cc: christophe.lyon@arm.com,
"Torbjörn SVENSSON" <torbjorn.svensson@foss.st.com>
Subject: [PATCH] bfd: Discard region regardless of warning flag
Date: Sat, 17 Dec 2022 11:28:42 +0100 [thread overview]
Message-ID: <20221217102842.3645997-1-torbjorn.svensson@foss.st.com> (raw)
The discard of the region should be performed regardless if the warning
for the discard is enabled or not.
Without this patch, ld would segfault in bfd_section_removed_from_list,
called in the if-statement right after this block, as the argument
isec->output_section can be NULL.
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
bfd/elflink.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/bfd/elflink.c b/bfd/elflink.c
index fc3edef9a05..0368256970b 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -11154,12 +11154,12 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
if (isym->st_shndx != SHN_UNDEF
&& isym->st_shndx < SHN_LORESERVE
&& isec->output_section == NULL
- && flinfo->info->non_contiguous_regions
- && flinfo->info->non_contiguous_regions_warnings)
+ && flinfo->info->non_contiguous_regions)
{
- _bfd_error_handler (_("warning: --enable-non-contiguous-regions "
- "discards section `%s' from '%s'\n"),
- isec->name, bfd_get_filename (isec->owner));
+ if (flinfo->info->non_contiguous_regions_warnings)
+ _bfd_error_handler (_("warning: --enable-non-contiguous-regions "
+ "discards section `%s' from '%s'\n"),
+ isec->name, bfd_get_filename (isec->owner));
continue;
}
--
2.25.1
next reply other threads:[~2022-12-17 10:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-17 10:28 Torbjörn SVENSSON [this message]
2022-12-17 16:13 ` Christophe Lyon
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=20221217102842.3645997-1-torbjorn.svensson@foss.st.com \
--to=torbjorn.svensson@foss.st.com \
--cc=binutils@sourceware.org \
--cc=christophe.lyon@arm.com \
/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).