From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 3237A3858CDB for ; Thu, 2 Mar 2023 16:12:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3237A3858CDB Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1677773522; bh=LjOBLJlMYncUF7AGjgPWhoskIdsGwOyRWd2KeE2ixBU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=DNl8WVVvWgrDkrEgJmbPQ8MSQG9d/8S/7h2FJIbi5/BYPD+QPpqyCP9PeKenIahJb gRT6I5W6/3XXnOwE+Xl2dXSqjKz7pSinArEUiH5bO/lme/9D4dn9Y/JXNG/PdfabT8 UM3/Uakt2+bD5TcTeFcmK7AiACQhFP3BZIvUu2K8= Received: from [IPv6:240e:358:1106:d100:dc73:854d:832e:6] (unknown [IPv6:240e:358:1106:d100:dc73:854d:832e:6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 195046632F; Thu, 2 Mar 2023 11:11:57 -0500 (EST) Message-ID: <164c53f480de7ff8535665484bfbc81e99fb9ac9.camel@xry111.site> Subject: Re: [PATCH] elfedit: add support for editing e_flags From: Xi Ruoyao To: WANG Xuerui , binutils@sourceware.org Cc: Chenghua Xu , Zhensong Liu , Qinggang Meng , WANG Xuerui Date: Fri, 03 Mar 2023 00:11:52 +0800 In-Reply-To: References: <20230302080137.3346439-1-i.swmail@xen0n.name> <502da978c3a38a5216a0d9abbbe3ebf22f8688e5.camel@xry111.site> <660c58cc-10bf-c43b-aded-27a27300cea3@xen0n.name> <1b9715e49f81b2104364e8477889cc142c1011c3.camel@xry111.site> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 MIME-Version: 1.0 X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,LIKELY_SPAM_FROM,SPF_HELO_PASS,SPF_PASS,TXREP 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 Thu, 2023-03-02 at 19:02 +0800, WANG Xuerui wrote: > > $ cc t.c -O2 -mabi=3Dlp64s -mfpu=3D64 -c > > $ readelf -a t.o | grep FLOAT > > =C2=A0=C2=A0=C2=A0 Flags:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0x41, SOFT-FLOAT, OBJ-v1 > >=20 > > But then bad thing happens: > >=20 > > $ objdump -d t.o > >=20 > > t.o:=C2=A0=C2=A0=C2=A0=C2=A0 file format elf64-loongarch > >=20 > >=20 > > Disassembly of section .text: > >=20 > > 0000000000000000 : > > =C2=A0=C2=A0=C2=A0=C2=A0 0:=C2=A001145800=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0frecip.d=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$= fa0, $fa0=C2=A0=C2=A0=C2=A0=C2=A0 <=3D you can't expect the arg in the god-= damn $fa0! > > =C2=A0=C2=A0=C2=A0=C2=A0 4:=C2=A04c000020=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0jirl=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0$zero, $ra, 0=C2=A0 <=3D you can't just return the ans= wer in $fa0! > >=20 > > This is completely broken.=C2=A0 However if your elfedit hack will "wor= k", > > this will "work" too anyway. FWIW: GCC patch is now https://gcc.gnu.org/pipermail/gcc-patches/2023-March/613215.html. > Mixing calling conventions is currently problematic in general, true.=20 > But in amdgpu's case things will work just fine, because discipline is > used throughout to ensure (a) no FP argument is passed across the=20 > boundary between FPU-enabled code and the rest, and (b) any such=20 > boundary-crossing method takes care to save/restore FPU context=20 > appropriately. You can argue this is the general case in kernel land, eve= n. Yes, it seems some other architectures are using this trick for DCN. (I'd planned to port the DCN driver several weeks later, but I guess you've already completed it now. And frankly I didn't expect the misbehavior of GCC :) --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University