Skip to contentSkip to conversation

arm64: assembly export cleanup

PATCH In review Mark Rutland 2 participants 12 messages Dec 7, 2018 – Dec 10, 2018

Subsystems (2)
lore
Share & tools
lore

Mark Rutland

author reviewer
#0 lore raw

v2 cover arm64: assembly export cleanup

When exporting a C function, we place the EXPORT_SYMBOL() immediately after the function definition. Historically we couldn't do this with assembly functions, and hence we collected all of these exports in arm64ksyms.c. Over time, this has retained redundant includes and exports for items defined in C code.

For a while now it has been possible to export functions directly from assembly files, which is beneficial for ongoing maintenance.

These patches move the exports from arm64ksyms.c into their relevant assembly files, and remove the newly redundant arm64ksyms.c. I've pushed the series to my arm64/export-cleanup branch [1] on kernel.org.

Thanks,
Mark.

Since v1 [2]:
* fold arm64 <asm/export.h> into <asm/assembler.h>
* rebase to for-next/core

[1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arm64/export-cleanup
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-November/610372.html

Mark Rutland (10):
arm64: remove bitop exports
arm64: move memstart_addr export inline
arm64: add EXPORT_SYMBOL_NOKASAN()
arm64: tishift: use asm EXPORT_SYMBOL()
arm64: smccc: use asm EXPORT_SYMBOL()
arm64: page: use asm EXPORT_SYMBOL()
arm64: uaccess: use asm EXPORT_SYMBOL()
arm64: string: use asm EXPORT_SYMBOL()
arm64: frace: use asm EXPORT_SYMBOL()
arm64: remove arm64ksyms.c

 arch/arm64/include/asm/assembler.h |  9 ++++
 arch/arm64/kernel/Makefile         |  2 +-
 arch/arm64/kernel/arm64ksyms.c     | 88 --------------------------------------
 arch/arm64/kernel/entry-ftrace.S   |  4 ++
 arch/arm64/kernel/smccc-call.S     |  4 ++
 arch/arm64/lib/clear_page.S        |  1 +
 arch/arm64/lib/clear_user.S        |  2 +
 arch/arm64/lib/copy_from_user.S    |  4 +-
 arch/arm64/lib/copy_in_user.S      |  4 +-
 arch/arm64/lib/copy_page.S         |  1 +
 arch/arm64/lib/copy_to_user.S      |  4 +-
 arch/arm64/lib/memchr.S            |  1 +
 arch/arm64/lib/memcmp.S            |  1 +
 arch/arm64/lib/memcpy.S            |  2 +
 arch/arm64/lib/memmove.S           |  2 +
 arch/arm64/lib/memset.S            |  2 +
 arch/arm64/lib/strchr.S            |  1 +
 arch/arm64/lib/strcmp.S            |  1 +
 arch/arm64/lib/strlen.S            |  1 +
 arch/arm64/lib/strncmp.S           |  1 +
 arch/arm64/lib/strnlen.S           |  1 +
 arch/arm64/lib/strrchr.S           |  1 +
 arch/arm64/lib/tishift.S           |  5 +++
 arch/arm64/mm/init.c               |  2 +
 24 files changed, 52 insertions(+), 92 deletions(-)
 delete mode 100644 arch/arm64/kernel/arm64ksyms.c
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author reviewer
#1 lore raw

PATCH v2 1/10 arm64: remove bitop exports

Now that the arm64 bitops are inlines built atop of the regular atomics, we don't need to export anything.

Remove the redundant exports.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/arm64ksyms.c | 8 --------
 1 file changed, 8 deletions(-)
arch/arm64/kernel/arm64ksyms.c +0 -8
index 72f63a59b008..c4003c18a18b 100644
@@ -62,14 +62,6 @@ EXPORT_SYMBOL(__memset);
 EXPORT_SYMBOL(__memcpy);
 EXPORT_SYMBOL(__memmove);
 
-	/* atomic bitops */
-EXPORT_SYMBOL(set_bit);
-EXPORT_SYMBOL(test_and_set_bit);
-EXPORT_SYMBOL(clear_bit);
-EXPORT_SYMBOL(test_and_clear_bit);
-EXPORT_SYMBOL(change_bit);
-EXPORT_SYMBOL(test_and_change_bit);
-
 #ifdef CONFIG_FUNCTION_TRACER
 EXPORT_SYMBOL(_mcount);
 NOKPROBE_SYMBOL(_mcount);
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author reviewer
#2 lore raw

PATCH v2 2/10 arm64: move memstart_addr export inline

In reply to Mark Rutland

Since we define memstart_addr in a C file, we can have the export immediately after the definition of the symbol, as we do elsewhere.

As a step towards removing arm64ksyms.c, move the export of memstart_addr to init.c, where the symbol is defined.

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

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/arm64ksyms.c | 3 ---
 arch/arm64/mm/init.c           | 2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)
