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: fx_offset Population


Tracy Kuhrt <Tracy.Kuhrt@microchip.com> writes:

> The new target that I am porting is using a COFF format.  I am trying to
> place the addend value in the 16-bits that I have for this operand.  Where
> the problem comes in is after fixup_segment calls the md_apply_fix3 function
> (which divides this addend by 2) it then checks to see that the value it will
> be writing is able to fit into 2 bytes.  2147450880 (0x7FFF8000) does not fit
> and I get the error "Value of 2147450880 too large for field of 2 bytes at
> 0".  But a -32768 should fit in 2 bytes.
> 
> Does this mean that anywhere that my md_apply_fix3 function uses the
> fx_offset field in a calculation it must first convert it back to a signed
> value?

Yes, md_apply_fix3 must apply any relocation changes using the correct
type of arithmetic.  In this case, it presumably must use signed
division.

Always making fx_offset signed is no more correct than always making
it unsigned.  Either way, md_apply_fix3 is responsible for doing the
right thing.

Ian


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