More gas/bfd patches

Ian Lance Taylor ian@cygnus.com
Mon Feb 20 08:18:00 GMT 1995


   Date: Mon, 20 Feb 95 09:05:36 MST
   From: Bryan Ford <baford@schirf.cs.utah.edu>

   The third is a little more interesting - it adds read support
   to the "binary" BFD backend.  Basically, if you specify "binary"
   as the format of an input file to ld or objcopy or whatever,
   the input file will be read into a data section as raw, uninterpreted bytes,
   and some symbols will be produced, based on the filename of the input file,
   marking the start and end of the data chunk.  Basically, it allows you
   to link arbitrary files into a program without all the machine-dependent,
   format-dependent "wrap-a-file-in-a-.o" kludgery that's usually needed.
   (e.g. see the Linux boot image creation mechanism. :-) )

Note that objcopy now supports the --add-section option.  It's not
quite the same thing, though, I suppose.

   BTW, this code requires a horrible kludge to find the size of the
   input file, because bfd_seek doesn't support SEEK_END, and by definition
   there's no way to find the length of an uninterpreted binary input file
   based only its contents.  (I just read through the file once and count
   the number of bytes before EOF.)

Why not just use stat?

Ian




More information about the Gas2 mailing list