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 Sat, 13 Jan 2018, Palmer Dabbelt wrote:

> diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h

> +/* Return nonzero iff ELF header is compatible with the running host.  */
> +static inline int __attribute_used__
> +elf_machine_matches_host (const ElfW (Ehdr) *ehdr)
> +{
> +  return ehdr->e_machine == EM_RISCV;
> +}

I don't think this is sufficient.  You should also check that the 
floating-point ABI matches so you don't load shared libraries for the 
wrong ABI.  (See e.g. MIPS for a more complicated elf_machine_matches_host 
example.)  If in future you have RV64I ILP32, you'll also need to check 
that only the right ILP32 libraries for the current instruction set are 
loaded (not RV32I into an RV64I ILP32 process or vice versa).  (Generic 
code in dl-load.c deals with only loading whichever is appropriate of 
32-bit or 64-bit ELF.)

-- 
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]