[PATCH 04/19] PRU GAS Port

Alan Modra amodra@gmail.com
Wed Dec 14 01:13:00 GMT 2016


On Mon, Dec 05, 2016 at 10:42:19PM +0200, Dimitar Dimitrov wrote:
> +#ifndef OBJ_ELF
> +/* We are not supporting any other target so we throw a compile time error.  */
> +OBJ_ELF not defined
> +#endif

Use #error

> +static bfd_boolean
> +pru_check_overflow (valueT fixup, reloc_howto_type *howto)
> +{
> +  /* Apply the rightshift before checking for overflow.  */
> +  fixup = ((signed)fixup) >> howto->rightshift;

(signed) is not the correct cast.  Use offsetT instead, which is the
same size as valueT.  valueT might be 64 bit and signed int 32 bit.
Also, the C standard doesn't guarantee that right shifts of signed
values propagate the sign bit but says that is implementation
defined..  Can you use bfd_check_overflow here?

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list