From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 7E1483857820 for ; Wed, 8 Jun 2022 06:43:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7E1483857820 Received: by mail-wr1-x42b.google.com with SMTP id m26so15512147wrb.4 for ; Tue, 07 Jun 2022 23:43:57 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=i/fxBNh1n/YcMMFCIV8TZt5OYmIxJuEZpKj3xEDkXSo=; b=lyxHBpHEDszgSb504Ggqi5vYGoT7axWEWPXG27o3WFdcnGAIDHaIwftopF6yv3JzqZ J2A2tmx8sPtNYF8Rwb8ES3ZFIBQsU5mFELqI/ObXxUznPB8RFOUsbMSt948kDXelIhva 5uMmHyGyMbZ/hKf/+uYTvZXk2r7B2NHCxHZzbiz4l+/tExphpma94J0QO8umVMGZgCg8 CuSLVjYjlbF0CfBWk2YJwKdCz1FEBO/VlEixisYqdgD46xKGypYgFMZVfk5kYUNse/0s Wbo3TtcX4pFoShkDijVu3rpind36g3bdsUHBPLdqo/FEesbOArdsu5S7zXVP4yg5TI8u aoMQ== X-Gm-Message-State: AOAM530wrVMGf3bvKrtAkE6GGuWCXa8CHIjVlYvhoCtP1pTQFY2QgT3M mTCzSXErIXoegHLYgIPofHkUYh4U8w0= X-Google-Smtp-Source: ABdhPJz39kQG5ZUC6HpWjabW4AHbJMQU5CDT1BPaPbeLsCF12j5DjIiBFsTi1fmOtpTXV/o1gleBUA== X-Received: by 2002:adf:fa03:0:b0:210:dcda:ee82 with SMTP id m3-20020adffa03000000b00210dcdaee82mr31233284wrr.139.1654670636256; Tue, 07 Jun 2022 23:43:56 -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 p15-20020a05600c358f00b003973ea7e725sm34292451wmq.0.2022.06.07.23.43.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:43:55 -0700 (PDT) Received: by nz.home (Postfix, from userid 1000) id 9C71B51A25B38; Wed, 8 Jun 2022 07:43:54 +0100 (BST) From: Sergei Trofimovich To: gdb-patches@sourceware.org Cc: Mike Frysinger , Sergei Trofimovich Subject: [PATCH v2] sim: fix BFD_VMA format arguments on 32-bit hosts Date: Wed, 8 Jun 2022 07:43:51 +0100 Message-Id: <20220608064351.1751077-1-slyich@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.3 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: Wed, 08 Jun 2022 06:43:59 -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. --- Change since v1: - Used PRId64 / int64_t instead of %lld / long long in format strings. 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..fff4fc93314 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: %" PRId64 " sec %" PRId64 " usec to 0x%x\n", + (int64_t)tv.tv_sec, (int64_t)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..35ba7d9000b 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: %" PRId64 " sec %" PRId64 " usec to 0x%x\n", + (int64_t)tv.tv_sec, (int64_t)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.1