linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zong Li <zong@andestech.com>
To: <palmer@sifive.com>, <albert@sifive.com>,
	<linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<zong@andestech.com>, <zongbox@gmail.com>
Cc: <greentime@andestech.com>
Subject: [PATCH v2 07/11] RISC-V: Support ALIGN relocation type in kernel module
Date: Thu, 15 Mar 2018 16:50:47 +0800	[thread overview]
Message-ID: <65bad5a6944562c80a019fe18d0761623e66c57f.1521103173.git.zong@andestech.com> (raw)
In-Reply-To: <cover.1521103167.git.zong@andestech.com>

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 <zong@andestech.com>
---
 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

  parent reply	other threads:[~2018-03-15  8:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15  8:50 [PATCH v2 00/11] RISC-V: Resolve the issue of loadable module on 64-bit Zong Li
2018-03-15  8:50 ` [PATCH v2 01/11] RISC-V: Add sections of PLT and GOT for kernel module Zong Li
2018-03-15  8:50 ` [PATCH v2 02/11] RISC-V: Add section of GOT.PLT " Zong Li
2018-03-15  8:50 ` [PATCH v2 03/11] RISC-V: Support GOT_HI20/CALL_PLT relocation type in " Zong Li
2018-03-15  8:50 ` [PATCH v2 04/11] RISC-V: Support CALL " Zong Li
2018-03-15  8:50 ` [PATCH v2 05/11] RISC-V: Support HI20/LO12_I/LO12_S " Zong Li
2018-03-15  8:50 ` [PATCH v2 06/11] RISC-V: Support RVC_BRANCH/JUMP relocation type in kernel modulewq Zong Li
2018-03-15  8:50 ` Zong Li [this message]
2018-03-15  8:50 ` [PATCH v2 08/11] RISC-V: Support ADD32 relocation type in kernel module Zong Li
2018-03-15  8:50 ` [PATCH v2 09/11] RISC-V: Support SUB32 " Zong Li
2018-03-15  8:50 ` [PATCH v2 10/11] RISC-V: Enable module support in defconfig Zong Li
2018-03-15  8:50 ` [PATCH v2 11/11] RISC-V: Add definition of relocation types Zong Li
2018-03-16  1:18 ` [PATCH v2 00/11] RISC-V: Resolve the issue of loadable module on 64-bit Zong Li
2018-03-20 17:11 ` Palmer Dabbelt
2018-03-21  2:53   ` Zong Li
2018-03-24 12:59   ` Shea Levy
2018-03-24 15:21     ` Zong Li
2018-03-24 15:59       ` Shea Levy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65bad5a6944562c80a019fe18d0761623e66c57f.1521103173.git.zong@andestech.com \
    --to=zong@andestech.com \
    --cc=albert@sifive.com \
    --cc=greentime@andestech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@sifive.com \
    --cc=zongbox@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).