Bug in STM32L4XX patch

Laurent Alfonsi laurent.alfonsi@st.com
Thu Oct 29 15:44:00 GMT 2015


Nick,

On 10/28/15 15:30, Nick Clifton wrote:
> Hi Laurent, Hi Christophe,
>
>    Oops - I forgot to check you recent patch add support for fixing up
>    the STM32L4XX erratum on a 32-bit host.  When I did that this morning,
>    I found that it did not compile, because you have some casts between
>    pointers and bfd_vma types.  For example:
>    
>      bfd/elf32-arm.c: In function 'elf32_arm_write_section':
>      bfd/elf32-arm.c:17032:6: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>       ((void *) stm32l4xx_errnode->vma-4,
>        ^
>
>    Since it was my oversight in not testing this sceanario, I have taken
>    the liberty of generating a patch to fix the problem.  Hence I am
>    going to check in the patch below.  I hope that you are OK with this.
Ok. Thanks for this change.
However, I don't understand why the "void*" has  a different type size 
than bfd_vma (eq. "unsigned long"). I thought these types had the same 
size on both 32-bit and 64-bit hosts.

Concerning the types defined in the bfd we noticed also another type 
that is misleading.
But we didn't want to propose any change along with this patch.
Thus, the insn32 is currently defined in elf23-arm.c as "typedef 
unsigned long int insn32"

Which means that, for a 64-bit host, it is defined as a 64-bit type.
I can see from the log, that this is pretty old, but this could bring to 
unwanted behavior.

Regards,
Laurent

> Cheers
>    Nick
>



More information about the Binutils mailing list