Skip to contentSkip to conversation

parisc: Do not export __lshrdi3 on 64-bit with gcc >= 11

PATCH In review Helge Deller 2 participants 5 messages Nov 27, 2021 PA-RISC architecture

lore
Share & tools
lore

Helge Deller

author maintainer
#0 lore raw

PATCH 1/1 parisc: Do not export __lshrdi3 on 64-bit with gcc >= 11

It seems the __lshrdi3 symbol was dropped from libgcc.a from gcc-11 for 64-bit executables.

---
 arch/parisc/kernel/parisc_ksyms.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
arch/parisc/kernel/parisc_ksyms.c +6 -2
index 00297e8e1c88..f26c51370255 100644
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/syscalls.h>
+#include <linux/compiler.h>
 
 #include <linux/string.h>
 EXPORT_SYMBOL(memset);
@@ -94,16 +95,19 @@ EXPORT_SYMBOL($$divI_15);
 
 extern void __ashrdi3(void);
 extern void __ashldi3(void);
-extern void __lshrdi3(void);
 extern void __muldi3(void);
 extern void __ucmpdi2(void);
 
 EXPORT_SYMBOL(__ashrdi3);
 EXPORT_SYMBOL(__ashldi3);
-EXPORT_SYMBOL(__lshrdi3);
 EXPORT_SYMBOL(__muldi3);
 EXPORT_SYMBOL(__ucmpdi2);
 
+#if !(defined(CONFIG_64BIT) && (GCC_VERSION >= 110000))
+extern void __lshrdi3(void);
+EXPORT_SYMBOL(__lshrdi3);
+#endif
+
 asmlinkage void * __canonicalize_funcptr_for_compare(void *);
 EXPORT_SYMBOL(__canonicalize_funcptr_for_compare);
 

--
2.31.1

#1 lore raw
Quoted 2 lines · Helge Deller

It seems the __lshrdi3 symbol was dropped from libgcc.a from gcc-11 for 64-bit executables.

This is gcc bug.  There's a typo in libgcc/config/pa/t-dimode:

# Extra DImode libgcc2 functions to build.
lib2difuncs = _muldi3 _negdi2 _lshrdi _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2

Will fix.

__lshrdi3 isn't needed anymore for 64-bit binaries with gcc-11 and later.  Not sure for other shifts but it should be possible to handle them in pa.md.

Dave

Signature · 1 line
John David Anglin  [email protected]
#2 lore raw
Quoted 9 lines · John David Anglin
Quoted 2 lines · Helge Deller

It seems the __lshrdi3 symbol was dropped from libgcc.a from gcc-11 for 64-bit executables.

This is gcc bug.  There's a typo in libgcc/config/pa/t-dimode:

# Extra DImode libgcc2 functions to build.
lib2difuncs = _muldi3 _negdi2 _lshrdi _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2

Will fix.

This is now fixed in upstream gcc source.

Dave

Signature · 1 line
John David Anglin  [email protected]
author maintainer
#3 lore raw
Quoted 11 lines · John David Anglin
Quoted 9 lines · John David Anglin
Quoted 2 lines · Helge Deller

It seems the __lshrdi3 symbol was dropped from libgcc.a from gcc-11 for 64-bit executables.

This is gcc bug.  There's a typo in libgcc/config/pa/t-dimode:

# Extra DImode libgcc2 functions to build.
lib2difuncs = _muldi3 _negdi2 _lshrdi _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2

Will fix.

This is now fixed in upstream gcc source.

Thanks for fixing, Dave!

So, my patch:
https://patchwork.kernel.org/project/linux-parisc/patch/[email protected]/
and Mikulas patch:
https://patchwork.kernel.org/project/linux-parisc/patch/alpine.LRH.2.02.2111270717490.10680@file01.intranet.prod.int.rdu2.redhat.com/
won't be needed.

Good to know.

Helge

#4 lore raw
Quoted 11 lines · Helge Deller
Quoted 10 lines · John David Anglin
Quoted 9 lines · John David Anglin
Quoted 2 lines · Helge Deller

It seems the __lshrdi3 symbol was dropped from libgcc.a from gcc-11 for 64-bit executables.

This is gcc bug.  There's a typo in libgcc/config/pa/t-dimode:

# Extra DImode libgcc2 functions to build.
lib2difuncs = _muldi3 _negdi2 _lshrdi _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2

Will fix.

Quoted 8 lines
Quoted 1 line

This is now fixed in upstream gcc source.

Thanks for fixing, Dave!

So, my patch:
https://patchwork.kernel.org/project/linux-parisc/patch/[email protected]/
and Mikulas patch:
https://patchwork.kernel.org/project/linux-parisc/patch/alpine.LRH.2.02.2111270717490.10680@file01.intranet.prod.int.rdu2.redhat.com/
won't be needed.

Yes.  I will rebuild gcc-11 with fix but that will take a day or so.  In the meantime, gcc-10 should work.

But it would be good to know if the shift routines in libgcc are needed with gcc-11.  All the shifts should be inline.

Dave

Signature · 1 line
John David Anglin  [email protected]