Commit: Microblaze: Fix building on a 32-bit host.

Nick Clifton nickc@redhat.com
Mon Feb 8 12:45:00 GMT 2016


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




More information about the Binutils mailing list