qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] linux-user: warn if trying to use qemu-mipsn32[el] with non


From: Laurent Vivier
Subject: Re: [PATCH] linux-user: warn if trying to use qemu-mipsn32[el] with non n32 ELF
Date: Sat, 22 Aug 2020 11:54:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Le 22/08/2020 à 00:28, Carlo Marcelo Arenas Belón a écrit :
> While technically compatible will (depending on the CPU) hopefully fail
> later with a cryptic error:
> 
>   qemu: Unexpected FPU mode
> 
> Provide an earlier hint of what the problem might be by detecting if the
> binary might not be using the n32 ABI and print a warning.
> 
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>  linux-user/elfload.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index fe9dfe795d..64c3921cd9 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -2390,6 +2390,13 @@ static void load_elf_image(const char *image_name, int 
> image_fd,
>      if (!elf_check_ehdr(ehdr)) {
>          goto exit_errmsg;
>      }
> +#ifdef TARGET_ABI_MIPSN32
> +/* from arch/mips/include/asm/elf.h */
> +#define EF_MIPS_ABI2 0x00000020

This is already defined in include/elf.h

> +    if (!(ehdr->e_flags & EF_MIPS_ABI2)) {
> +        fprintf(stderr, "warning: ELF binary missing n32 flag\n");

I think an exit would be more appropriate:

    errmsg = "warning: ELF binary missing n32 flag";
    goto exit_errmsg;

> +    }
> +#endif
>  
>      i = ehdr->e_phnum * sizeof(struct elf_phdr);
>      if (ehdr->e_phoff + i <= BPRM_BUF_SIZE) {
> 

CC'ing mips maintainers (and Maciej as he sent a patch on the N32 topic
2 years ago...)

Thanks,
Laurent




reply via email to

[Prev in Thread] Current Thread [Next in Thread]