arch/arm64/kernel/arm64ksyms.c +0 -3
index c4003c18a18b..73237dc8a994 100644
@@ -40,9 +40,6 @@ EXPORT_SYMBOL(__arch_copy_to_user);
 EXPORT_SYMBOL(__arch_clear_user);
 EXPORT_SYMBOL(__arch_copy_in_user);
 
-	/* physical memory */
-EXPORT_SYMBOL(memstart_addr);
-
 	/* string / mem functions */
 #ifndef CONFIG_KASAN
 EXPORT_SYMBOL(strchr);
arch/arm64/mm/init.c +2 -0
index 9b432d9fcada..2983e0fc1786 100644
@@ -59,6 +59,8 @@
  * that cannot be mistaken for a real physical address.
  */
 s64 memstart_addr __ro_after_init = -1;
+EXPORT_SYMBOL(memstart_addr);
+
 phys_addr_t arm64_dma_phys_limit __ro_after_init;
 
 #ifdef CONFIG_BLK_DEV_INITRD
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author reviewer
#3 lore raw

PATCH v2 3/10 arm64: add EXPORT_SYMBOL_NOKASAN()

In reply to Mark Rutland

So that we can export symbols directly from assembly files, let's make use of the generic <asm/export.h>. We have a few symbols that we'll want to conditionally export for !KASAN kernel builds, so we add a helper for that in <asm/assembler.h>.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/include/asm/assembler.h | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/include/asm/assembler.h +9 -0
index 953208267252..d8b9d3a427d1 100644
@@ -23,6 +23,8 @@
 #ifndef __ASM_ASSEMBLER_H
 #define __ASM_ASSEMBLER_H
 
+#include <asm-generic/export.h>
+
 #include <asm/asm-offsets.h>
 #include <asm/cpufeature.h>
 #include <asm/debug-monitors.h>
@@ -490,6 +492,13 @@ USER(\label, ic	ivau, \tmp2)			// invalidate I line PoU
 #else
 #define NOKPROBE(x)
 #endif
