aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-03-06 10:33:10 +1030
committerAlan Modra <amodra@gmail.com>2020-03-06 10:34:19 +1030
commita9b90127e864d0cac1b7b803cb2af4eab01dbdab (patch)
treee535f8fa0267f8096e3a6e4bd24b25bd18607542 /binutils/objcopy.c
parent97669d59c8fd50bd27e6ac4a86beab18d14eef79 (diff)
downloadgdb-a9b90127e864d0cac1b7b803cb2af4eab01dbdab.zip
gdb-a9b90127e864d0cac1b7b803cb2af4eab01dbdab.tar.gz
gdb-a9b90127e864d0cac1b7b803cb2af4eab01dbdab.tar.bz2
PR25637, objcopy : SIGSEGV in copy_object
PR 25637 * objcopy.c (filter_symbols): Correct rem_leading_char logic.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 3b9f1b7..16affa9 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1549,12 +1549,13 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
/* Check if we will remove the current leading character. */
rem_leading_char =
- (name[0] == bfd_get_symbol_leading_char (abfd))
- && (change_leading_char
- || (remove_leading_char
- && ((flags & (BSF_GLOBAL | BSF_WEAK)) != 0
- || undefined
- || bfd_is_com_section (bfd_asymbol_section (sym)))));
+ (name[0] != '\0'
+ && name[0] == bfd_get_symbol_leading_char (abfd)
+ && (change_leading_char
+ || (remove_leading_char
+ && ((flags & (BSF_GLOBAL | BSF_WEAK)) != 0
+ || undefined
+ || bfd_is_com_section (bfd_asymbol_section (sym))))));
/* Check if we will add a new leading character. */
add_leading_char =