Received: by 10.213.65.68 with SMTP id h4csp1521340imn; Thu, 15 Mar 2018 01:55:19 -0700 (PDT) X-Google-Smtp-Source: AG47ELvJ0EcVU4DIZ7z05alDLdBv7rWBuXY3+GJUXlVJrvg/mQ0Q+i255wa0nXlqVOQF3gcjuhzZ X-Received: by 10.98.73.89 with SMTP id w86mr7038175pfa.227.1521104119122; Thu, 15 Mar 2018 01:55:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521104119; cv=none; d=google.com; s=arc-20160816; b=EAW2+Gg8RWLl7f0ab+7Q0RftPfTgCW+wnECzoctjREo0XzyCUuhi59wLLFUa49tjiH u8HvVd7d14kOVWh2fHuZ0nlTXoWtTpSeMaj1sMDQiIn46cjuNNxuHwHqeD3xpaCcADlP isQxdvgN7jDsq7QWKvP9VW3r3WG32xb0KmNxkyGAsytC8JcF95PJHz40p2F3Fh0QqF5c Y9CGtOvbD9OBPvuDmdgsEDCJCDvw5S1CmjnL54dTvuz1rXy7nxMP5x56UBkol77aKJWx zED39nJbtCz/KMDwlbEvCD8gc6zlnfz0mPwCcYm8WxG+3lwuZK3RD42ctFBCoYwcvYOt sWTw== 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=A1SwpjeHBoowP6uhptw9UHB44g80n1zMxxeLsliUtLo=; b=rfAs3bx1Pc3iXfpHbrGJUS+1JAXuzLsLMs03PZaIhLkMYrP8/m8ZsbRMrOzxHxs6a/ yWx7f/M9Ygywq9zYfZBu96OS3hQ6GAEiyuLiqw3mAUq029M778JgtjH8navXM3WfPhL4 hYzR7STGDh0S1qWf3jY6ithTvAOnbQX9hoLKfsvnDUzW28O1M4aEQNeNt0PeI5PjBZg2 yu4cVxpTYx64Tf/YCZ+scAZ0B+uqhfsNruE9fvqZSzhHHK+CCMi3IiUnOyigjW5hWwEx 013bLK62cGUi+5m1gqSqY1kB39lnJqbu+4QPkjsRd9cwjiNHEqXoXeTCG0jmKHME/cCg zpgQ== 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 o2-v6si3551266plk.457.2018.03.15.01.55.05; Thu, 15 Mar 2018 01:55:19 -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 S1751975AbeCOIwS (ORCPT + 99 others); Thu, 15 Mar 2018 04:52:18 -0400 Received: from exmail.andestech.com ([59.124.169.137]:9374 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751578AbeCOIwQ (ORCPT ); Thu, 15 Mar 2018 04:52:16 -0400 Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id w2F8m7aB081045; Thu, 15 Mar 2018 16:48: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, 15 Mar 2018 16:51:42 +0800 From: Zong Li To: , , , , , CC: Subject: [PATCH v2 08/11] RISC-V: Support ADD32 relocation type in kernel module Date: Thu, 15 Mar 2018 16:50:48 +0800 Message-ID: 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 w2F8m7aB081045 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c index 957933e669b1..73ea36c73d3b 100644 --- a/arch/riscv/kernel/module.c +++ b/arch/riscv/kernel/module.c @@ -249,6 +249,13 @@ static int apply_r_riscv_align_rela(struct module *me, u32 *location, return -EINVAL; } +static int apply_r_riscv_add32_rela(struct module *me, u32 *location, + Elf_Addr v) +{ + *(u32 *)location += (*(u32 *)v); + return 0; +} + static int (*reloc_handlers_rela[]) (struct module *me, u32 *location, Elf_Addr v) = { [R_RISCV_64] = apply_r_riscv_64_rela, @@ -267,6 +274,7 @@ static int (*reloc_handlers_rela[]) (struct module *me, u32 *location, [R_RISCV_CALL] = apply_r_riscv_call_rela, [R_RISCV_RELAX] = apply_r_riscv_relax_rela, [R_RISCV_ALIGN] = apply_r_riscv_align_rela, + [R_RISCV_ADD32] = apply_r_riscv_add32_rela, }; int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, -- 2.16.1