This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v4 06/17] RISC-V: Startup and Dynamic Loading Code


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]