All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Masahiro Yamada <masahiroy@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nicolas Schier <nicolas@fjasle.eu>,
	<linux-kbuild@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: Palmer Dabbelt <palmer@rivosinc.com>,
	Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: [PATCH -next] modpost: move some defines to the file head
Date: Wed, 12 Jul 2023 09:57:47 +0800	[thread overview]
Message-ID: <20230712015747.77263-1-wangkefeng.wang@huawei.com> (raw)

with "module: Ignore RISC-V mapping symbols too", build error occurs,

scripts/mod/modpost.c: In function ‘is_valid_name’:
scripts/mod/modpost.c:1055:57: error: ‘EM_RISCV’ undeclared (first use in this function)
  return !is_mapping_symbol(name, elf->hdr->e_machine == EM_RISCV);

Fix it by moving the EM_RISCV to the file head, also some other
defines in case of similar problem in the future.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 scripts/mod/modpost.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 7c71429d6502..885cca272eb8 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -60,6 +60,22 @@ static unsigned int nr_unresolved;
 
 #define MODULE_NAME_LEN (64 - sizeof(Elf_Addr))
 
+#ifndef EM_RISCV
+#define EM_RISCV		243
+#endif
+
+#ifndef R_RISCV_SUB32
+#define R_RISCV_SUB32		39
+#endif
+
+#ifndef EM_LOONGARCH
+#define EM_LOONGARCH		258
+#endif
+
+#ifndef R_LARCH_SUB32
+#define R_LARCH_SUB32		55
+#endif
+
 void __attribute__((format(printf, 2, 3)))
 modpost_log(enum loglevel loglevel, const char *fmt, ...)
 {
@@ -1428,22 +1444,6 @@ static int addend_mips_rel(uint32_t *location, Elf_Rela *r)
 	return 0;
 }
 
-#ifndef EM_RISCV
-#define EM_RISCV		243
-#endif
-
-#ifndef R_RISCV_SUB32
-#define R_RISCV_SUB32		39
-#endif
-
-#ifndef EM_LOONGARCH
-#define EM_LOONGARCH		258
-#endif
-
-#ifndef R_LARCH_SUB32
-#define R_LARCH_SUB32		55
-#endif
-
 static void section_rela(struct module *mod, struct elf_info *elf,
 			 Elf_Shdr *sechdr)
 {
-- 
2.41.0


             reply	other threads:[~2023-07-12  1:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12  1:57 Kefeng Wang [this message]
2023-07-12 15:55 ` [PATCH -next] modpost: move some defines to the file head Masahiro Yamada
2023-07-12 16:28   ` Palmer Dabbelt
2023-07-21  9:11     ` Kefeng Wang
2023-07-21 11:58     ` Masahiro Yamada
2023-07-21 14:01       ` Palmer Dabbelt
2023-07-21 14:19         ` Masahiro Yamada

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=20230712015747.77263-1-wangkefeng.wang@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=palmer@rivosinc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.