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: Commit: Microblaze: Fix building on a 32-bit host.


Hi Michael,

>> -      /* Special case: sign extend negative 32-bit values to 64-bits.  */
>> +      /* Special case: sign extend negative 32-bit values to offsetT size.  */
> 
> You mention OffsetT here
> 
>>         if ((e->X_add_number >> 31) == 1)
>> -       e->X_add_number |= -((offsetT) 1 << 31);
>> +       e->X_add_number |= -((addressT) (1U << 31));
> 
> but addressT here.  Should these be the same?

Ah - no. :-)  We are actually sign extending an offsetT value (X_add_number),
which is a bfd_signed_vma type.  But we cannot use that type to create the 
bit pattern to set all of the extended bits as the compiler will complain 
about the undefined behaviour of left shifting a signed value.  So instead 
we cast 1 to an addressT value (or bfd_vma), shift that left, and then OR it
into place.

Cheers
  Nick



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