+
+#ifdef CONFIG_KASAN
+#define EXPORT_SYMBOL_NOKASAN(name)
+#else
+#define EXPORT_SYMBOL_NOKASAN(name)	EXPORT_SYMBOL(name)
+#endif
+
 	/*
 	 * Emit a 64-bit absolute little endian symbol reference in a way that
 	 * ensures that it will be resolved at build time, even when building a
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author reviewer
#4 lore raw

PATCH v2 4/10 arm64: tishift: use asm EXPORT_SYMBOL()

In reply to Mark Rutland

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 tishift exports to the assembly file the functions are defined in.

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

Cc Will Deacon <[email protected]>
Cc Catalin Marinas <[email protected]>
---
 arch/arm64/kernel/arm64ksyms.c | 7 -------
 arch/arm64/lib/tishift.S       | 5 +++++
 2 files changed, 5 insertions(+), 7 deletions(-)
arch/arm64/kernel/arm64ksyms.c +0 -7
index 73237dc8a994..d80e9cfc3062 100644
@@ -68,10 +68,3 @@ NOKPROBE_SYMBOL(_mcount);
 EXPORT_SYMBOL(__arm_smccc_smc);
 EXPORT_SYMBOL(__arm_smccc_hvc);
 
-	/* tishift.S */
-extern long long __ashlti3(long long a, int b);
-EXPORT_SYMBOL(__ashlti3);
-extern long long __ashrti3(long long a, int b);
-EXPORT_SYMBOL(__ashrti3);
-extern long long __lshrti3(long long a, int b);
-EXPORT_SYMBOL(__lshrti3);
arch/arm64/lib/tishift.S +5 -0
index 0fdff97794de..047622536535 100644
@@ -5,6 +5,8 @@
 
 #include <linux/linkage.h>
 
+#include <asm/assembler.h>
+
 ENTRY(__ashlti3)
 	cbz	x2, 1f
 	mov	x3, #64
@@ -25,6 +27,7 @@ ENTRY(__ashlti3)
 	mov	x0, x2
 	ret
 ENDPROC(__ashlti3)
+EXPORT_SYMBOL(__ashlti3)
 
 ENTRY(__ashrti3)
 	cbz	x2, 1f
@@ -46,6 +49,7 @@ ENTRY(__ashrti3)
 	mov	x1, x2
 	ret
 ENDPROC(__ashrti3)
+EXPORT_SYMBOL(__ashrti3)
 
 ENTRY(__lshrti3)
 	cbz	x2, 1f
@@ -67,3 +71,4 @@ ENTRY(__lshrti3)
 	mov	x1, x2
 	ret
 ENDPROC(__lshrti3)
+EXPORT_SYMBOL(__lshrti3)
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author reviewer
#5 lore raw

PATCH v2 5/10 arm64: smccc: use asm EXPORT_SYMBOL()

In reply to Mark Rutland

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 SMCCC exports to the assembly file the functions are defined in.

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

Cc Will Deacon <[email protected]>
Cc Catalin Marinas <[email protected]>
---
 arch/arm64/kernel/arm64ksyms.c | 5 -----
 arch/arm64/kernel/smccc-call.S | 4 ++++
 2 files changed, 4 insertions(+), 5 deletions(-)
arch/arm64/kernel/arm64ksyms.c +0 -5
index d80e9cfc3062..74e29e69190b 100644
@@ -26,7 +26,6 @@
 #include <linux/syscalls.h>
 #include <linux/uaccess.h>
 #include <linux/io.h>
-#include <linux/arm-smccc.h>
 #include <linux/kprobes.h>
 
 #include <asm/checksum.h>
@@ -64,7 +63,3 @@ EXPORT_SYMBOL(_mcount);
 NOKPROBE_SYMBOL(_mcount);
 #endif
 
-	/* arm-smccc */
-EXPORT_SYMBOL(__arm_smccc_smc);
-EXPORT_SYMBOL(__arm_smccc_hvc);
-
arch/arm64/kernel/smccc-call.S +4 -0
index 62522342e1e4..184332286a81 100644
@@ -13,7 +13,9 @@
  */
 #include <linux/linkage.h>
 #include <linux/arm-smccc.h>
+
 #include <asm/asm-offsets.h>
+#include <asm/assembler.h>
 
 	.macro SMCCC instr
 	.cfi_startproc
@@ -40,6 +42,7 @@
 ENTRY(__arm_smccc_smc)
 	SMCCC	smc
 ENDPROC(__arm_smccc_smc)
