Fix running objcopy on Mach-O binaries.
authormephi42 <mephi42@gmail.com>
Tue, 21 Aug 2018 15:34:56 +0000 (16:34 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 21 Aug 2018 15:34:56 +0000 (16:34 +0100)
PR binutils/23315
* mach-o.c (bfd_mach_o_mangle_symbols): Update n_type even if
data is already considered filled.

bfd/ChangeLog
bfd/mach-o.c

index 2ff9f4af87bea9899f690c4111fab3143b078b53..3da70d65c4035c003d3b36b9f35ecc644b653336 100644 (file)
@@ -1,3 +1,9 @@
+2018-08-21  mephi42  <mephi42@gmail.com>
+
+       PR binutils/23315
+       * mach-o.c (bfd_mach_o_mangle_symbols): Update n_type even if
+       data is already considered filled.
+
 2018-08-21  Alan Modra  <amodra@gmail.com>
 
        * elf64-ppc.c (HOW): Define.
index ce72a3dd2c08fe8738c34309dd550bf84089ff67..1b461f598873930067523090dded42465a816ea8 100644 (file)
@@ -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
This page took 0.030475 seconds and 4 git commands to generate.