Linux-RISC-V Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] riscv: fix compile failure with EXPORT_SYMBOL() & !MMU
@ 2019-12-22  9:26 Luc Van Oostenryck
  2019-12-28  6:04 ` Paul Walmsley
  0 siblings, 1 reply; 2+ messages in thread
From: Luc Van Oostenryck @ 2019-12-22  9:26 UTC (permalink / raw)
  To: linux-kernel, linux-riscv
  Cc: Paul Walmsley, Palmer Dabbelt, kbuild test robot,
	Luc Van Oostenryck, Christoph Hellwig

When support for !MMU was added, the declaration of
__asm_copy_to_user() & __asm_copy_from_user() were #ifdefed
out hence their EXPORT_SYMBOL() give an error message like:
  .../riscv_ksyms.c:13:15: error: '__asm_copy_to_user' undeclared here
  .../riscv_ksyms.c:14:15: error: '__asm_copy_from_user' undeclared here

Since these symbols are not defined with !MMU it's wrong to export them.
Same for __clear_user() (even though this one is also declared in
include/asm-generic/uaccess.h and thus doesn't give an error message).

Fix this by doing the EXPORT_SYMBOL() directly where these symbols
are defined: inside lib/uaccess.S itself.

Fixes 6bd33e1ece528f67646db33bf97406b747dafda0
Reported-by: kbuild test robot <lkp@intel.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>

---

Note: this is only compile tested, not link tested, because the 
      config given in the bot's report gives me several other
      unrelared failure.

 arch/riscv/kernel/riscv_ksyms.c | 3 ---
 arch/riscv/lib/uaccess.S        | 4 ++++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/kernel/riscv_ksyms.c b/arch/riscv/kernel/riscv_ksyms.c
index 4800cf703186..2a02b7eebee0 100644
--- a/arch/riscv/kernel/riscv_ksyms.c
+++ b/arch/riscv/kernel/riscv_ksyms.c
@@ -9,8 +9,5 @@
 /*
  * Assembly functions that may be used (directly or indirectly) by modules
  */
-EXPORT_SYMBOL(__clear_user);
-EXPORT_SYMBOL(__asm_copy_to_user);
-EXPORT_SYMBOL(__asm_copy_from_user);
 EXPORT_SYMBOL(memset);
 EXPORT_SYMBOL(memcpy);
diff --git a/arch/riscv/lib/uaccess.S b/arch/riscv/lib/uaccess.S
index fecd65657a6f..f29d2ba2c0a6 100644
--- a/arch/riscv/lib/uaccess.S
+++ b/arch/riscv/lib/uaccess.S
@@ -1,4 +1,5 @@
 #include <linux/linkage.h>
+#include <asm-generic/export.h>
 #include <asm/asm.h>
 #include <asm/csr.h>
 
@@ -66,6 +67,8 @@ ENTRY(__asm_copy_from_user)
 	j 3b
 ENDPROC(__asm_copy_to_user)
 ENDPROC(__asm_copy_from_user)
+EXPORT_SYMBOL(__asm_copy_to_user)
+EXPORT_SYMBOL(__asm_copy_from_user)
 
 
 ENTRY(__clear_user)
@@ -108,6 +111,7 @@ ENTRY(__clear_user)
 	bltu a0, a3, 5b
 	j 3b
 ENDPROC(__clear_user)
+EXPORT_SYMBOL(__clear_user)
 
 	.section .fixup,"ax"
 	.balign 4
-- 
2.24.0



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] riscv: fix compile failure with EXPORT_SYMBOL() & !MMU
  2019-12-22  9:26 [PATCH] riscv: fix compile failure with EXPORT_SYMBOL() & !MMU Luc Van Oostenryck
@ 2019-12-28  6:04 ` Paul Walmsley
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Walmsley @ 2019-12-28  6:04 UTC (permalink / raw)
  To: Luc Van Oostenryck
  Cc: Palmer Dabbelt, linux-riscv, Christoph Hellwig, linux-kernel,
	kbuild test robot

On Sun, 22 Dec 2019, Luc Van Oostenryck wrote:

> When support for !MMU was added, the declaration of
> __asm_copy_to_user() & __asm_copy_from_user() were #ifdefed
> out hence their EXPORT_SYMBOL() give an error message like:
>   .../riscv_ksyms.c:13:15: error: '__asm_copy_to_user' undeclared here
>   .../riscv_ksyms.c:14:15: error: '__asm_copy_from_user' undeclared here
> 
> Since these symbols are not defined with !MMU it's wrong to export them.
> Same for __clear_user() (even though this one is also declared in
> include/asm-generic/uaccess.h and thus doesn't give an error message).
> 
> Fix this by doing the EXPORT_SYMBOL() directly where these symbols
> are defined: inside lib/uaccess.S itself.
> 
> Fixes 6bd33e1ece528f67646db33bf97406b747dafda0
> Reported-by: kbuild test robot <lkp@intel.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>

Thanks Luc; queued for v5.5-rc.


- Paul


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-22  9:26 [PATCH] riscv: fix compile failure with EXPORT_SYMBOL() & !MMU Luc Van Oostenryck
2019-12-28  6:04 ` Paul Walmsley

Linux-RISC-V Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-riscv/0 linux-riscv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-riscv linux-riscv/ https://lore.kernel.org/linux-riscv \
		linux-riscv@lists.infradead.org
	public-inbox-index linux-riscv

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-riscv


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git