From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 5C1E03858C53 for ; Sat, 7 Oct 2023 22:01:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C1E03858C53 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from csb.redhat.com (deer0x03.wildebeest.org [172.31.17.133]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 3685130067AE; Sun, 8 Oct 2023 00:01:35 +0200 (CEST) Received: by csb.redhat.com (Postfix, from userid 10916) id 09ED7D0B90; Sun, 8 Oct 2023 00:01:35 +0200 (CEST) From: Mark Wielaard To: eager@eagercon.com 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, Mark Wielaard Subject: [PATCH] microblaze: fix build error on 32-bit hosts Date: Sun, 8 Oct 2023 00:01:05 +0200 Message-Id: <20231007220105.818599-1-mark@klomp.org> X-Mailer: git-send-email 2.39.3 In-Reply-To: <5d2ce973-6287-db3d-fc82-966914f765a7@eagercon.com> References: <5d2ce973-6287-db3d-fc82-966914f765a7@eagercon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3034.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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); -- 2.39.3