public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Michael Eager <eager@eagercon.com>
To: Mark Wielaard <mark@klomp.org>
Cc: appa.rao.nali@amd.com, binutils@sourceware.org,
	ibai.erkiaga-elorza@amd.com, luca.ceresoli@bootlin.com,
	mark.hatle@amd.com, nagaraju.mekala@amd.com, neal.frager@amd.com,
	nickc@redhat.com, sadanand.mutyala@amd.com,
	vidhumouli.hunsigida@amd.com
Subject: Re: [PATCH] microblaze: fix build error on 32-bit hosts
Date: Sat, 7 Oct 2023 16:07:30 -0700	[thread overview]
Message-ID: <ab1b696c-2712-05d3-6fe0-028f9db2641b@eagercon.com> (raw)
In-Reply-To: <609d027a-0671-4416-ea0f-6d59b32f94f1@eagercon.com>

On 10/7/23 15:53, Michael Eager wrote:
> On 10/7/23 15:01, Mark Wielaard wrote:
>> commit 6bbf24955 opcodes: microblaze: Add new bit-field instructions
>> introduced a build error on 32-bit hosts:
>>
>> elf32-microblaze.c: In function ‘microblaze_elf_relax_section’:
>> elf32-microblaze.c:1989:53: error: format ‘%lx’ expects argument of 
>> type ‘long unsigned int’, but argument 5 has type ‘bfd_vma’ {aka 
>> ‘unsigned int’} [-Werror=format=]
>>   1989 |       fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", 
>> __LINE__, val, irel->r_addend);
>>        |                                                   
>> ~~^                    ~~~~~~~~~~~~~~
>>        |                                                     
>> |                        |
>>        |                                                     long 
>> unsigned int        bfd_vma {aka unsigned int}
>>        |                                                   %x
>> elf32-microblaze.c:2074:51: error: format ‘%lx’ expects argument of 
>> type ‘long unsigned int’, but argument 5 has type ‘bfd_vma’ {aka 
>> ‘unsigned int’} [-Werror=format=]
>>   2074 |    fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", 
>> __LINE__, val, irelscan->r_addend);
>>        |                                                 
>> ~~^                    ~~~~~~~~~~~~~~~~~~
>>        |                                                   
>> |                            |
>>        |                                                   long 
>> unsigned int            bfd_vma {aka unsigned int}
>>        |                                                 %x
>>
>> Fix by explicitly casting the r_addend to long.
>> ---
>>   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..2c584f91a4e 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 %lx\n", 
>> __LINE__, val, (long) 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 %lx\n", 
>> __LINE__, val, (long) irelscan->r_addend);
>>             }
>>             irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, 
>> sec);
> 
> I didn't see any build errors, building with GCC-12.3.1.

Building with GCC-13.2.1 on Fedora 38 -- no error messages.

> Which version of GCC are you using?
> 
> (Patch was reverted.)
> 

-- 
Michael Eager

  reply	other threads:[~2023-10-07 23:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05 12:51 [PATCH v2 1/1] opcodes: microblaze: Add new bit-field instructions Neal Frager
2023-10-06 19:17 ` Michael Eager
2023-10-07 19:23   ` Maciej W. Rozycki
2023-10-07 22:33     ` Michael Eager
2023-10-07 23:11     ` Michael Eager
2023-10-09  6:32       ` Frager, Neal
2023-10-09 13:32         ` Maciej W. Rozycki
2023-10-09 15:09         ` Michael Eager
2023-10-10  6:54           ` Frager, Neal
2023-10-10 16:16             ` Michael Eager
2023-10-10 17:54               ` Michael Eager
2023-10-09 10:53     ` Frager, Neal
2023-10-09 17:53       ` Michael Eager
2023-10-07 22:01   ` [PATCH] microblaze: fix build error on 32-bit hosts Mark Wielaard
2023-10-07 22:53     ` Michael Eager
2023-10-07 23:07       ` Michael Eager [this message]
2023-10-07 23:14         ` Mark Wielaard
2023-10-09 11:58           ` Frager, Neal
2023-10-09 12:37             ` Mark Wielaard
2023-10-09 12:42               ` Frager, Neal
2023-10-09 12:48                 ` Mark Wielaard
2023-10-09 12:56                   ` Frager, Neal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ab1b696c-2712-05d3-6fe0-028f9db2641b@eagercon.com \
    --to=eager@eagercon.com \
    --cc=appa.rao.nali@amd.com \
    --cc=binutils@sourceware.org \
    --cc=ibai.erkiaga-elorza@amd.com \
    --cc=luca.ceresoli@bootlin.com \
    --cc=mark.hatle@amd.com \
    --cc=mark@klomp.org \
    --cc=nagaraju.mekala@amd.com \
    --cc=neal.frager@amd.com \
    --cc=nickc@redhat.com \
    --cc=sadanand.mutyala@amd.com \
    --cc=vidhumouli.hunsigida@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).