diff mbox

[LD,ARM] Fix in STM32L4XX patch

Message ID CAKdteOZrsbAyoB8GbOUvDfQ1t45D+U02fBdvDmpVnDpyPLJbUQ@mail.gmail.com
State New
Headers show

Commit Message

Christophe Lyon Nov. 6, 2015, 3:51 p.m. UTC
Hi,

While running the linker tests on a 32-bits i686 host with
enable-64-bit-bfd=yes, I noticed that a test of the STM32L4XX patch
was failing.

This is because it expects a message containing an out-of-range
offset, and does not print the right value: the print format contains
%d while the value is of type long long.

The attached small patch fixes that by forcing %ld and casting the
value to (long), as it seems to be standard practice elsewhere in the
binutils, although not very clean.

Nick, don't you see this error?

OK?

Christophe.
2015-11-06  Christophe Lyon  <christophe.lyon@linaro.org>

	bfd/
	* elf32-arm.c (elf32_arm_write_section): Force offset output as
	long (%ld).

Comments

Christophe Lyon Nov. 15, 2015, 4:26 p.m. UTC | #1
ping?

On 6 November 2015 at 16:51, Christophe Lyon <christophe.lyon@linaro.org> wrote:
> Hi,

>

> While running the linker tests on a 32-bits i686 host with

> enable-64-bit-bfd=yes, I noticed that a test of the STM32L4XX patch

> was failing.

>

> This is because it expects a message containing an out-of-range

> offset, and does not print the right value: the print format contains

> %d while the value is of type long long.

>

> The attached small patch fixes that by forcing %ld and casting the

> value to (long), as it seems to be standard practice elsewhere in the

> binutils, although not very clean.

>

> Nick, don't you see this error?

>

> OK?

>

> Christophe.
Christophe Lyon Nov. 17, 2015, 7:29 p.m. UTC | #2
On 17 November 2015 at 12:39, Nick Clifton <nickc@redhat.com> wrote:
> Hi Christophe,

>

>> The attached small patch fixes that by forcing %ld and casting the

>> value to (long), as it seems to be standard practice elsewhere in the

>> binutils, although not very clean.

>

>

> Thanks - I have now applied the patch.  (Sorry about the delay in

> responding).

>

Thanks

>> Nick, don't you see this error?

>

> Strangely no.  I do build a 32-bit only version of the toolchain, but the

> problem did not show up.  Strange.

>

Indeed, I tried to reproduce the configuration in which you saw a problem
with a cast in the STM32L4XX patch.

Thanks

> Cheers

>   Nick

>

>
diff mbox

Patch

diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index fd4f743..4764523 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -17010,10 +17010,10 @@  elf32_arm_write_section (bfd *output_bfd,
 
 		    (*_bfd_error_handler)
 		      (_("%B(%#x): error: Cannot create STM32L4XX veneer. "
-			 "Jump out of range by %d bytes. "
+			 "Jump out of range by %ld bytes. "
 			 "Cannot encode branch instruction. "),
 		       output_bfd,
-		       stm32l4xx_errnode->vma - 4,
+		       (long)stm32l4xx_errnode->vma - 4,
 		       out_of_range);
 		    continue;
 		  }