This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v4 06/17] RISC-V: Startup and Dynamic Loading Code
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Palmer Dabbelt <palmer at dabbelt dot com>
- Cc: <libc-alpha at sourceware dot org>, <patches at groups dot riscv dot org>
- Date: Mon, 22 Jan 2018 23:08:55 +0000
- Subject: Re: [PATCH v4 06/17] RISC-V: Startup and Dynamic Loading Code
- Authentication-results: sourceware.org; auth=none
- References: <mhng-4f21e1a1-b1ea-44d9-9580-ae28091a26f2@palmer-si-x1c4>
On Mon, 22 Jan 2018, Palmer Dabbelt wrote:
> Ah, OK -- when I was going through something else I was wondering how that got
> enforced, I guess the answer is that it wasn't. I think something like this
> should do it
>
> diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h
> index 7d4fcee79662..21e401dbf2fb 100644
> --- a/sysdeps/riscv/dl-machine.h
> +++ b/sysdeps/riscv/dl-machine.h
> @@ -57,7 +57,20 @@
> static inline int __attribute_used__
> elf_machine_matches_host (const ElfW (Ehdr) *ehdr)
> {
> - return ehdr->e_machine == EM_RISCV;
> + /* We can only run RISC-V binaries. */
> + if (ehdr->e_machine != EM_RISCV)
> + return 1;
This looks like it's inverted (should return 0 for non-RISCV, not 1).
--
Joseph S. Myers
joseph@codesourcery.com