+EXPORT_SYMBOL(__arm_smccc_smc)
 
 /*
  * void arm_smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2,
@@ -50,3 +53,4 @@ ENDPROC(__arm_smccc_smc)
 ENTRY(__arm_smccc_hvc)
 	SMCCC	hvc
 ENDPROC(__arm_smccc_hvc)
+EXPORT_SYMBOL(__arm_smccc_hvc)
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author reviewer
#6 lore raw

PATCH v2 6/10 arm64: page: use asm EXPORT_SYMBOL()

In reply to Mark Rutland

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 copy_page and clear_page exports to the assembly files the functions are defined in.

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

Cc Will Deacon <[email protected]>
Cc Catalin Marinas <[email protected]>
---
 arch/arm64/kernel/arm64ksyms.c | 3 ---
 arch/arm64/lib/clear_page.S    | 1 +
 arch/arm64/lib/copy_page.S     | 1 +
 3 files changed, 2 insertions(+), 3 deletions(-)
arch/arm64/kernel/arm64ksyms.c +0 -3
index 74e29e69190b..784b257d9643 100644
@@ -30,9 +30,6 @@
 
 #include <asm/checksum.h>
 
-EXPORT_SYMBOL(copy_page);
-EXPORT_SYMBOL(clear_page);
-
 	/* user mem (segment) */
 EXPORT_SYMBOL(__arch_copy_from_user);
 EXPORT_SYMBOL(__arch_copy_to_user);
arch/arm64/lib/clear_page.S +1 -0
index ef08e905e35b..6d13b0d64ad5 100644
@@ -37,3 +37,4 @@ ENTRY(clear_page)
 	b.ne	1b
 	ret
 ENDPROC(clear_page)
+EXPORT_SYMBOL(clear_page)
arch/arm64/lib/copy_page.S +1 -0
index 076c43715e64..98313e24a987 100644
@@ -87,3 +87,4 @@ alternative_else_nop_endif
 
 	ret
 ENDPROC(copy_page)
+EXPORT_SYMBOL(copy_page)
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author reviewer
#7 lore raw

PATCH v2 7/10 arm64: uaccess: use asm EXPORT_SYMBOL()

In reply to Mark Rutland

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 uaccess exports to the assembly files the functions are defined in. As we have to include <asm/assembler.h>, the existing includes are fixed to follow the usual ordering conventions.

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

Cc Will Deacon <[email protected]>
Cc Catalin Marinas <[email protected]>
---
 arch/arm64/kernel/arm64ksyms.c  | 7 -------
 arch/arm64/lib/clear_user.S     | 2 ++
 arch/arm64/lib/copy_from_user.S | 4 +++-
 arch/arm64/lib/copy_in_user.S   | 4 +++-
 arch/arm64/lib/copy_to_user.S   | 4 +++-
 5 files changed, 11 insertions(+), 10 deletions(-)
arch/arm64/kernel/arm64ksyms.c +0 -7
index 784b257d9643..02019667e319 100644
@@ -24,18 +24,11 @@
 #include <linux/delay.h>
 #include <linux/in6.h>
 #include <linux/syscalls.h>
-#include <linux/uaccess.h>
 #include <linux/io.h>
 #include <linux/kprobes.h>
 
 #include <asm/checksum.h>
 
-	/* user mem (segment) */
-EXPORT_SYMBOL(__arch_copy_from_user);
-EXPORT_SYMBOL(__arch_copy_to_user);
-EXPORT_SYMBOL(__arch_clear_user);
-EXPORT_SYMBOL(__arch_copy_in_user);
-
 	/* string / mem functions */
 #ifndef CONFIG_KASAN
 EXPORT_SYMBOL(strchr);
arch/arm64/lib/clear_user.S +2 -0
index 21ba0b29621b..feb225bd4b80 100644
@@ -18,6 +18,7 @@
 #include <linux/linkage.h>
 
 #include <asm/asm-uaccess.h>
+#include <asm/assembler.h>
 
 	.text
 
@@ -53,6 +54,7 @@ uao_user_alternative 9f, strb, sttrb, wzr, x0, 0
 	uaccess_disable_not_uao x2, x3
 	ret
 ENDPROC(__arch_clear_user)
