From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 073C13857806 for ; Fri, 27 Nov 2020 08:17:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 073C13857806 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-483-njbH9WNTPPeBP3BoQdmKtQ-1; Fri, 27 Nov 2020 03:17:38 -0500 X-MC-Unique: njbH9WNTPPeBP3BoQdmKtQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A0294107AD3B; Fri, 27 Nov 2020 08:17:37 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E80385D9CC; Fri, 27 Nov 2020 08:17:36 +0000 (UTC) From: Florian Weimer To: Huang Pei Cc: libc-help@sourceware.org Subject: Re: Question about setjmp_aux.c on MIPS References: <20201126120337.c7lsjbzlhrskzx7k@ambrosehua-HP-xw6600-Workstation> <87tutcnvj2.fsf@oldenburg2.str.redhat.com> <20201127075912.2zjmpmg6mvdibfe6@ambrosehua-HP-xw6600-Workstation> Date: Fri, 27 Nov 2020 09:17:35 +0100 In-Reply-To: <20201127075912.2zjmpmg6mvdibfe6@ambrosehua-HP-xw6600-Workstation> (Huang Pei's message of "Fri, 27 Nov 2020 15:59:12 +0800") Message-ID: <87mtz3kycg.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Nov 2020 08:17:43 -0000 * Huang Pei: > Hi,=20 > On Thu, Nov 26, 2020 at 01:37:53PM +0100, Florian Weimer wrote: >> * Huang Pei: >>=20 >> > For ld.so, it is not intended to use floating point instruction, but t= he >> > __sigsetjmp from _dl_catch_exception touch FP regs repeatedly as loadi= ng >> > DSOs, which cause unneeded FP context saving and restoring between tas= ks >> > that does not use FP at all, I wonder if this can be avoided. >>=20 >> I think I have posted patches to move _dl_catch_exception into ld.so >> (=E2=80=9Celf: Rework exception handling in the dynamic loader [BZ #2548= 6]=E2=80=9D). >> Once they are merged, you could special-case setjmp for use within ld.so >> not to save & restore floating point state when compiled for >> IS_IN (rtld). >>=20 > I got it, there is one more __sigsetjmp call from __libc_start_main in > libc.so, not from _dl_catch_exception, like this one: > ...... > > (gdb) c > Continuing. > > Breakpoint 1, __sigsetjmp_aux (env=3D0xffffbff2a0, savemask=3D0, > sp=3D1099507430048, fp=3D0, gp=3D1099376871424) at > ../sysdeps/mips/mips64/setjmp_aux.c:39 > 39 asm volatile ("s.d $f24, %0" : : "m" > (env[0].__jmpbuf[0].__fpregs[0])); > (gdb) bt > #0 __sigsetjmp_aux (env=3D0xffffbff2a0, savemask=3D0, sp=3D1099507430048= , > fp=3D0, gp=3D1099376871424) at ../sysdeps/mips/mips64/setjmp_aux.c:39 > #1 0x000000fff7ded7c0 in __libc_start_main (warning: GDB can't find the > start of the function at 0xfff7f9704f. > main=3D0xfff7f966e0, argc=3D, argv=3D0xffffbff3e0, > init=3D, fini=3D, rtld_fini=3D, > stack_end=3D) at libc-start.c:283 > #2 0x000000fff7f97050 in ?? () > (gdb)=20 > > ...... > > Can __libc_start_main call this special-case setjmp? It should be possible if __libc_start_main is also built in such a way that it does not floating-point registers. __libc_start_main does not return into user code, so it does not matter if it actually preserves callee-saved registers. Thanks, Florian --=20 Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243, Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'N= eill