Skip to contentSkip to conversation

riscv: export __lshrti3

PATCH In review Olof Johansson 2 participants 4 messages Dec 17, 2019 – Jan 19, 2020 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: export __lshrti3

ARM64 exports it already, and recently it started showing up as needed with allmodconfig.

To keep things building as expected, let's export on riscv as well.

---

It'd be nice to see this go in through 5.5-rc, since the breakage showed up this merge window. It was triggered by ce5c31db3645 ("lib/ubsan:
don't serialize UBSAN report"), but I think that was just coincidental.

 arch/riscv/lib/tishift.S | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/lib/tishift.S +1 -0
index 15f9d54c7db63..8ecb7db331cfe 100644
@@ -35,3 +35,4 @@ ENTRY(__lshrti3)
 	addi	sp,sp,16
 	ret
 ENDPROC(__lshrti3)
+EXPORT_SYMBOL(__lshrti3)
Signature · 1 line
2.11.0
#1 lore raw
Quoted 4 lines · Olof Johansson

ARM64 exports it already, and recently it started showing up as needed with allmodconfig.

Quoted 8 lines

To keep things building as expected, let's export on riscv as well.

---

It'd be nice to see this go in through 5.5-rc, since the breakage showed up this merge window. It was triggered by ce5c31db3645 ("lib/ubsan:
don't serialize UBSAN report"), but I think that was just coincidental.

Nevermind, I built the wrong config when I tested this. Need to pick up some of the generic helpers also. Posting new patch separately.

-Olof

-Olof

#2 lore raw

PATCH 1/1 riscv: Less inefficient gcc tishift helpers (and export their symbols)

In reply to Olof Johansson

The existing __lshrti3 was really inefficient, and the other two helpers are also needed to compile some modules.

Add the missing versions, and export all of the symbols like arm64 already does.

This fixes a build break triggered by ubsan:

riscv64-unknown-linux-gnu-ld: lib/ubsan.o: in function `.L2':
ubsan.c:(.text.unlikely+0x38): undefined reference to __ashlti3' riscv64-unknown-linux-gnu-ld: ubsan.c:(.text.unlikely+0x42): undefined reference to __ashrti3'

---
 arch/riscv/include/asm/asm-prototypes.h |  4 ++
 arch/riscv/lib/tishift.S                | 71 +++++++++++++++++++++++++--------
 2 files changed, 59 insertions(+), 16 deletions(-)
arch/riscv/include/asm/asm-prototypes.h +4 -0
index dd62b691c443d..27e005fca5849 100644
@@ -5,4 +5,8 @@
 #include <linux/ftrace.h>
 #include <asm-generic/asm-prototypes.h>
 
+long long __lshrti3(long long a, int b);
+long long __ashrti3(long long a, int b);
+long long __ashlti3(long long a, int b);
+
 #endif /* _ASM_RISCV_PROTOTYPES_H */
arch/riscv/lib/tishift.S +55 -16

89 lines not on this page · raw message

Signature · 1 line
2.11.0
#3 lore raw

Re: [PATCH] riscv: Less inefficient gcc tishift helpers (and export their symbols)

Quoted 6 lines · Olof Johansson

The existing __lshrti3 was really inefficient, and the other two helpers are also needed to compile some modules.

Add the missing versions, and export all of the symbols like arm64 already does.

Quoted 7 lines

This fixes a build break triggered by ubsan:

riscv64-unknown-linux-gnu-ld: lib/ubsan.o: in function `.L2':
ubsan.c:(.text.unlikely+0x38): undefined reference to __ashlti3' riscv64-unknown-linux-gnu-ld: ubsan.c:(.text.unlikely+0x42): undefined reference to __ashrti3'

Thanks Olof. I modified the patch description to note that the code is based on libgcc per our off-list discussion, and to use SYM_PROC_ENTRY/EXIT per commit ffedeeb780dc5 ("linkage: Introduce new macros for assembler symbols"), and have queued the following patch.

- Paul

From: Olof Johansson <[email protected]>
Date: Mon, 16 Dec 2019 20:06:31 -0800
Subject: [PATCH] riscv: Less inefficient gcc tishift helpers (and export their
symbols)

The existing __lshrti3 was really inefficient, and the other two helpers are also needed to compile some modules.

Add the missing versions, and export all of the symbols like arm64 already does.

This code is based on the assembly generated by libgcc builds.

This fixes a build break triggered by ubsan:

riscv64-unknown-linux-gnu-ld: lib/ubsan.o: in function `.L2':
ubsan.c:(.text.unlikely+0x38): undefined reference to __ashlti3' riscv64-unknown-linux-gnu-ld: ubsan.c:(.text.unlikely+0x42): undefined reference to __ashrti3'

[[email protected]: use SYM_FUNC_{START,END} instead of ENTRY/ENDPROC; note
libgcc origin]

---
 arch/riscv/include/asm/asm-prototypes.h |  4 ++
 arch/riscv/lib/tishift.S                | 75 +++++++++++++++++++------
 2 files changed, 61 insertions(+), 18 deletions(-)
arch/riscv/include/asm/asm-prototypes.h +4 -0
index dd62b691c443..27e005fca584 100644
@@ -5,4 +5,8 @@
 #include <linux/ftrace.h>
 #include <asm-generic/asm-prototypes.h>
 
+long long __lshrti3(long long a, int b);
+long long __ashrti3(long long a, int b);
+long long __ashlti3(long long a, int b);
+
 #endif /* _ASM_RISCV_PROTOTYPES_H */
arch/riscv/lib/tishift.S +57 -18

91 lines not on this page · raw message

Signature · 1 line
2.25.0.rc2