+EXPORT_SYMBOL(__arch_clear_user)
 
 	.section .fixup,"ax"
 	.align	2
arch/arm64/lib/copy_from_user.S +3 -1
index 20305d485046..dea6c762d52f 100644
@@ -16,8 +16,9 @@
 
 #include <linux/linkage.h>
 
-#include <asm/cache.h>
 #include <asm/asm-uaccess.h>
+#include <asm/assembler.h>
+#include <asm/cache.h>
 
 /*
  * Copy from user space to a kernel buffer (alignment handled by the hardware)
@@ -71,6 +72,7 @@ ENTRY(__arch_copy_from_user)
 	mov	x0, #0				// Nothing to copy
 	ret
 ENDPROC(__arch_copy_from_user)
+EXPORT_SYMBOL(__arch_copy_from_user)
 
 	.section .fixup,"ax"
 	.align	2
arch/arm64/lib/copy_in_user.S +3 -1
index 54b75deb1d16..a84227fbf716 100644
@@ -18,8 +18,9 @@
 
 #include <linux/linkage.h>
 
-#include <asm/cache.h>
 #include <asm/asm-uaccess.h>
+#include <asm/assembler.h>
+#include <asm/cache.h>
 
 /*
  * Copy from user space to user space (alignment handled by the hardware)
@@ -73,6 +74,7 @@ ENTRY(__arch_copy_in_user)
 	mov	x0, #0
 	ret
 ENDPROC(__arch_copy_in_user)
+EXPORT_SYMBOL(__arch_copy_in_user)
 
 	.section .fixup,"ax"
 	.align	2
arch/arm64/lib/copy_to_user.S +3 -1
index fda6172d6b88..ef44c7ca3ffb 100644
@@ -16,8 +16,9 @@
 
 #include <linux/linkage.h>
 
-#include <asm/cache.h>
 #include <asm/asm-uaccess.h>
+#include <asm/assembler.h>
+#include <asm/cache.h>
 
 /*
  * Copy to user space from a kernel buffer (alignment handled by the hardware)
@@ -70,6 +71,7 @@ ENTRY(__arch_copy_to_user)
 	mov	x0, #0
 	ret
 ENDPROC(__arch_copy_to_user)
+EXPORT_SYMBOL(__arch_copy_to_user)
 
 	.section .fixup,"ax"
 	.align	2
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author reviewer
#8 lore raw

PATCH v2 8/10 arm64: string: use asm EXPORT_SYMBOL()

In reply to Mark Rutland

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.

Cc Will Deacon <[email protected]>
Cc Catalin Marinas <[email protected]>
---
 arch/arm64/kernel/arm64ksyms.c | 20 --------------------
 arch/arm64/lib/memchr.S        |  1 +
 arch/arm64/lib/memcmp.S        |  1 +
 arch/arm64/lib/memcpy.S        |  2 ++
 arch/arm64/lib/memmove.S       |  2 ++
 arch/arm64/lib/memset.S        |  2 ++
 arch/arm64/lib/strchr.S        |  1 +
 arch/arm64/lib/strcmp.S        |  1 +
 arch/arm64/lib/strlen.S        |  1 +
 arch/arm64/lib/strncmp.S       |  1 +
 arch/arm64/lib/strnlen.S       |  1 +
 arch/arm64/lib/strrchr.S       |  1 +
 12 files changed, 14 insertions(+), 20 deletions(-)
arch/arm64/kernel/arm64ksyms.c +0 -20
index 02019667e319..c142103bc0fe 100644
@@ -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>
@@ -29,25 +28,6 @@
 
 #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);
arch/arm64/lib/memchr.S +1 -0
index 0f164a4baf52..f146b7ecd28f 100644
@@ -42,3 +42,4 @@ WEAK(memchr)
 2:	mov	x0, #0
 	ret
 ENDPIPROC(memchr)
+EXPORT_SYMBOL_NOKASAN(memchr)
arch/arm64/lib/memcmp.S +1 -0
index fb295f52e9f8..e2e629b09049 100644
@@ -256,3 +256,4 @@ CPU_LE( rev	data2, data2 )
 	mov	result, #0
 	ret
 ENDPIPROC(memcmp)
+EXPORT_SYMBOL_NOKASAN(memcmp)
arch/arm64/lib/memcpy.S +2 -0
index 67613937711f..b4f82888ed60 100644
@@ -74,4 +74,6 @@ ENTRY(memcpy)
 #include "copy_template.S"
 	ret
 ENDPIPROC(memcpy)
+EXPORT_SYMBOL(memcpy)
 ENDPROC(__memcpy)
+EXPORT_SYMBOL(__memcpy)
arch/arm64/lib/memmove.S +2 -0
index a5a4459013b1..ef12f719d99d 100644
@@ -197,4 +197,6 @@ ENTRY(memmove)
 	b.ne	.Ltail63
 	ret
 ENDPIPROC(memmove)
+EXPORT_SYMBOL(memmove)
 ENDPROC(__memmove)
+EXPORT_SYMBOL(__memmove)
arch/arm64/lib/memset.S +2 -0
index f2670a9f218c..a79cf118d6d0 100644
@@ -216,4 +216,6 @@ ENTRY(memset)
 	b.ne	.Ltail_maybe_long
 	ret
 ENDPIPROC(memset)
+EXPORT_SYMBOL(memset)
 ENDPROC(__memset)
+EXPORT_SYMBOL(__memset)
arch/arm64/lib/strchr.S +1 -0
index 7c83091d1bcd..b179421f46c7 100644
@@ -40,3 +40,4 @@ WEAK(strchr)
 	csel	x0, x0, xzr, eq
 	ret
 ENDPROC(strchr)
+EXPORT_SYMBOL_NOKASAN(strchr)
arch/arm64/lib/strcmp.S +1 -0
index 7d5d15398bfb..c306c7b88574 100644
@@ -232,3 +232,4 @@ CPU_BE(	orr	syndrome, diff, has_nul )
 	sub	result, data1, data2, lsr #56
 	ret
 ENDPIPROC(strcmp)
+EXPORT_SYMBOL_NOKASAN(strcmp)
arch/arm64/lib/strlen.S +1 -0
index 8e0b14205dcb..2a0240937416 100644
@@ -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)
arch/arm64/lib/strncmp.S +1 -0
index 66bd145935d9..c5d567afb039 100644
@@ -308,3 +308,4 @@ CPU_BE( orr	syndrome, diff, has_nul )
 	mov	result, #0
 	ret
 ENDPIPROC(strncmp)
+EXPORT_SYMBOL_NOKASAN(strncmp)
arch/arm64/lib/strnlen.S +1 -0
index 355be04441fe..e21e536d420e 100644
@@ -169,3 +169,4 @@ CPU_LE( lsr	tmp2, tmp2, tmp4 )	/* Shift (tmp1 & 63).  */
 	mov	len, limit
 	ret
 ENDPIPROC(strnlen)
