Skip to content

Commit 034f4a7

Browse files
committed
xtensa: add __bswap{si,di}2 helpers
gcc-13 may generate calls for __bswap{si,di}2. This breaks the kernel build when optimization for size is selected. Add __bswap{si,di}2 helpers to fix that. Cc: [email protected] Fixes: 19c5699 ("xtensa: don't link with libgcc") Signed-off-by: Max Filippov <[email protected]>
1 parent 9c2cc74 commit 034f4a7

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

arch/xtensa/kernel/xtensa_ksyms.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ EXPORT_SYMBOL(empty_zero_page);
5656
*/
5757
extern long long __ashrdi3(long long, int);
5858
extern long long __ashldi3(long long, int);
59+
extern long long __bswapdi2(long long);
60+
extern int __bswapsi2(int);
5961
extern long long __lshrdi3(long long, int);
6062
extern int __divsi3(int, int);
6163
extern int __modsi3(int, int);
@@ -66,6 +68,8 @@ extern unsigned long long __umulsidi3(unsigned int, unsigned int);
6668

6769
EXPORT_SYMBOL(__ashldi3);
6870
EXPORT_SYMBOL(__ashrdi3);
71+
EXPORT_SYMBOL(__bswapdi2);
72+
EXPORT_SYMBOL(__bswapsi2);
6973
EXPORT_SYMBOL(__lshrdi3);
7074
EXPORT_SYMBOL(__divsi3);
7175
EXPORT_SYMBOL(__modsi3);

arch/xtensa/lib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55

66
lib-y += memcopy.o memset.o checksum.o \
7-
ashldi3.o ashrdi3.o lshrdi3.o \
7+
ashldi3.o ashrdi3.o bswapdi2.o bswapsi2.o lshrdi3.o \
88
divsi3.o udivsi3.o modsi3.o umodsi3.o mulsi3.o umulsidi3.o \
99
usercopy.o strncpy_user.o strnlen_user.o
1010
lib-$(CONFIG_PCI) += pci-auto.o

arch/xtensa/lib/bswapdi2.S

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 */
2+
#include <linux/linkage.h>
3+
#include <asm/asmmacro.h>
4+
#include <asm/core.h>
5+
6+
ENTRY(__bswapdi2)
7+
8+
abi_entry_default
9+
ssai 8
10+
srli a4, a2, 16
11+
src a4, a4, a2
12+
src a4, a4, a4
13+
src a4, a2, a4
14+
srli a2, a3, 16
15+
src a2, a2, a3
16+
src a2, a2, a2
17+
src a2, a3, a2
18+
mov a3, a4
19+
abi_ret_default
20+
21+
ENDPROC(__bswapdi2)

arch/xtensa/lib/bswapsi2.S

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 */
2+
#include <linux/linkage.h>
3+
#include <asm/asmmacro.h>
4+
#include <asm/core.h>
5+
6+
ENTRY(__bswapsi2)
7+
8+
abi_entry_default
9+
ssai 8
10+
srli a3, a2, 16
11+
src a3, a3, a2
12+
src a3, a3, a3
13+
src a2, a2, a3
14+
abi_ret_default
15+
16+
ENDPROC(__bswapsi2)

0 commit comments

Comments
 (0)