Bug#1142174: sh4-linux-gnu-gcc does not produce big-endian binaries

Rob Landley <[email protected]> Fri, 17 Jul 2026 14:42:57 -0500
Newsgroups gmane.linux.debian.devel.gcc
Message-ID <a1ef6138-0b18-4826-be66-83f3536b3d28__10784.300479439$1784317889$gmane$org@landley.net>
On 7/16/26 03:22, Michael Tokarev wrote:
> Package: gcc-15-sh4-linux-gnu
> Version: 15.3.0-1cross1
> Severity: normal
> X-Debbugs-Cc: [email protected]
> User: [email protected]
> Usertags: sh4
> 
> When trying to build an sh4eb binary, there's a failure at the link stage:
> 
>   sh4-linux-gnu-gcc -mb vdso.S [other options]
>   ...
>   sh4-linux-gnu-ld.bfd: unrecognised emulation mode: shelf_linux
>   Supported emulations: shlelf_linux shlelf_fd

I built big endian binaries fine with 15.1.

I.E. 
https://landley.net/bin/toolchains/19-06-2026/sh4eb-linux-musl-cross.tar.xz 
built https://landley.net/bin/mkroot/0.8.14/sh4eb.tgz and booted it 
under QEMU.

I admit I haven't tried to do a multilib or glibc compiler in ages...

https://landley.net/bin/toolchains/19-06-2026/README

>>From the specs:
> 
>   *link_emul_prefix:
>   sh%{!mb:l}elf
> 
> I dunno if this is supposed to be valid or not, and whenever this is a
> gcc bug (specs file) or missing support in binutils.
> 
> as gets --big option correctly.
> 
> Also, using
> 
>   sh4-linux-gnu-gcc -Wl,-EB -Wa,--big vdso.S
> 
> produces a binary, but I dunno (yet) if it is the right one or not.
> 
> This is needed for qemu, as it now ships vdso for sh4eb (in assembly
> form, so it does not need anything extra) which has to be compiled.

I was using qemu 11.0.0 with my patch to provide 200 megs of memory to 
qemu's r2d board:

https://lists.gnu.org/archive/html/qemu-devel/2026-01/msg06318.html

Rob