On Thu, Jul 16, 2026 at 4:06 AM Michael Tokarev <[email protected]> wrote:
>
> On 5/23/26 14:41, Matt Turner wrote:
> > Provides replacement VDSO with sigreturn trampolines
> > (__kernel_sigreturn, __kernel_rt_sigreturn) and syscall stubs
> > (clock_gettime, clock_gettime64, clock_getres, gettimeofday).
> >
> > Both LE and BE blobs are committed and selected at compile time via
> > TARGET_BIG_ENDIAN. The BE variant requires an sh4eb-unknown-linux-gnu
> > toolchain; sh4-unknown-linux-gnu does not support -mb.
> >
> > CFI register numbers follow GCC's SH_DEBUGGER_REGNO:
> > PR=17, GBR=18, MACH=20, MACL=21, FPUL=23, FPSCR=24, FR0-15=25-40.
> > ---
> >   linux-user/sh4/Makefile.vdso    |  18 ++++
> >   linux-user/sh4/elfload.c        |  14 ++++
> >   linux-user/sh4/meson.build      |  12 +++
> >   linux-user/sh4/target_elf.h     |   1 +
> >   linux-user/sh4/vdso-asmoffset.h |  45 ++++++++++
> >   linux-user/sh4/vdso-be.so       | Bin 0 -> 2704 bytes
> >   linux-user/sh4/vdso-le.so       | Bin 0 -> 2704 bytes
> >   linux-user/sh4/vdso.S           | 142 ++++++++++++++++++++++++++++++++
> >   linux-user/sh4/vdso.ld          |  67 +++++++++++++++
> >   9 files changed, 299 insertions(+)
> >   create mode 100644 linux-user/sh4/Makefile.vdso
> >   create mode 100644 linux-user/sh4/vdso-asmoffset.h
> >   create mode 100755 linux-user/sh4/vdso-be.so
> >   create mode 100755 linux-user/sh4/vdso-le.so
> >   create mode 100644 linux-user/sh4/vdso.S
> >   create mode 100644 linux-user/sh4/vdso.ld
> >
> > diff --git ./linux-user/sh4/Makefile.vdso ./linux-user/sh4/Makefile.vdso
> > new file mode 100644
> > index 0000000000..272c5d262d
> > --- /dev/null
> > +++ ./linux-user/sh4/Makefile.vdso
> > @@ -0,0 +1,18 @@
> > +include $(BUILD_DIR)/tests/tcg/sh4-linux-user/config-target.mak
> > +
> > +SUBDIR = $(SRC_PATH)/linux-user/sh4
> > +VPATH += $(SUBDIR)
> > +
> > +all: $(SUBDIR)/vdso-le.so $(SUBDIR)/vdso-be.so
> > +
> > +LDFLAGS = -nostdlib -shared -Wl,-h,linux-gate.so.1 \
> > +       -Wl,--build-id=sha1 -Wl,--hash-style=both \
> > +       -Wl,-T,$(SUBDIR)/vdso.ld
> > +
> > +$(SUBDIR)/vdso-le.so: vdso.S vdso.ld vdso-asmoffset.h
> > +     $(CC) -o $@ $(LDFLAGS) -ml $<
> > +
> > +CC_BE = sh4eb-unknown-linux-gnu-gcc
> > +
> > +$(SUBDIR)/vdso-be.so: vdso.S vdso.ld vdso-asmoffset.h
> > +     $(CC_BE) -o $@ $(LDFLAGS) $<
>
> Where this sh4eb-unknown-linux-gnu-gcc comes from?  For one,
> we don't have it in debian.  Can the same be produced with

I built it locally with Gentoo's crossdev tool.

>   sh4-linux-gnu-gcc -Wl,-EB -Wa,--big
>
> instead?  (Or -gcc -mb, which does not work on debian currenly).

I believe I ran into this as well, which led me to build a cross
toolchain myself. I didn't think to try `-Wl,-EB -Wa,--big`, but if
that works then it could have saved me some time :)

> I can pass this on command like as CC_BE="..".
>
> But I know nothing about sh4, so dunno if this is the right
> thing to do.  It builds, but I don't have any sh4eb binary
> to test against.

I'm not anywhere near an expert in sh4, but it seems that big-endian
sh4 is super niche and uncommon. I wasn't even sure whether I should
bother implementing big-endian support here.

Reply via email to