On 4/10/22 02:26, Rob Landley wrote: >> FWIW this will do it: >> >> qemu-system-m68k -nographic -machine mcf5208evb -kernel vmlinux >> >> That will boot an m5208evb_defconfig generated vmlinux. >> But you will need a user space to get a full boot to login/shell. > > No FDPIC support. :( First stab at switching on CONFIG_BINFMT_FDPIC in the coldfire config and adding enough stuff to shut up the compiler. Maybe it'll let me load a PIE binary? Dunno yet, but it compiled a vmlinux that booted to the same panic as the previous one because I haven't fed it an initramfs yet... I also had to disable CONFIG_ELF_CORE or else the link died with: m68k-linux-musl-ld: fs/binfmt_elf_fdpic.o: in function `elf_dump_thread_status': binfmt_elf_fdpic.c:(.text+0x18): undefined reference to `task_user_regset_view' make: *** [Makefile:1155: vmlinux] Error 1 But when I did THAT it compiled. :) diff --git a/arch/m68k/include/asm/elf.h b/arch/m68k/include/asm/elf.h index 3d387ceaea3f..bcb072396640 100644 --- a/arch/m68k/include/asm/elf.h +++ b/arch/m68k/include/asm/elf.h @@ -114,4 +114,6 @@ typedef struct user_m68kfp_struct elf_fpregset_t; #define ELF_PLATFORM (NULL) +#define ELF_FDPIC_CORE_EFLAGS 0 + #endif diff --git a/arch/m68k/include/asm/mmu.h b/arch/m68k/include/asm/mmu.h index 5c15aacb1370..6f6d83b731ed 100644 --- a/arch/m68k/include/asm/mmu.h +++ b/arch/m68k/include/asm/mmu.h @@ -8,6 +8,10 @@ typedef unsigned long mm_context_t; #else typedef struct { unsigned long end_brk; +#ifdef CONFIG_BINFMT_ELF_FDPIC + unsigned long exec_fdpic_loadmap; + unsigned long interp_fdpic_loadmap; +#endif } mm_context_t; #endif diff --git a/arch/m68k/include/uapi/asm/ptrace.h b/arch/m68k/include/uapi/asm/ptrace.h index 19a1b9d0d858..869601381f30 100644 --- a/arch/m68k/include/uapi/asm/ptrace.h +++ b/arch/m68k/include/uapi/asm/ptrace.h @@ -71,6 +71,10 @@ struct switch_stack { #define PTRACE_SETREGS 13 #define PTRACE_GETFPREGS 14 #define PTRACE_SETFPREGS 15 +#define PTRACE_GETFDPIC 31 + +#define PTRACE_GETFDPIC_EXEC 0 +#define PTRACE_GETFDPIC_INTERP 1 #define PTRACE_GET_THREAD_AREA 25 diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt index 4d5ae61580aa..073360aa982c 100644 --- a/fs/Kconfig.binfmt +++ b/fs/Kconfig.binfmt @@ -45,7 +45,7 @@ config ARCH_USE_GNU_PROPERTY config BINFMT_ELF_FDPIC bool "Kernel support for FDPIC ELF binaries" default y if !BINFMT_ELF - depends on (ARM || (SUPERH && !MMU)) + depends on (ARM || (SUPERH && !MMU) || M68K) select ELFCORE help ELF FDPIC binaries are based on ELF, but allow the individual load Rob