Making a syscall before ld.so self-relocation on MIPS

Joseph Myers joseph@codesourcery.com
Wed May 17 19:01:26 GMT 2023


On Wed, 17 May 2023, Florian Weimer via Libc-alpha wrote:

> I'm reviewing HIDDEN_VAR_NEEDS_DYNAMIC_RELOC if they support inline
> system calls (without function calls), so that I can make a system call
> (mmap actually) before initial self-relocation of the dynamic loader.
> 
> So far, it looks good in theory, except on MIPS.  First there is MIPS16:
> 
> /* There's no MIPS16 syscall instruction, so we go through out-of-line
>    standard MIPS wrappers.  These do use inline snippets below though,
>    through INTERNAL_SYSCALL_MIPS16.  Spilling the syscall number to
>    memory gives the best code in that case, avoiding the need to save
>    and restore a static register.  */
> 
> Is MIPS16 the default in GCC?  We don't build for explicitly in
> scripts/build-many-glibcs.py.

No, it's not the default; you need to use the -mips16 option.

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Libc-alpha mailing list