Skip to content

Commit ec9d780

Browse files
MaskRaywilldeacon
authored andcommitted
arm64: Change .weak to SYM_FUNC_START_WEAK_PI for arch/arm64/lib/mem*.S
Commit 39d114d ("arm64: add KASAN support") added .weak directives to arch/arm64/lib/mem*.S instead of changing the existing SYM_FUNC_START_PI macros. This can lead to the assembly snippet `.weak memcpy ... .globl memcpy` which will produce a STB_WEAK memcpy with GNU as but STB_GLOBAL memcpy with LLVM's integrated assembler before LLVM 12. LLVM 12 (since https://reviews.llvm.org/D90108) will error on such an overridden symbol binding. Use the appropriate SYM_FUNC_START_WEAK_PI instead. Fixes: 39d114d ("arm64: add KASAN support") Reported-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Fangrui Song <maskray@google.com> Tested-by: Sami Tolvanen <samitolvanen@google.com> Tested-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20201029181951.1866093-1-maskray@google.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent ce3d31a commit ec9d780

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

arch/arm64/lib/memcpy.S

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@
5656
stp \reg1, \reg2, [\ptr], \val
5757
.endm
5858

59-
.weak memcpy
6059
SYM_FUNC_START_ALIAS(__memcpy)
61-
SYM_FUNC_START_PI(memcpy)
60+
SYM_FUNC_START_WEAK_PI(memcpy)
6261
#include "copy_template.S"
6362
ret
6463
SYM_FUNC_END_PI(memcpy)

arch/arm64/lib/memmove.S

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ C_h .req x12
4545
D_l .req x13
4646
D_h .req x14
4747

48-
.weak memmove
4948
SYM_FUNC_START_ALIAS(__memmove)
50-
SYM_FUNC_START_PI(memmove)
49+
SYM_FUNC_START_WEAK_PI(memmove)
5150
cmp dstin, src
5251
b.lo __memcpy
5352
add tmp1, src, count

arch/arm64/lib/memset.S

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ dst .req x8
4242
tmp3w .req w9
4343
tmp3 .req x9
4444

45-
.weak memset
4645
SYM_FUNC_START_ALIAS(__memset)
47-
SYM_FUNC_START_PI(memset)
46+
SYM_FUNC_START_WEAK_PI(memset)
4847
mov dst, dstin /* Preserve return value. */
4948
and A_lw, val, #255
5049
orr A_lw, A_lw, A_lw, lsl #8

0 commit comments

Comments
 (0)