Re: Did I ever post my sh fdpic-on-mmu patch here?

Rob Landley <[email protected]>
Newsgroups gmane.linux.ports.sh.devel
Message-ID <[email protected]>
On 4/1/25 15:22, John Paul Adrian Glaubitz wrote:
> Hi Rob,
> 
> On Tue, 2025-04-01 at 11:21 -0500, Rob Landley wrote:
>> I've been using
>> https://landley.net/bin/mkroot/0.8.11/linux-patches/0002-sh4-fdpic.patch
>> to test my sh2eb fdpic nommu userspace under vanilla qemu-system-sh4eb
>> with an sh4eb mmu kernel for a year now (since
>> https://landley.net/notes-2024.html#28-03-2024) but don't remember if I
>> ever sent it here?
...
> Could you post the patch with git-send-email so that it's inline and can be
> reviewed on the list?

Dreamhost's outgoing smtp server requires ssl and a login, so probably 
not easily? But let's see...

$ man git-send-email
No manual entry for git-send-email
$ git help send-email
No manual entry for gitsend-email
$ git send-email
git: 'send-email' is not a git command. See 'git --help'.
$ git-send-email
bash: git-send-email: command not found

Oh good grief, here:

From: Rob Landley <[email protected]>

Allow CONFIG_BINFMT_ELF_FDPIC loader to build on sh4 with mmu, same as arm.

--

  arch/sh/kernel/setup.c |   25 +++++++++++++++++++++++++
  fs/Kconfig.binfmt      |    2 +-
  2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index d3175f09b3aa..effda8b21370 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -404,3 +404,28 @@ void __init arch_cpu_finalize_init(void)
  #endif
  	*p = '\0';
  }
+
+#if defined(CONFIG_MMU) && defined(CONFIG_BINFMT_ELF_FDPIC)
+
+#include <linux/personality.h>
+#include <linux/elf-fdpic.h>
+
+void elf_fdpic_arch_lay_out_mm(struct elf_fdpic_params *exec_params,
+                               struct elf_fdpic_params *interp_params,
+                               unsigned long *start_stack,
+                               unsigned long *start_brk)
+{
+	set_personality((current->personality & ~PER_MASK) | PER_LINUX);
+
+        exec_params->load_addr = 0x8000;
+        interp_params->load_addr = ELF_ET_DYN_BASE;
+        *start_stack = TASK_SIZE - SZ_16M;
+
+        if ((exec_params->flags & ELF_FDPIC_FLAG_ARRANGEMENT) == 
ELF_FDPIC_FLAG_INDEPENDENT) {
+                exec_params->flags &= ~ELF_FDPIC_FLAG_ARRANGEMENT;
+                exec_params->flags |= ELF_FDPIC_FLAG_CONSTDISP;
+        }
+}
+
+#endif
+
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index f5693164ca9a..ba8c5fc81da4 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -58,7 +58,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 || ((M68K || RISCV || SUPERH || XTENSA) && !MMU)
+	depends on ARM || SUPERH || ((M68K || RISCV || XTENSA) && !MMU)
  	select ELFCORE
  	help
  	  ELF FDPIC binaries are based on ELF, but allow the individual load

> This makes it easier for review and pick up with the
> b4 utility

https://landley.net/notes-2024.html#09-04-2024

> and it's easily accessible though patchwork.

The above is "xclip -sel c < file.patch" which I then pasted "as 
quotation" into thunderbird and hit delete twice at the start of each 
line to take the "> " off but it's still in the magic "blue text because 
quotation" state that _should_ prevent line wrapping? (It does for the 
UI, I _think_ that carries through to sending? No of course disabling 
HTML email doesn't stop the compose window from maintaining unwanted 
markup...)

If that doesn't work, I have to track down a version of the no-wordwrap 
plugin that works with current thunderbird. (The one I was using went 
away in plugin api version skew du jour during the distro upgrade that 
might let me back onto the python version treadmill b4 enforces.)

> Thanks,
> Adrian

Rob
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.