From patchwork Wed Oct 9 08:57:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "tianjia.zhang" X-Patchwork-Id: 13827909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DF38CED630 for ; Wed, 9 Oct 2024 08:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=DKxvwHZfnacsX7sqv4P183tNFvAODjSTuNfhtpMMbws=; b=mPuwY9lsDsgzwrvF3vsNpGvBV2 ExnnRF1aJMVKuwPfVc9+iA7bT8Ie+S6VcsVCr7pKymJid1cj2fAYub9FfSnCJqUCyx9KtcIku6Obz SLouFlogolxqUMDhoHCh0iLIg3Ewrq9ITB0QKXNECO18jrrf9SwS07pI1FCfrp+X/7/AR7GYW0/xt SlUVz4MpaizvGWUePtF9XD4PHAdT+2qbQ/VY1237DrKit5otxGt6Hju07wkPfqrHA9gIjDrAkvgRB a5FwzAfWcATgyUS8Y8M0CSsI4B9Vx/JHkDQXttxD953RI5/K+KYsALyIuk9/jO5pGJhq+gDpmhEA5 D76GWohw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sySXY-00000008aQC-1tUq; Wed, 09 Oct 2024 08:59:28 +0000 Received: from out30-124.freemail.mail.aliyun.com ([115.124.30.124]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sySWD-00000008a61-1hGu for linux-arm-kernel@lists.infradead.org; Wed, 09 Oct 2024 08:58:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1728464281; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=DKxvwHZfnacsX7sqv4P183tNFvAODjSTuNfhtpMMbws=; b=Fv6911z8LlX6es5POAzPieeT+zYHxg0KkTSWtqc4UQ3gU4Prptn/HZW+1kiHMsv5A34g1/zvd93KN81mRBUVi/kcwrNIrYRXsvEbB27EVZxkxd1OStkgqeOSEV8d6U2c7/0DLDw4dn2Sqx72bh8TbfRXeizD3HLeP9Wc9PIwoVM= Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0WGiB8vX_1728464276) by smtp.aliyun-inc.com; Wed, 09 Oct 2024 16:57:57 +0800 From: Tianjia Zhang To: Marc Zyngier , Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , =?utf-8?q?Pierre-Cl=C3=A9ment_Tosi?= , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Cc: Tianjia Zhang Subject: [PATCH] KVM: arm64: nVHE: gen-hyprel: Silent build warnings Date: Wed, 9 Oct 2024 16:57:51 +0800 Message-ID: <20241009085751.35976-1-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241009_015805_641633_CB3D7AA5 X-CRM114-Status: UNSURE ( 8.97 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch silent the some mismatch format build warnings with clang, like: arch/arm64/kvm/hyp/nvhe/gen-hyprel.c:233:2: warning: format specifies type 'unsigned long' but the argument has type 'Elf64_Off' (aka 'unsigned long long') [-Wformat] 233 | assert_ne(off, 0UL, "%lu"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | %llu arch/arm64/kvm/hyp/nvhe/gen-hyprel.c:193:34: note: expanded from macro 'assert_ne' 193 | #define assert_ne(lhs, rhs, fmt) assert_op(lhs, rhs, fmt, !=) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/arm64/kvm/hyp/nvhe/gen-hyprel.c:188:19: note: expanded from macro 'assert_op' 187 | " failed (lhs=" fmt ", rhs=" fmt \ | ~~~ 188 | ", line=%d)", _lhs, _rhs, __LINE__); \ | ^~~~ arch/arm64/kvm/hyp/nvhe/gen-hyprel.c:167:17: note: expanded from macro 'fatal_error' 166 | fprintf(stderr, "error: %s: " fmt "\n", \ | ~~~ 167 | elf.path, ## __VA_ARGS__); \ | ^~~~~~~~~~~ Signed-off-by: Tianjia Zhang --- arch/arm64/kvm/hyp/nvhe/gen-hyprel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kvm/hyp/nvhe/gen-hyprel.c b/arch/arm64/kvm/hyp/nvhe/gen-hyprel.c index b63f4e1c1033..0d916d91b13c 100644 --- a/arch/arm64/kvm/hyp/nvhe/gen-hyprel.c +++ b/arch/arm64/kvm/hyp/nvhe/gen-hyprel.c @@ -230,7 +230,7 @@ static inline const char *section_begin(Elf64_Shdr *shdr) /* Find a section by its offset from the beginning of the file. */ static inline Elf64_Shdr *section_by_off(Elf64_Off off) { - assert_ne(off, 0UL, "%lu"); + assert_ne(off, 0ULL, "%llu"); return elf_ptr(Elf64_Shdr, off); } @@ -276,7 +276,7 @@ static void init_elf(const char *path) close(fd); /* Get pointer to the ELF header. */ - assert_ge(stat.st_size, sizeof(*elf.ehdr), "%lu"); + assert_ge(stat.st_size, (off_t)sizeof(*elf.ehdr), "%llu"); elf.ehdr = elf_ptr(Elf64_Ehdr, 0); /* Check the ELF magic. */ @@ -340,7 +340,7 @@ static void emit_rela_abs64(Elf64_Rela *rela, const char *sh_orig_name) * a symbol at the beginning of the relocated section, and * is `rela->r_offset`. */ - printf(".reloc %lu, R_AARCH64_PREL32, %s%s + 0x%lx\n", + printf(".reloc %lu, R_AARCH64_PREL32, %s%s + 0x%llx\n", reloc_offset, HYP_SECTION_SYMBOL_PREFIX, sh_orig_name, elf64toh(rela->r_offset)); @@ -376,7 +376,7 @@ static void emit_rela_section(Elf64_Shdr *sh_rela) uint32_t type = (uint32_t)elf64toh(rela->r_info); /* Check that rela points inside the relocated section. */ - assert_lt(elf64toh(rela->r_offset), elf64toh(sh_orig->sh_size), "0x%lx"); + assert_lt(elf64toh(rela->r_offset), elf64toh(sh_orig->sh_size), "0x%llx"); switch (type) { /*