arm64: string: use asm EXPORT_SYMBOL()
authorMark Rutland <mark.rutland@arm.com>
Fri, 7 Dec 2018 18:08:21 +0000 (18:08 +0000)
committerWill Deacon <will.deacon@arm.com>
Mon, 10 Dec 2018 11:50:12 +0000 (11:50 +0000)
For a while now it's been possible to use EXPORT_SYMBOL() in assembly
files, which allows us to place exports immediately after assembly
functions, as we do for C functions.

As a step towards removing arm64ksyms.c, let's move the string routine
exports to the assembly files the functions are defined in. Routines
which should only be exported for !KASAN builds are exported using the
EXPORT_SYMBOL_NOKASAN() helper.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
12 files changed:
arch/arm64/kernel/arm64ksyms.c
arch/arm64/lib/memchr.S
arch/arm64/lib/memcmp.S
arch/arm64/lib/memcpy.S
arch/arm64/lib/memmove.S
arch/arm64/lib/memset.S
arch/arm64/lib/strchr.S
arch/arm64/lib/strcmp.S
arch/arm64/lib/strlen.S
arch/arm64/lib/strncmp.S
arch/arm64/lib/strnlen.S
arch/arm64/lib/strrchr.S

index 0201966..c142103 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <linux/export.h>
 #include <linux/sched.h>
-#include <linux/string.h>
 #include <linux/cryptohash.h>
 #include <linux/delay.h>
 #include <linux/in6.h>
 
 #include <asm/checksum.h>
 
-       /* string / mem functions */
-#ifndef CONFIG_KASAN
-EXPORT_SYMBOL(strchr);
-EXPORT_SYMBOL(strrchr);
-EXPORT_SYMBOL(strcmp);
-EXPORT_SYMBOL(strncmp);
-EXPORT_SYMBOL(strlen);
-EXPORT_SYMBOL(strnlen);
-EXPORT_SYMBOL(memcmp);
-EXPORT_SYMBOL(memchr);
-#endif
-
-EXPORT_SYMBOL(memset);
-EXPORT_SYMBOL(memcpy);
-EXPORT_SYMBOL(memmove);
-EXPORT_SYMBOL(__memset);
-EXPORT_SYMBOL(__memcpy);
-EXPORT_SYMBOL(__memmove);
-
 #ifdef CONFIG_FUNCTION_TRACER
 EXPORT_SYMBOL(_mcount);
 NOKPROBE_SYMBOL(_mcount);
index 0f164a4..f146b7e 100644 (file)
@@ -42,3 +42,4 @@ WEAK(memchr)
 2:     mov     x0, #0
        ret
 ENDPIPROC(memchr)
+EXPORT_SYMBOL_NOKASAN(memchr)
index fb295f5..e2e629b 100644 (file)
@@ -256,3 +256,4 @@ CPU_LE( rev data2, data2 )
        mov     result, #0
        ret
 ENDPIPROC(memcmp)
+EXPORT_SYMBOL_NOKASAN(memcmp)
index 6761393..b4f8288 100644 (file)
@@ -74,4 +74,6 @@ ENTRY(memcpy)
 #include "copy_template.S"
        ret
 ENDPIPROC(memcpy)
+EXPORT_SYMBOL(memcpy)
 ENDPROC(__memcpy)
+EXPORT_SYMBOL(__memcpy)
index a5a4459..ef12f71 100644 (file)
@@ -197,4 +197,6 @@ ENTRY(memmove)
        b.ne    .Ltail63
        ret
 ENDPIPROC(memmove)
+EXPORT_SYMBOL(memmove)
 ENDPROC(__memmove)
+EXPORT_SYMBOL(__memmove)
index f2670a9..a79cf11 100644 (file)
@@ -216,4 +216,6 @@ ENTRY(memset)
        b.ne    .Ltail_maybe_long
        ret
 ENDPIPROC(memset)
+EXPORT_SYMBOL(memset)
 ENDPROC(__memset)
+EXPORT_SYMBOL(__memset)
index 7c83091..b179421 100644 (file)
@@ -40,3 +40,4 @@ WEAK(strchr)
        csel    x0, x0, xzr, eq
        ret
 ENDPROC(strchr)
+EXPORT_SYMBOL_NOKASAN(strchr)
index 7d5d153..c306c7b 100644 (file)
@@ -232,3 +232,4 @@ CPU_BE(     orr     syndrome, diff, has_nul )
        sub     result, data1, data2, lsr #56
        ret
 ENDPIPROC(strcmp)
+EXPORT_SYMBOL_NOKASAN(strcmp)
index 8e0b142..2a02409 100644 (file)
@@ -124,3 +124,4 @@ CPU_LE( lsr tmp2, tmp2, tmp1 )      /* Shift (tmp1 & 63).  */
        csel    data2, data2, data2a, le
        b       .Lrealigned
 ENDPIPROC(strlen)
+EXPORT_SYMBOL_NOKASAN(strlen)
index 66bd145..c5d567a 100644 (file)
@@ -308,3 +308,4 @@ CPU_BE( orr syndrome, diff, has_nul )
        mov     result, #0
        ret
 ENDPIPROC(strncmp)
+EXPORT_SYMBOL_NOKASAN(strncmp)
index 355be04..e21e536 100644 (file)
@@ -169,3 +169,4 @@ CPU_LE( lsr tmp2, tmp2, tmp4 )      /* Shift (tmp1 & 63).  */
        mov     len, limit
        ret
 ENDPIPROC(strnlen)
+EXPORT_SYMBOL_NOKASAN(strnlen)
index ea84924..47e1593 100644 (file)
@@ -41,3 +41,4 @@ WEAK(strrchr)
 2:     mov     x0, x3
        ret
 ENDPIPROC(strrchr)
+EXPORT_SYMBOL_NOKASAN(strrchr)