+EXPORT_SYMBOL_NOKASAN(strnlen)
arch/arm64/lib/strrchr.S +1 -0
index ea84924d5990..47e1593016dc 100644
@@ -41,3 +41,4 @@ WEAK(strrchr)
 2:	mov	x0, x3
 	ret
 ENDPIPROC(strrchr)
+EXPORT_SYMBOL_NOKASAN(strrchr)
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author reviewer
#9 lore raw

PATCH v2 9/10 arm64: frace: use asm EXPORT_SYMBOL()

In reply to Mark Rutland

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 ftrace exports to the assembly files the functions are defined in.

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

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/arm64ksyms.c   | 5 -----
 arch/arm64/kernel/entry-ftrace.S | 4 ++++
 2 files changed, 4 insertions(+), 5 deletions(-)
arch/arm64/kernel/arm64ksyms.c +0 -5
index c142103bc0fe..4ca8d2b245d2 100644
@@ -28,8 +28,3 @@
 
 #include <asm/checksum.h>
 
-#ifdef CONFIG_FUNCTION_TRACER
-EXPORT_SYMBOL(_mcount);
-NOKPROBE_SYMBOL(_mcount);
-#endif
-
arch/arm64/kernel/entry-ftrace.S +4 -0
index 032e24d2d554..81b8eb5c4633 100644
@@ -120,6 +120,8 @@ skip_ftrace_call:			// }
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 	mcount_exit
 ENDPROC(_mcount)
