Skip to contentSkip to conversation

sparc64: CONFIG_COMPAT=n build fix and prompt

PATCH New Imre Kaloz 1 participant 3 messages Sep 27

Subsystems (2)
lore
Share & tools
lore

Imre Kaloz

author
#0 lore raw

cover sparc64: CONFIG_COMPAT=n build fix and prompt

852fed2e8bfe turns CONFIG_COMPAT off whenever the kernel is linked with LLD, and that configuration has never linked - patch 1 fixes it.

Patch 2 gives COMPAT a prompt, keeping the default y, so a kernel that will only run 64-bit binaries can save about 88 KiB.

Imre Kaloz (2):
sparc64: fix the build with CONFIG_COMPAT=n
sparc64: make 32-bit userland support configurable

 arch/sparc/Kconfig              | 8 +++++++-
 arch/sparc/include/asm/unistd.h | 2 ++
 arch/sparc/kernel/syscalls.S    | 4 ++++
 3 files changed, 13 insertions(+), 1 deletion(-)

base-commit: 62f4c998b297cf233997a2b4cd6fc2d2df0319c9

Signature · 1 line
2.47.3
author
#1 lore raw

PATCH 1/2 sparc64: fix the build with CONFIG_COMPAT=n

The 32-bit syscall trap vector already falls back to BTRAP() when CONFIG_COMPAT is off, but nothing else in the entry path does, so that configuration has never linked:

head_64.o: undefined reference to sys_call_table32' head_64.o: undefined reference to sys_llseek'

linux_syscall_trace32 and linux_sparc_syscall32 are reachable only through that vector, so build them with CONFIG_COMPAT. _llseek is entry 236 of the 64-bit table too, while fs/read_write.c provides it on a 64-bit kernel only for CONFIG_COMPAT or __ARCH_WANT_SYS_LLSEEK, so ask for it as powerpc does.

Fixes 852fed2e8bfe ("sparc: Disable compat support with LLD")
---
 arch/sparc/include/asm/unistd.h | 2 ++
 arch/sparc/kernel/syscalls.S    | 4 ++++
 2 files changed, 6 insertions(+)
arch/sparc/include/asm/unistd.h +2 -0
index d6bc76706a7a..76571120a1c6 100644
@@ -45,6 +45,8 @@
 #else
 #define __ARCH_WANT_SYS_TIME
 #define __ARCH_WANT_SYS_UTIME
+/* _llseek (236) is in the 64-bit table, so it must not depend on COMPAT. */
+#define __ARCH_WANT_SYS_LLSEEK
 #define __ARCH_WANT_COMPAT_SYS_SENDFILE
 #define __ARCH_WANT_COMPAT_STAT
 #endif
arch/sparc/kernel/syscalls.S +4 -0
index 96fe8763d70c..82f0c96c243a 100644
@@ -156,6 +156,7 @@ linux_sparc_ni_syscall:
 	ba,pt	%xcc, 4f
 	 or	%l7, %lo(sys_ni_syscall), %l7
 
+#ifdef CONFIG_COMPAT
 linux_syscall_trace32:
 	call	syscall_trace_enter
 	 add	%sp, PTREGS_OFF, %o0
@@ -185,6 +186,7 @@ linux_syscall_trace32:
 	srl	%i2, 0, %o2
 	ba,pt	%xcc, 5f
 	 srl	%i3, 0, %o3
+#endif
 
 linux_syscall_trace:
 	call	syscall_trace_enter
@@ -217,6 +219,7 @@ linux_syscall_trace:
 	 mov	%i4, %o4
 
 
+#ifdef CONFIG_COMPAT
 	/* Linux 32-bit system calls enter here... */
 	.align	32
 	.globl	linux_sparc_syscall32
@@ -240,6 +243,7 @@ linux_sparc_syscall32:
 	 srl	%i5, 0, %o5				! IEU1
 	ba,pt	%xcc, 3f
 	 sra	%o0, 0, %o0
+#endif
 
 	/* Linux native system calls enter here... */
 	.align	32
Signature · 1 line
2.47.3
author
#2 lore raw

PATCH 2/2 sparc64: make 32-bit userland support configurable

In reply to Imre Kaloz

CONFIG_COMPAT has no prompt on sparc64, so a kernel that will only ever run 64-bit binaries still carries the 32-bit system call table and entry path and the compat signal, ptrace, ioctl and System V IPC translation layers. Give it a prompt, keeping the default, so it can be left out; in a sparc64_defconfig build that makes the kernel about 88 KiB smaller.

---
 arch/sparc/Kconfig | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/sparc/Kconfig +7 -1
index ab77d3f2536e..3779fb3169ab 100644
@@ -447,13 +447,19 @@ config SPARC64_PCI_MSI
 endmenu
 
 config COMPAT
-	bool
+	bool "Kernel support for 32-bit SPARC binaries"
 	depends on SPARC64
 	depends on !LD_IS_LLD
 	default y
 	select HAVE_UID16
 	select ARCH_WANT_OLD_COMPAT_IPC
 	select COMPAT_OLD_SIGACTION
+	help
+	  Run 32-bit SPARC binaries on a 64-bit kernel. This builds the
+	  32-bit system call table and entry path, and the compat signal,
+	  ptrace, ioctl and System V IPC translation layers.
+
+	  If unsure, say Y.
 
 config ARCH_CC_CAN_LINK
 	bool
Signature · 1 line
2.47.3