This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: copying binary input target to a mach-o-le output target


Paul Glendenning wrote:
> Hi,
> 
> I am using objcopy to copy binary data directly into an object file for
> linking into my executable. I do this under Linux without issue using
> the following command.
> 
> objcopy --input-target=binary --binary-architecture=i386
> --output-target=elf32-i386 <binary_input_file> <output_object_file>
> 
> Under OSX 10.5 I changed the output target to mach-o-le and I get the
> following assertion:
> 
>    BFD: BFD (GNU Binutils) 2.19 assertion fail mach-o.c:166
> 
> I am using an Intel based mac and the fink disro of binutils so just to
> be sure I downloaded the 2.19.1 source and compiled. This issue occurs
> at the same location.

  (Caution, untested!)  It looks like this is probably causing your problem:

  130  /* Copy any private info we understand from the input bfd
  131     to the output bfd.  */
  132
  133  static bfd_boolean
  134  bfd_mach_o_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
  135  {
  136    BFD_ASSERT (bfd_mach_o_valid (ibfd));
  137    BFD_ASSERT (bfd_mach_o_valid (obfd));
  138
  139    obfd->tdata.mach_o_data = ibfd->tdata.mach_o_data;
  140    obfd->tdata.mach_o_data->ibfd = ibfd;
  141    return TRUE;
  142  }

  (Line numbers vary because this is from HEAD, not the 2.19 branch).

  It might make more sense to simply return if bfd_mach_o_valid returns false
for either BFD, rather than abort here.  You could try making that change, but
 I can't promise you won't run into other problems elsewhere in the mach-o code.

    cheers,
      DaveK


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]