This is the mail archive of the binutils@sources.redhat.com 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]

Re: bfd porting


Hi Laurent,

> The coff format I'm trying to port the bfd lib to has several flags
> that doesn't match the standard BFD coff flags. For instance, the
> F_RELFLG (0x0001) states that relocation information was stripped from
> the file, and the corresponding BFD flag (HAS_RELOC, value 0x0001)
> states that the file contains relocation information.
> 
> How should I handle such problems ?

I think that you might be confused.  These flags are used in different
structures.  F_RELFLG is used in f_flags of the 'struct
internal_filehdr'.  HAS_RELOC is used in the flags field of the 'bfd'
structure.  The code in BFD already has routines that keep these two
flags in sync.  For example see coff_real_object_p() in bfd/coffgen.c


> And what should I do with flags that don't have any equivalent in
> bfd.h ?

You do not have to worry about defining them in bfd.h.  If the flags
are unique to your port (as opposed to being generic COFF flags) then
define them in your target specific header file and process them in
your target specific bfd code.  For an example of this, take a look at
bfd/coff-arm.c, where it defines the functions
coff_arm_copy_private_data (), _bfd_coff_arm_set_private_flags (),
coff_arm_print_private_bfd_data (), coff_arm_merge_private_bfd_data ().

Also have a look at the code in bfd/coffcode.h where a lot of flag
processing is done.

Cheers
        Nick


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