On Wed, 30 Jul 2025 at 01:38, Richard Henderson
<richard.hender...@linaro.org> wrote:
>
> Rename from cpu_get_model to emphasize that this is
> an elf-specific function.  Declare the function once
> in loader.h.
>
> This frees up target_elf.h for other uses.
>
> Signed-off-by: Richard Henderson <richard.hender...@linaro.org>


> @@ -805,7 +804,7 @@ int main(int argc, char **argv, char **envp)
>      }
>
>      if (cpu_model == NULL) {
> -        cpu_model = cpu_get_model(get_elf_eflags(execfd));
> +        cpu_model = get_elf_cpu_model(get_elf_eflags(execfd));
>      }
>      cpu_type = parse_cpu_option(cpu_model);

Since this patch is just moving stuff around
Reviewed-by: Peter Maydell <peter.mayd...@linaro.org>

but this got me wondering how the bflt loader works -- it
looks like get_elf_eflags() will always return 0 for a
bflt executable, and because most of the cpu_get_model()
functions for bflt architectures[*] return a fixed string
it all works out, but this seems more like we get lucky
than we actually intended this.

[*] arm, aarch64, m68k, microblaze, sh4, xtensa:
all except m68k return a fixed string; m68k handles
eflags == 0 as "m68040", which may or may not be the
best choice.

thanks
-- PMM

Reply via email to