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 EC0523894C1A for ; Mon, 5 Dec 2022 08:44:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC0523894C1A 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=1670229839; bh=QK1iYUEo9VAKaSMt/eou36RCoAbfDn5INoApLqV+CY4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Oj02PPEbGDJWz/fyn0gViSLRX4d5nuGdFd3gHeHGRrjtBVpA5vQBzuR3hJkEBLMKe DxH3n+0dtPiTASiqDYj+hF6G87ZSR1ekXj4jt52CMeQOBZVQro4pWaIcWfC5s2TbA5 DHAcZZDNBEMvATnbCJnNmtCGYEAI5eNV0u7fWu3I= Received: from [IPv6:240e:358:110c:2400:dc73:854d:832e:3] (unknown [IPv6:240e:358:110c:2400:dc73:854d:832e:3]) (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 B22CD66765; Mon, 5 Dec 2022 03:43:54 -0500 (EST) Message-ID: <31f6c836d79a8569d95a36c6b6fcfafddbdf459e.camel@xry111.site> Subject: Re: [PATCH v1 0/6] LoongArch linker relaxation support. From: Xi Ruoyao To: mengqinggang , binutils@sourceware.org Cc: xuchenghua@loongson.cn, liuzhensong@loongson.cn, chenglulu@loongson.cn, i.swmail@xen0n.name, maskray@google.com Date: Mon, 05 Dec 2022 16:43:45 +0800 In-Reply-To: <20221205080453.1352069-1-mengqinggang@loongson.cn> References: <20221205080453.1352069-1-mengqinggang@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD,LIKELY_SPAM_FROM,SPF_HELO_PASS,SPF_PASS,TXREP,T_PDS_OTHER_BAD_TLD 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 Mon, 2022-12-05 at 16:04 +0800, mengqinggang wrote: > Now, only the instrunctions expand from macro (la.local, la.got, etc.) at= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=20 > assembly time can be relaxed, because gcc instruction scheduling causes r= elax=C2=A0=C2=A0=20 > unable to handle some special cases. Gcc can add -mno-explicit-relocs opt= ion=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=20 > to generate macro instrunction. Frankly, I don't like this. Can the compiler explicitly emit some relocations to mark a instruction chain suitable for relaxation? Some random thought: .reloc R_LARCH_RELOC_X 1 pcalau12i $a0, %got_pc_hi20(sym_a) .reloc R_LARCH_RELOC_X 2 pcalau12i $a1, %got_pc_hi20(sym_b) .reloc R_LARCH_RELOC_X 1 ld.d $a0, $a0, %got_pc_lo12(sym_a) .reloc R_LARCH_RELOC_X 2 ld.d $a1, $a1, %got_pc_lo12(sym_b) .reloc R_LARCH_RELOC_X 1 ld.d $a0, $a0, 0 .reloc R_LARCH_RELOC_X 2 ld.d $a1, $a1, 0 Here "R_LARCH_RELOC_X" is an imaginary relocation type. We may be able to use the different values of the 32-bit addend to distinguish two load sequences interleaved after scheduling (I don't think there will be more than 2147483647 load sequences in an object file). This is just some random thoughts, I don't understand the linking process very well anyway. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University