public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: "Frager, Neal" <neal.frager@amd.com>,
	Michael Eager <eager@eagercon.com>,
	 "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: "Nali, Appa Rao" <appa.rao.nali@amd.com>,
	"binutils@sourceware.org" <binutils@sourceware.org>,
	"Erkiaga Elorza, Ibai" <ibai.erkiaga-elorza@amd.com>,
	 "luca.ceresoli@bootlin.com" <luca.ceresoli@bootlin.com>,
	"Hatle, Mark" <mark.hatle@amd.com>,
	"Mekala, Nagaraju" <nagaraju.mekala@amd.com>,
	"nickc@redhat.com" <nickc@redhat.com>,
	"Mutyala, Sadanand" <sadanand.mutyala@amd.com>,
	"Hunsigida, Vidhumouli" <vidhumouli.hunsigida@amd.com>
Subject: Re: [PATCH] microblaze: fix build error on 32-bit hosts
Date: Mon, 09 Oct 2023 14:37:59 +0200	[thread overview]
Message-ID: <0fa85fa35025cf0771ecad670e57b446f6da6796.camel@klomp.org> (raw)
In-Reply-To: <CH2PR12MB5004D05A1488E927954C99A8F0CEA@CH2PR12MB5004.namprd12.prod.outlook.com>

Hi Neal,

On Mon, 2023-10-09 at 11:58 +0000, Frager, Neal wrote:
> The only thing I am unable to verify is using a 32-bit host.  I have only been building with a 64-bit host.
> 
> Does anyone have an idea why this patch would lead to issues with a 32-bit build host and not a 64-bit host?

It is as the error says:

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


On a 32bit host bfd_vma is an unsigned int, but you are using a long
printf format.

Casting the r_addend to (long) is one way to resolve this.

Cheers,

Mark

P.S. If you have a commit access to binutils you can use a try branch
to test patches against builder.sourceware.org which contains several
32bit hosts. See https://sourceware.org/binutils/wiki/Buildbot

  reply	other threads:[~2023-10-09 12:38 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
2023-10-07 23:14         ` Mark Wielaard
2023-10-09 11:58           ` Frager, Neal
2023-10-09 12:37             ` Mark Wielaard [this message]
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=0fa85fa35025cf0771ecad670e57b446f6da6796.camel@klomp.org \
    --to=mark@klomp.org \
    --cc=appa.rao.nali@amd.com \
    --cc=binutils@sourceware.org \
    --cc=eager@eagercon.com \
    --cc=ibai.erkiaga-elorza@amd.com \
    --cc=luca.ceresoli@bootlin.com \
    --cc=macro@orcam.me.uk \
    --cc=mark.hatle@amd.com \
    --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).