Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1441460imm; Wed, 20 Jun 2018 18:50:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKGtS52NYMZJizEKaCnXGnGfIWD0nizJOOfl0ub0jPiODEQ/mXsMt/JPShcSUm2AoadJbKy X-Received: by 2002:a17:902:b483:: with SMTP id y3-v6mr26548929plr.66.1529545809166; Wed, 20 Jun 2018 18:50:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529545809; cv=none; d=google.com; s=arc-20160816; b=CmNfEXuStiDtmArFiw5UbsqwPl0GGObKWbDq606Fvw+ILUTys1i3XbExxfuROo55Fl 85Awm2v6Rxm6jxuqf6I8EuxZn5FrjTQO+4XdTqc2g4v6b4DO2fCtuhpQ2zXRbLdjNLBL Qs9gNFkHmHK2oNAshDGTFk1bSB929Pu0GYjaCKAekNcE33FtWNz6azqHBGdep+wmJgHt N8xzbX7RPBwvtPiC7ao1ngINNuqSAfY8wSpB17bzXGdT9VDINHTRgoTBH9hFkOrYEO5T U8gFnAvAbK5jaF6o060xRIvfgI8HR6U/blnm4zkNNAXH8BvCI1W7izjPv1N5Jaq4CNTs eT1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=5UJr20xz2LMnzwE4XENCDEcLyUZbbvWpwbyLFmru+OI=; b=grzSFmFri0nuf8J7EgO9gT/t2WTWW1f1OOwW0jL7nD973PDMtWF8huswVg0xtS5TUW HsrIh3+k6qUQ9ba2yZ4WNKvNWxOvqzFjyyy9gF/zNb3dHaJTLTucYEqZ+OLonqUguPNF riyMkJ0BjW9JM8z0K8vvxlhAIhNxKL6v0m7mLnyYxEY6t/36OkMVWGbKmy3nBB/likQm 91d/sSrwJgNPG6cLyScKHDGPZzDzJsEeFdtermULQIThr0CZ+A6YCeMYFpGnU6ruR+mT 3+Ikpjjhz6tGbwxQvqhbSPWZRHfd/JQciEwFe9LlNCKfLydDyT/V7az3X5lu19W7sGjR cExg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2-v6si3010657pgs.59.2018.06.20.18.49.55; Wed, 20 Jun 2018 18:50:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754591AbeFUBsh (ORCPT + 99 others); Wed, 20 Jun 2018 21:48:37 -0400 Received: from exmail.andestech.com ([59.124.169.137]:8075 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754574AbeFUBsg (ORCPT ); Wed, 20 Jun 2018 21:48:36 -0400 Received: from ATCSQR.andestech.com (localhost [127.0.0.2] (may be forged)) by ATCSQR.andestech.com with ESMTP id w5L1gL1l038539 for ; Thu, 21 Jun 2018 09:42:21 +0800 (GMT-8) (envelope-from zong@andestech.com) Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id w5L1g7qv038472; Thu, 21 Jun 2018 09:42:07 +0800 (GMT-8) (envelope-from zong@andestech.com) Received: from atcsqa06.andestech.com (10.0.1.85) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.123.3; Thu, 21 Jun 2018 09:42:29 +0800 From: Zong Li To: , , , CC: Zong Li , Subject: [PATCH 4/5] RISC-V: Change variable type for 32-bit compatible Date: Thu, 21 Jun 2018 09:41:45 +0800 Message-ID: <3f86f9eb853380686a86a8abe6bda0dd3720ee10.1529506497.git.zong@andestech.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.0.1.85] X-DNSRBL: X-MAIL: ATCSQR.andestech.com w5L1g7qv038472 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Zong Li --- arch/riscv/kernel/module.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c index 29d265d0cf45..c88d2ee918a5 100644 --- a/arch/riscv/kernel/module.c +++ b/arch/riscv/kernel/module.c @@ -39,7 +39,7 @@ static int apply_r_riscv_64_rela(struct module *me, u32 *location, Elf_Addr v) static int apply_r_riscv_branch_rela(struct module *me, u32 *location, Elf_Addr v) { - s64 offset = (void *)v - (void *)location; + uintptr_t offset = (void *)v - (void *)location; u32 imm12 = (offset & 0x1000) << (31 - 12); u32 imm11 = (offset & 0x800) >> (11 - 7); u32 imm10_5 = (offset & 0x7e0) << (30 - 10); @@ -52,7 +52,7 @@ static int apply_r_riscv_branch_rela(struct module *me, u32 *location, static int apply_r_riscv_jal_rela(struct module *me, u32 *location, Elf_Addr v) { - s64 offset = (void *)v - (void *)location; + uintptr_t offset = (void *)v - (void *)location; u32 imm20 = (offset & 0x100000) << (31 - 20); u32 imm19_12 = (offset & 0xff000); u32 imm11 = (offset & 0x800) << (20 - 11); @@ -65,7 +65,7 @@ static int apply_r_riscv_jal_rela(struct module *me, u32 *location, static int apply_r_riscv_rcv_branch_rela(struct module *me, u32 *location, Elf_Addr v) { - s64 offset = (void *)v - (void *)location; + uintptr_t offset = (void *)v - (void *)location; u16 imm8 = (offset & 0x100) << (12 - 8); u16 imm7_6 = (offset & 0xc0) >> (6 - 5); u16 imm5 = (offset & 0x20) >> (5 - 2); @@ -80,7 +80,7 @@ static int apply_r_riscv_rcv_branch_rela(struct module *me, u32 *location, static int apply_r_riscv_rvc_jump_rela(struct module *me, u32 *location, Elf_Addr v) { - s64 offset = (void *)v - (void *)location; + uintptr_t offset = (void *)v - (void *)location; u16 imm11 = (offset & 0x800) << (12 - 11); u16 imm10 = (offset & 0x400) >> (10 - 8); u16 imm9_8 = (offset & 0x300) << (12 - 11); @@ -98,7 +98,7 @@ static int apply_r_riscv_rvc_jump_rela(struct module *me, u32 *location, static int apply_r_riscv_pcrel_hi20_rela(struct module *me, u32 *location, Elf_Addr v) { - s64 offset = (void *)v - (void *)location; + uintptr_t offset = (void *)v - (void *)location; s32 hi20; if (offset != (s32)offset) { @@ -180,7 +180,7 @@ static int apply_r_riscv_lo12_s_rela(struct module *me, u32 *location, static int apply_r_riscv_got_hi20_rela(struct module *me, u32 *location, Elf_Addr v) { - s64 offset = (void *)v - (void *)location; + uintptr_t offset = (void *)v - (void *)location; s32 hi20; /* Always emit the got entry */ @@ -202,7 +202,7 @@ static int apply_r_riscv_got_hi20_rela(struct module *me, u32 *location, static int apply_r_riscv_call_plt_rela(struct module *me, u32 *location, Elf_Addr v) { - s64 offset = (void *)v - (void *)location; + uintptr_t offset = (void *)v - (void *)location; s32 fill_v = offset; u32 hi20, lo12; @@ -229,7 +229,7 @@ static int apply_r_riscv_call_plt_rela(struct module *me, u32 *location, static int apply_r_riscv_call_rela(struct module *me, u32 *location, Elf_Addr v) { - s64 offset = (void *)v - (void *)location; + uintptr_t offset = (void *)v - (void *)location; s32 fill_v = offset; u32 hi20, lo12; @@ -349,7 +349,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, unsigned int j; for (j = 0; j < sechdrs[relsec].sh_size / sizeof(*rel); j++) { - u64 hi20_loc = + unsigned long hi20_loc = sechdrs[sechdrs[relsec].sh_info].sh_addr + rel[j].r_offset; u32 hi20_type = ELF_RISCV_R_TYPE(rel[j].r_info); @@ -362,12 +362,12 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, Elf_Sym *hi20_sym = (Elf_Sym *)sechdrs[symindex].sh_addr + ELF_RISCV_R_SYM(rel[j].r_info); - u64 hi20_sym_val = + unsigned long hi20_sym_val = hi20_sym->st_value + rel[j].r_addend; /* Calculate lo12 */ - u64 offset = hi20_sym_val - hi20_loc; + size_t offset = hi20_sym_val - hi20_loc; if (IS_ENABLED(CONFIG_MODULE_SECTIONS) && hi20_type == R_RISCV_GOT_HI20) { offset = module_emit_got_entry( -- 2.16.1