public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] bfd: microblaze: Fix automated build errors
@ 2023-10-07  7:11 Neal Frager
  2023-10-07 18:56 ` Vladimir Mezentsev
  0 siblings, 1 reply; 4+ messages in thread
From: Neal Frager @ 2023-10-07  7:11 UTC (permalink / raw)
  To: binutils
  Cc: ibai.erkiaga-elorza, nagaraju.mekala, mark.hatle,
	sadanand.mutyala, appa.rao.nali, vidhumouli.hunsigida,
	luca.ceresoli, nickc, Neal Frager

This patch fixes the following automated build errors:
https://builder.sourceware.org/buildbot/#/builders/80/builds/2101/steps/4/logs/stdio
https://builder.sourceware.org/buildbot/#/builders/72/builds/3405/steps/4/logs/stdio

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
 bfd/elf32-microblaze.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index a8ced43c08a..96bb63fbd2e 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -1986,7 +1986,7 @@ microblaze_elf_relax_section (bfd *abfd,
 		/* Validate the in-band val.  */
 		val = bfd_get_32 (abfd, contents + irel->r_offset);
 		if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
-		    fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
+		    fprintf(stderr, "%d: CORRUPT relax reloc %x %x\n", __LINE__, val, irel->r_addend);
 		}
 		irel->r_addend -= (efix - sfix);
 		/* Should use HOWTO.  */
@@ -2071,7 +2071,7 @@ microblaze_elf_relax_section (bfd *abfd,
 
 		  val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
 		  if (val != irelscan->r_addend) {
-			fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
+			fprintf(stderr, "%d: CORRUPT relax reloc! %x %x\n", __LINE__, val, irelscan->r_addend);
 		  }
 
 		  irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] bfd: microblaze: Fix automated build errors
  2023-10-07  7:11 [PATCH v1 1/1] bfd: microblaze: Fix automated build errors Neal Frager
@ 2023-10-07 18:56 ` Vladimir Mezentsev
  2023-10-09  6:13   ` Frager, Neal
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Mezentsev @ 2023-10-07 18:56 UTC (permalink / raw)
  To: Neal Frager, binutils
  Cc: ibai.erkiaga-elorza, nagaraju.mekala, mark.hatle,
	sadanand.mutyala, appa.rao.nali, vidhumouli.hunsigida,
	luca.ceresoli, nickc



On 10/7/23 00:11, Neal Frager wrote:
> This patch fixes the following automated build errors:
> https://builder.sourceware.org/buildbot/#/builders/80/builds/2101/steps/4/logs/stdio
> https://builder.sourceware.org/buildbot/#/builders/72/builds/3405/steps/4/logs/stdio
>
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> ---
>   bfd/elf32-microblaze.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
> index a8ced43c08a..96bb63fbd2e 100644
> --- a/bfd/elf32-microblaze.c
> +++ b/bfd/elf32-microblaze.c
> @@ -1986,7 +1986,7 @@ microblaze_elf_relax_section (bfd *abfd,
>   		/* Validate the in-band val.  */
>   		val = bfd_get_32 (abfd, contents + irel->r_offset);
>   		if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
> -		    fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
> +		    fprintf(stderr, "%d: CORRUPT relax reloc %x %x\n", __LINE__, val, irel->r_addend);

The type of irel->r_addend is "bfd_vma".
"bfd_vma" can be "unsigned long" or "unsigned int".

Perhaps the correct fix is:
   fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, (unsigned long) irel->r_addend);
or
   fprintf(stderr, "%d: CORRUPT relax reloc %x %llx\n", __LINE__, val, (unsigned long long) irel->r_addend);


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v1 1/1] bfd: microblaze: Fix automated build errors
  2023-10-07 18:56 ` Vladimir Mezentsev
@ 2023-10-09  6:13   ` Frager, Neal
  2023-10-09 16:05     ` Vladimir Mezentsev
  0 siblings, 1 reply; 4+ messages in thread
From: Frager, Neal @ 2023-10-09  6:13 UTC (permalink / raw)
  To: Vladimir Mezentsev, binutils
  Cc: Erkiaga Elorza, Ibai, Mekala, Nagaraju, Hatle, Mark, Mutyala,
	Sadanand, Nali, Appa Rao, Hunsigida, Vidhumouli, luca.ceresoli,
	nickc

Hi Vladimir,