+EXPORT_SYMBOL(_mcount)
+NOKPROBE(_mcount)
 
 #else /* CONFIG_DYNAMIC_FTRACE */
 /*
@@ -131,6 +133,8 @@ ENDPROC(_mcount)
 ENTRY(_mcount)
 	ret
 ENDPROC(_mcount)
+EXPORT_SYMBOL(_mcount)
+NOKPROBE(_mcount)
 
 /*
  * void ftrace_caller(unsigned long return_address)
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author reviewer
#10 lore raw

PATCH v2 10/10 arm64: remove arm64ksyms.c

In reply to Mark Rutland

Now that arm64ksyms.c has been reduced to a stub, let's remove it entirely. New exports should be associated with their function definition.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/Makefile     |  2 +-
 arch/arm64/kernel/arm64ksyms.c | 30 ------------------------------
 2 files changed, 1 insertion(+), 31 deletions(-)
 delete mode 100644 arch/arm64/kernel/arm64ksyms.c
arch/arm64/kernel/Makefile +1 -1
index 4c8b13bede80..e069f957ec28 100644
@@ -30,7 +30,7 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE
 arm64-obj-$(CONFIG_COMPAT)		+= sys32.o kuser32.o signal32.o 	\
 					   sys_compat.o
 arm64-obj-$(CONFIG_FUNCTION_TRACER)	+= ftrace.o entry-ftrace.o
-arm64-obj-$(CONFIG_MODULES)		+= arm64ksyms.o module.o
+arm64-obj-$(CONFIG_MODULES)		+= module.o
 arm64-obj-$(CONFIG_ARM64_MODULE_PLTS)	+= module-plts.o
 arm64-obj-$(CONFIG_PERF_EVENTS)		+= perf_regs.o perf_callchain.o
 arm64-obj-$(CONFIG_HW_PERF_EVENTS)	+= perf_event.o
arch/arm64/kernel/arm64ksyms.c deleted +0 -30
deleted file mode 100644
index 4ca8d2b245d2..000000000000
@@ -1,30 +0,0 @@
-/*
- * Based on arch/arm/kernel/armksyms.c
- *
- * Copyright (C) 2000 Russell King
- * Copyright (C) 2012 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <linux/export.h>
-#include <linux/sched.h>
-#include <linux/cryptohash.h>
-#include <linux/delay.h>
-#include <linux/in6.h>
-#include <linux/syscalls.h>
-#include <linux/io.h>
-#include <linux/kprobes.h>
-
-#include <asm/checksum.h>
-
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#11 lore raw
In reply to Mark Rutland
Quoted 11 lines · Mark Rutland

When exporting a C function, we place the EXPORT_SYMBOL() immediately after the function definition. Historically we couldn't do this with assembly functions, and hence we collected all of these exports in arm64ksyms.c. Over time, this has retained redundant includes and exports for items defined in C code.

For a while now it has been possible to export functions directly from assembly files, which is beneficial for ongoing maintenance.

These patches move the exports from arm64ksyms.c into their relevant assembly files, and remove the newly redundant arm64ksyms.c. I've pushed the series to my arm64/export-cleanup branch [1] on kernel.org.

Cheers, I've picked this up.

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel