From ce462d043509df3f3384decdf2019a1c85051640 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Thu, 19 May 2022 12:44:08 +0200 Subject: [PATCH] COFF: make objcopy / strip honor --keep-file-symbols So far this option had no effect when used together with e.g. --strip-debug. Set BSF_FILE on these symbols to change that. While altering this also join two adjacent blocks of case labeled statements with identical code. --- bfd/coffcode.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 0a660519138..1ffb6032bed 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -4755,6 +4755,9 @@ coff_slurp_symbol_table (bfd * abfd) dst->symbol.value = src->u.syment.n_value; break; + case C_FILE: /* File name. */ + dst->symbol.flags = BSF_FILE; + /* Fall through. */ case C_MOS: /* Member of structure. */ case C_EOS: /* End of structure. */ case C_REGPARM: /* Register parameter. */ @@ -4768,11 +4771,6 @@ coff_slurp_symbol_table (bfd * abfd) case C_MOE: /* Member of enumeration. */ case C_MOU: /* Member of union. */ case C_UNTAG: /* Union tag. */ - dst->symbol.flags = BSF_DEBUGGING; - dst->symbol.value = (src->u.syment.n_value); - break; - - case C_FILE: /* File name. */ case C_STRTAG: /* Structure tag. */ #ifdef RS6000COFF_C case C_GSYM: @@ -4790,7 +4788,7 @@ coff_slurp_symbol_table (bfd * abfd) case C_FUN: case C_ESTAT: #endif - dst->symbol.flags = BSF_DEBUGGING; + dst->symbol.flags |= BSF_DEBUGGING; dst->symbol.value = (src->u.syment.n_value); break; -- 2.30.2