> This patch fixes the following automated build errors:
> https://builder.sourceware.org/buildbot/#/builders/80/builds/2101/step
> s/4/logs/stdio 
> https://builder.sourceware.org/buildbot/#/builders/72/builds/3405/step
> s/4/logs/stdio
>
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> ---
>   bfd/elf32-microblaze.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index 
> a8ced43c08a..96bb63fbd2e 100644
> --- a/bfd/elf32-microblaze.c
> +++ b/bfd/elf32-microblaze.c
> @@ -1986,7 +1986,7 @@ microblaze_elf_relax_section (bfd *abfd,
>   		/* Validate the in-band val.  */
>   		val = bfd_get_32 (abfd, contents + irel->r_offset);
>   		if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
> -		    fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
> +		    fprintf(stderr, "%d: CORRUPT relax reloc %x %x\n", __LINE__, 
> +val, irel->r_addend);

> The type of irel->r_addend is "bfd_vma".
> "bfd_vma" can be "unsigned long" or "unsigned int".

> Perhaps the correct fix is:
>  fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, (unsigned long) irel->r_addend); or
>  fprintf(stderr, "%d: CORRUPT relax reloc %x %llx\n", __LINE__, val, (unsigned long long) irel->r_addend);

Thank you for your input.  I will implement your solution in v3 of the patch.

Just to be sure, both lines should be cast set to (unsigned long), correct?  The "(unsigned long long)" that you used on the second fprintf statement was just a typo?

Thank you for your help.

Best regards,
Neal Frager
AMD

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] bfd: microblaze: Fix automated build errors
  2023-10-09  6:13   ` Frager, Neal
@ 2023-10-09 16:05     ` Vladimir Mezentsev
  0 siblings, 0 replies; 4+ messages in thread
From: Vladimir Mezentsev @ 2023-10-09 16:05 UTC (permalink / raw)
  To: Frager, Neal, binutils
  Cc: Erkiaga Elorza, Ibai, Mekala, Nagaraju, Hatle, Mark, Mutyala,
	Sadanand, Nali, Appa Rao, Hunsigida, Vidhumouli, luca.ceresoli,
	nickc


  Hi Neal,

On 10/8/23 23:13, Frager, Neal wrote:
> Hi Vladimir,
>
>> This patch fixes the following automated build errors:
>> https://builder.sourceware.org/buildbot/#/builders/80/builds/2101/step
>> s/4/logs/stdio
>> https://builder.sourceware.org/buildbot/#/builders/72/builds/3405/step
>> s/4/logs/stdio
>>
>> Signed-off-by: Neal Frager <neal.frager@amd.com>
>> ---
>>    bfd/elf32-microblaze.c | 4 ++--
>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index
>> a8ced43c08a..96bb63fbd2e 100644
>> --- a/bfd/elf32-microblaze.c
>> +++ b/bfd/elf32-microblaze.c
>> @@ -1986,7 +1986,7 @@ microblaze_elf_relax_section (bfd *abfd,
>>    		/* Validate the in-band val.  */
>>    		val = bfd_get_32 (abfd, contents + irel->r_offset);
>>    		if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
>> -		    fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
>> +		    fprintf(stderr, "%d: CORRUPT relax reloc %x %x\n", __LINE__,
>> +val, irel->r_addend);
>> The type of irel->r_addend is "bfd_vma".
>> "bfd_vma" can be "unsigned long" or "unsigned int".
>> Perhaps the correct fix is:
>>   fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, (unsigned long) irel->r_addend); or
>>   fprintf(stderr, "%d: CORRUPT relax reloc %x %llx\n", __LINE__, val, (unsigned long long) irel->r_addend);
> Thank you for your input.  I will implement your solution in v3 of the patch.
>
> Just to be sure, both lines should be cast set to (unsigned long), correct?  The "(unsigned long long)" that you used on the second fprintf statement was just a typo?

  The "bfd_vma" type is defined outside elf32-microblaze.c
You don't know who determines this.
It can be "unsigned long long" and irel->r_addendIn can be very large.
In this case, we need to use the format "%llx" and convert the argument 
to the required format ((unsigned long long) for %llx)..

-Vladimir


>
> Thank you for your help.
>
> Best regards,
> Neal Frager
> AMD


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-09 16:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-07  7:11 [PATCH v1 1/1] bfd: microblaze: Fix automated build errors Neal Frager
2023-10-07 18:56 ` Vladimir Mezentsev
2023-10-09  6:13   ` Frager, Neal
2023-10-09 16:05     ` Vladimir Mezentsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).