aboutsummaryrefslogtreecommitdiff
path: root/bfd/mach-o.c
diff options
context:
space:
mode:
authormephi42 <mephi42@gmail.com>2018-08-21 16:34:56 +0100
committerNick Clifton <nickc@redhat.com>2018-08-21 16:34:56 +0100
commitae19acf3201ee0b921cde8e70e278fe123e82105 (patch)
tree2b6d74ffb969650d5bb65403a16a9fa6567e4200 /bfd/mach-o.c
parentc8455dc98666030e930cddd8178b1b4074749b04 (diff)
downloadfsf-binutils-gdb-ae19acf3201ee0b921cde8e70e278fe123e82105.zip
fsf-binutils-gdb-ae19acf3201ee0b921cde8e70e278fe123e82105.tar.gz
fsf-binutils-gdb-ae19acf3201ee0b921cde8e70e278fe123e82105.tar.bz2
Fix running objcopy on Mach-O binaries.
PR binutils/23315 * mach-o.c (bfd_mach_o_mangle_symbols): Update n_type even if data is already considered filled.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r--bfd/mach-o.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index ce72a3d..1b461f5 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -2497,11 +2497,14 @@ bfd_mach_o_mangle_symbols (bfd *abfd)
}
else
s->n_type = BFD_MACH_O_N_SECT;
-
- if (s->symbol.flags & BSF_GLOBAL)
- s->n_type |= BFD_MACH_O_N_EXT;
}
+ /* Update external symbol bit in case objcopy changed it. */
+ if (s->symbol.flags & BSF_GLOBAL)
+ s->n_type |= BFD_MACH_O_N_EXT;
+ else
+ s->n_type &= ~BFD_MACH_O_N_EXT;
+
/* Put the section index in, where required. */
if ((s->symbol.section != bfd_abs_section_ptr
&& s->symbol.section != bfd_und_section_ptr