Skip to content

Commit

Permalink
LoongArch: Remove the .fixup section usage
Browse files Browse the repository at this point in the history
Use the `.L_xxx` label to improve fixup code and then remove the .fixup
section usage.

Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
  • Loading branch information
Youling Tang authored and Huacai Chen committed Dec 14, 2022
1 parent 672999c commit 912bcfa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
14 changes: 5 additions & 9 deletions arch/loongarch/lib/clear_user.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@
#include <asm/export.h>
#include <asm/regdef.h>

.macro fixup_ex from, to, offset, fix
.if \fix
.section .fixup, "ax"
\to: addi.d a0, a1, \offset
.irp to, 0
.L_fixup_handle_\to\():
addi.d a0, a1, (\to) * (-8)
jr ra
.previous
.endif
_asm_extable \from\()b, \to\()b
.endm
.endr

/*
* unsigned long __clear_user(void *addr, size_t size)
Expand All @@ -36,7 +32,7 @@ SYM_FUNC_START(__clear_user)
2: move a0, a1
jr ra

fixup_ex 1, 3, 0, 1
_asm_extable 1b, .L_fixup_handle_0
SYM_FUNC_END(__clear_user)

EXPORT_SYMBOL(__clear_user)
16 changes: 6 additions & 10 deletions arch/loongarch/lib/copy_user.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@
#include <asm/export.h>
#include <asm/regdef.h>

.macro fixup_ex from, to, offset, fix
.if \fix
.section .fixup, "ax"
\to: addi.d a0, a2, \offset
.irp to, 0
.L_fixup_handle_\to\():
addi.d a0, a2, (\to) * (-8)
jr ra
.previous
.endif
_asm_extable \from\()b, \to\()b
.endm
.endr

/*
* unsigned long __copy_user(void *to, const void *from, size_t n)
Expand All @@ -39,8 +35,8 @@ SYM_FUNC_START(__copy_user)
3: move a0, a2
jr ra

fixup_ex 1, 4, 0, 1
fixup_ex 2, 4, 0, 0
_asm_extable 1b, .L_fixup_handle_0
_asm_extable 2b, .L_fixup_handle_0
SYM_FUNC_END(__copy_user)

EXPORT_SYMBOL(__copy_user)

0 comments on commit 912bcfa

Please sign in to comment.