From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 93C303858C78 for ; Wed, 17 May 2023 19:41:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 93C303858C78 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.99,283,1677571200"; d="scan'208";a="6337164" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 17 May 2023 11:41:17 -0800 IronPort-SDR: /XOl5XvT8yxq9iiuCE6dhh4q1DEO9B237sri+flCcHEriCuY20nqhfJtR00wciGFOo8pGeSG+z Vk/BiXlE7AHEvgrsd71+71jsfIKaSnlHYSSJ6TVGZtJKhc3GSYBnPCl82+s955NaTU9ADwfemS AQRrjEBb8Vm1pWYeF8kJBMNJRlxLfUwmhY7SzqUfoYReNvUpsztREYffqEfYFRI9a7YN4RoM/z gZU2HzgV2IUA7TV/6I/bH9UnygJO/gIBm1MMxVrLGjH5s6Nxj+CEeUQ0N0FObsfBMhKF24Ptsj w9w= Date: Wed, 17 May 2023 19:41:12 +0000 From: Joseph Myers To: Florian Weimer CC: Subject: Re: Making a syscall before ld.so self-relocation on MIPS In-Reply-To: <87jzx6hi27.fsf@oldenburg3.str.redhat.com> Message-ID: <5865c192-215e-bd3b-dbd2-40234230c1c8@codesourcery.com> References: <87wn17jogh.fsf@oldenburg3.str.redhat.com> <87jzx6hi27.fsf@oldenburg3.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3106.7 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 17 May 2023, Florian Weimer via Libc-alpha wrote: > * Joseph Myers: > > > 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. > > And apparently this is expected to work for building glibc? We have > some support code for it. Yes, it's supposed to work for building glibc (without actually being a different ABI). I haven't tested it for several years. > I guess I could override that for elf/rtld.c with -mno-mips16. Would it > be okay to do that, and rely on GCC generating a direct bal instruction > for invoking the system call helper? I think using -mno-mips16 for elf/rtld.c is OK. -- Joseph S. Myers joseph@codesourcery.com