This is the mail archive of the
mailing list for the binutils project.
Re: Commit: Microblaze: Fix building on a 32-bit host.
- From: Nick Clifton <nickc at redhat dot com>
- To: Michael Eager <eager at eagerm dot com>, binutils at sourceware dot org
- Date: Mon, 8 Feb 2016 12:45:17 +0000
- Subject: Re: Commit: Microblaze: Fix building on a 32-bit host.
- Authentication-results: sourceware.org; auth=none
- References: <87vb68pslt dot fsf at redhat dot com> <56B4EB64 dot 6060106 at eagerm dot com>
>> - /* 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