From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id BA3E83857825 for ; Sat, 21 May 2022 07:59:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BA3E83857825 Received: by mail-ej1-x62f.google.com with SMTP id f21so5638049ejh.11 for ; Sat, 21 May 2022 00:59:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2MFArbupLetygdNWQW5yj1HWPxeFlfquwhLO9qh2joo=; b=EzyCY9KaQD1ZJj/W0lysbDAbllMK2TyZUKfO2SpsHUAciiXFqfQsezbazDzXoHo/qq 3ELXWV/KXob0DULbpPkrUijoDlK3J0giNht60Q1iMrmSNvD59pqrHjNWIJ8AXJzfAUGw kkambQBCRth86myEKRVgMf5YOSxbJzLV2FojzIKiB/4v3Qw4lQpbUGst2JN09+tGCfbK jMsV3su2fGuT/4ASEUkL4H4TyPea35U42zErEgjzaULWOlBDSPV+TSxQ3fLsseuntiIe wiIlKmj9zgIkaZ5F9Ukh8qqDOV3TDBT/SjNmUxN6HaZKNfUQSev4jVQ91o+VUsl1+Pv/ 9jnw== X-Gm-Message-State: AOAM533EfKyZL4jXeBVLaJ09qewaGgaFpihsiH6XMcXa42y1cfX9GLhd Nu46dvuJ5RTxgquvb5rYLrw= X-Google-Smtp-Source: ABdhPJxqZHqkZyrW6eyaTxjdY17awL0pMENfsRof6GDb7LA7FcTT0/dGEzoNiu/QJ+81YgSbkUaDUQ== X-Received: by 2002:a17:907:86ab:b0:6f5:93d:e106 with SMTP id qa43-20020a17090786ab00b006f5093de106mr11511214ejc.573.1653119960254; Sat, 21 May 2022 00:59:20 -0700 (PDT) Received: from nz.home (host81-147-8-147.range81-147.btcentralplus.com. [81.147.8.147]) by smtp.gmail.com with ESMTPSA id my9-20020a1709065a4900b006fe8d8c54a7sm3526050ejc.87.2022.05.21.00.59.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 00:59:19 -0700 (PDT) Received: by nz.home (Postfix, from userid 1000) id E51344E43F4EE; Sat, 21 May 2022 08:59:18 +0100 (BST) From: Sergei Trofimovich To: gdb-patches@sourceware.org Cc: Sergei Trofimovich Subject: [PATCH] sim: fix BFD_VMA format arguments on 32-bit hosts Date: Sat, 21 May 2022 08:59:17 +0100 Message-Id: <20220521075917.1353792-1-slyich@gmail.com> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 May 2022 07:59:23 -0000 From: Sergei Trofimovich Noticed format mismatch when attempted to build gdb on i686-linux-gnu in --enable-64-bit-bfd mode: sim/../../sim/cris/sim-if.c:576:28: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'bfd_size_type' {aka 'long long unsigned int'} [-Werror=format=] 576 | sim_do_commandf (sd, "memory region 0x%" BFD_VMA_FMT "x,0x%lx", | ^~~~~~~~~~~~~~~~~~~ 577 | interp_load_addr, interpsiz); | ~~~~~~~~~ | | | bfd_size_type {aka long long unsigned int} While at it fixed format string for time-related types. --- sim/cris/sim-if.c | 10 ++++++---- sim/m32c/syscalls.c | 4 ++-- sim/rx/syscalls.c | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index 5b1240f041f..d7c1005fcac 100644 --- a/sim/cris/sim-if.c +++ b/sim/cris/sim-if.c @@ -257,7 +257,8 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write) if (verbose) sim_io_printf (sd, - "Loading segment at 0x%" BFD_VMA_FMT "x, size 0x%lx\n", + "Loading segment at 0x%" BFD_VMA_FMT "x, " + "size 0x%" BFD_VMA_FMT "x\n", lma, phdr[i].p_filesz); if (bfd_seek (abfd, phdr[i].p_offset, SEEK_SET) != 0 @@ -265,7 +266,7 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write) { sim_io_eprintf (sd, "%s: could not read segment at 0x%" BFD_VMA_FMT "x, " - "size 0x%lx\n", + "size 0x%" BFD_VMA_FMT "x\n", STATE_MY_NAME (sd), lma, phdr[i].p_filesz); free (buf); return FALSE; @@ -275,7 +276,7 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write) { sim_io_eprintf (sd, "%s: could not load segment at 0x%" BFD_VMA_FMT "x, " - "size 0x%lx\n", + "size 0x%" BFD_VMA_FMT "x\n", STATE_MY_NAME (sd), lma, phdr[i].p_filesz); free (buf); return FALSE; @@ -572,7 +573,8 @@ cris_handle_interpreter (SIM_DESC sd, struct bfd *abfd) memory area, so we go via a temporary area. Luckily, the interpreter is supposed to be small, less than 0x40000 bytes. */ - sim_do_commandf (sd, "memory region 0x%" BFD_VMA_FMT "x,0x%lx", + sim_do_commandf (sd, "memory region 0x%" BFD_VMA_FMT "x," + "0x%" BFD_VMA_FMT "x", interp_load_addr, interpsiz); /* Now that memory for the interpreter is defined, load it. */ diff --git a/sim/m32c/syscalls.c b/sim/m32c/syscalls.c index 27d4e8f737f..1fb976172c1 100644 --- a/sim/m32c/syscalls.c +++ b/sim/m32c/syscalls.c @@ -299,8 +299,8 @@ m32c_syscall (int id) rv = gettimeofday (&tv, 0); if (trace) - printf ("gettimeofday: %ld sec %ld usec to 0x%x\n", tv.tv_sec, - tv.tv_usec, tvaddr); + printf ("gettimeofday: %lld sec %lld usec to 0x%x\n", + (long long)tv.tv_sec, (long long)tv.tv_usec, tvaddr); mem_put_si (tvaddr, tv.tv_sec); mem_put_si (tvaddr + 4, tv.tv_usec); put_reg (r0, rv); diff --git a/sim/rx/syscalls.c b/sim/rx/syscalls.c index 285d4573da1..2d23e23c6f4 100644 --- a/sim/rx/syscalls.c +++ b/sim/rx/syscalls.c @@ -270,8 +270,8 @@ rx_syscall (int id) rv = gettimeofday (&tv, 0); if (trace) - printf ("gettimeofday: %ld sec %ld usec to 0x%x\n", tv.tv_sec, - tv.tv_usec, tvaddr); + printf ("gettimeofday: %lld sec %lld usec to 0x%x\n", + (long long)tv.tv_sec, (long long)tv.tv_usec, tvaddr); mem_put_si (tvaddr, tv.tv_sec); mem_put_si (tvaddr + 4, tv.tv_usec); put_reg (1, rv); -- 2.36.0