aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>2022-12-17 11:16:19 +0100
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>2022-12-20 11:37:22 +0100
commit106791196f98a0f21babf4dd46a731b5d1747d3b (patch)
treeddea0ae2f01acd04488d88001e584ba4186dfb80 /bfd
parent9d0991449285833b9a77cc02850a1e113e460362 (diff)
downloadgdb-106791196f98a0f21babf4dd46a731b5d1747d3b.zip
gdb-106791196f98a0f21babf4dd46a731b5d1747d3b.tar.gz
gdb-106791196f98a0f21babf4dd46a731b5d1747d3b.tar.bz2
bfd: Discard symbol regardless of warning flag
The discard of symbols should be performed whether 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> Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elflink.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index fc3edef..0368256 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;
}