Received: by 10.213.65.68 with SMTP id h4csp1521662imn; Thu, 15 Mar 2018 01:56:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELt6SkxYiCgikDC4T1LnwOnBaESfnWyKqhJLZ/AJdmGMVHBmdjo80zSyCe//Al9QLyGS5Th7 X-Received: by 2002:a17:902:724b:: with SMTP id c11-v6mr7418114pll.352.1521104160516; Thu, 15 Mar 2018 01:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521104160; cv=none; d=google.com; s=arc-20160816; b=TrrqRHcrlbXM+4yTxM8TUNB9ntN/m9jG8yRHb0uzeKYPQoj8RZZsHtUSgiL1BtEKrt rG+C95i23HtdmJ4YPa+ut9gtlm8mJ+uUUcREnSAWbASTVmYOVN8gQXsxqdIteAIcGj5N XofaBzdcJplab/joy+O2cm9gp+iBjtQ8MIPUme7e3DmHIUet8IVopHvs7Bfbwwi1jAeg ZTwhnA4abQZcKqMtcyW7GT5/aGcN/wugI2quWtJgK3+v+4rNJd6M6HP4JBhdG0O/5Gal vR9fZr+q5t6KKqZ8Q0sLi55vIzySkFAZrIo4+icCrOD2cFiteL3KLHF34+pHJXb++roh I1NA== 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=r/SWNaMiterOmDeo1fidNnHgTKbg6G0Ybb3AqRJnyWQ=; b=tJdeA58kaOpN2kuu3DPa6q1vxUqmnvIW0LIo+cNQyK6qnFeNfGcVkKw1rDZiYXhK/P 7RCsM5/4VkQAhqvM47P42ayECXk8EQPe6E6MNQCsPdSWlsLYAu0yA206vq8RzB8bLu01 /PbXyCLiRmJzodpRYASqBCgTGhzx5Ue4feoZ23nQvOKjSM8mntiTrkiPhg28yw6vZcnQ AtnlfINJjjsPysP6ApZN/VEpqZIQNVzgxXGNsJ4e9Kl1jqNcvHI0oyeMJPEPGxzMD80I NrZlK3+btPkKk/2RXYz4VsVJwnL2DO+1CrIytKnY12/F1bgzgWrAtL0M1Lm6lVMZI5q9 ma+A== 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 i35-v6si3609856plg.48.2018.03.15.01.55.45; Thu, 15 Mar 2018 01:56:00 -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 S1751903AbeCOIwI (ORCPT + 99 others); Thu, 15 Mar 2018 04:52:08 -0400 Received: from exmail.andestech.com ([59.124.169.137]:13184 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751719AbeCOIwE (ORCPT ); Thu, 15 Mar 2018 04:52:04 -0400 Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id w2F8m2sb081018; Thu, 15 Mar 2018 16:48:02 +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:38 +0800 From: Zong Li To: , , , , , CC: Subject: [PATCH v2 07/11] RISC-V: Support ALIGN relocation type in kernel module Date: Thu, 15 Mar 2018 16:50:47 +0800 Message-ID: <65bad5a6944562c80a019fe18d0761623e66c57f.1521103173.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 w2F8m2sb081018 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just fail on align type. Kernel modules loader didn't do relax like linker, it is difficult to remove or migrate the code, but the remnant nop instructions harm the performaace of module. We expect the building module with the no-relax option. Signed-off-by: Zong Li --- arch/riscv/kernel/module.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c index 7ab6a9b72384..957933e669b1 100644 --- a/arch/riscv/kernel/module.c +++ b/arch/riscv/kernel/module.c @@ -240,6 +240,15 @@ static int apply_r_riscv_relax_rela(struct module *me, u32 *location, return 0; } +static int apply_r_riscv_align_rela(struct module *me, u32 *location, + Elf_Addr v) +{ + pr_err( + "%s: The unexpected relocation type 'R_RISCV_ALIGN' from PC = %p\n", + me->name, location); + return -EINVAL; +} + static int (*reloc_handlers_rela[]) (struct module *me, u32 *location, Elf_Addr v) = { [R_RISCV_64] = apply_r_riscv_64_rela, @@ -257,6 +266,7 @@ static int (*reloc_handlers_rela[]) (struct module *me, u32 *location, [R_RISCV_CALL_PLT] = apply_r_riscv_call_plt_rela, [R_RISCV_CALL] = apply_r_riscv_call_rela, [R_RISCV_RELAX] = apply_r_riscv_relax_rela, + [R_RISCV_ALIGN] = apply_r_riscv_align_rela, }; int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, -- 2.16.1