Re: Question on BIGGEST_ALIGNMENT in GCC on NetBSD/m68k

Laurent Vivier <[email protected]> Mon, 16 Jun 2025 12:51:47 +0200
Newsgroups gmane.linux.ports.m68k,gmane.os.netbsd.ports.m68k,gmane.linux.debian.ports.68k
Message-ID <[email protected]>

Le 16/06/2025 à 12:07, Geert Uytterhoeven a écrit :
> Hi Laurent,
> 
> On Mon, 16 Jun 2025 at 11:16, Laurent Vivier <[email protected]> wrote:
>> Le 16/06/2025 à 11:00, John Paul Adrian Glaubitz a écrit :
>>>> And there will be a problem with binfmt_misc because we can't rely on
>>>> the ELF signature to know which qemu-user to run, the one with 2byte
>>>> alignment or the one with 4byte alignment?
>>> What about the ELF note [1] that David Brownlee suggested? Can these be used?
>>>
>>> Adrian
>>>
>>>> [1]https://www.netbsd.org/docs/kernel/elf-notes.html
>>
>> binfmt_misc doesn't use the sections to select the interpreter, but the
>> 128 first bytes of the file.
>>
>> I think you need to change the ABI type in the ELF header:
>> https://fr.wikipedia.org/wiki/Executable_and_Linkable_Format
> 
> Interesting....
> 
> Does any system actually use ABI (byte 7) = 3 (Linux)?
> All of amd64/arm/arm64/ia64/i386/m68k/microblaze/mips(el)/powerpc/risvc/s390/sh/sparc
> seem to use 0 (SYSV).
> 
> #define ELFOSABI_NONE   0
> #define ELFOSABI_LINUX  3
> 
> Ah, parisc does. And C6x uses 0x40.
> 

You're right. But to update the ELF header with the information we are 
using 4 bytes alignment perhaps we should use instead the e_flags entry?

It's architecture dependent and it seems used by MIPS (EF_MIPS_ABI2 
?)... so MIPS is OK, I think the problem is I don't use the correct 
binfmt_misc mask...

Thanks,
Laurent