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 2705B3858C53 for ; Fri, 5 Jan 2024 08:37:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2705B3858C53 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2705B3858C53 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=89.208.246.23 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704443848; cv=none; b=NInVKnFfpC8+QA2Evi0Ygvp9Yu/Kaln2LvJroyvz0nNiay4i0uHuOK5twea2CWVpWu5OQ9HQ/j0bcq4K56U21sK9FISWaBFwejXT1gDvEmhu+dK7c+aNxZEeUlaabvcGZeV0QU2YbAPdRZG5CNIOBkTlERFYlKYV44exti0x5+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704443848; c=relaxed/simple; bh=RshwPn/zEazDuOK/XxuFLkZrXwaPV12p/ZCzitK3NXY=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=lIk5no+0d+yJs5I3gfuLR0SmGiDtI+FLSfCIGmMPc6uqt7Q0h3K0gmSr+iS56vH1tDI8MtbiMDxJ91FE++QXcWhvp3hcBJJnteAevC9YPXYocwLhH2UdtAsam8ZumKZ1nL3FijY+Ks7XKmdK4HFQwauBLXfujq0Yf0gIMPER0p4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1704443840; bh=RshwPn/zEazDuOK/XxuFLkZrXwaPV12p/ZCzitK3NXY=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=fznOSFPRSHXYvh54hCwUpaAb5CkUBGZwAVfZrAieNRPJbDt3pbvOcJK9/1iMsUueQ 2+nm3AZc7/jlcAXH+mWiqUhBspP8uDD2x5ZLzjhYfUcJ+qA9CWpEhpmXMWINApDAEu ZV0oBbN9tThdxogtu11DE68Ewf+dz8iEj46DIGBA= Received: from [IPv6:240e:358:110e:ca00:dc73:854d:832e:2] (unknown [IPv6:240e:358:110e:ca00:dc73:854d:832e:2]) (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 3AB0266E7E; Fri, 5 Jan 2024 03:37:15 -0500 (EST) Message-ID: Subject: Re: [PATCH v2 2/2] LoongArch: When the code model is extreme, the symbol address is obtained through macro instructions regardless of the value of -mexplicit-relocs. From: Xi Ruoyao To: Lulu Cheng , gcc-patches@gcc.gnu.org Cc: i@xen0n.name, xuchenghua@loongson.cn Date: Fri, 05 Jan 2024 16:37:08 +0800 In-Reply-To: <20240105034021.30177-3-chenglulu@loongson.cn> References: <20240105034021.30177-1-chenglulu@loongson.cn> <20240105034021.30177-3-chenglulu@loongson.cn> Autocrypt: addr=xry111@xry111.site; prefer-encrypt=mutual; keydata=mDMEYnkdPhYJKwYBBAHaRw8BAQdAsY+HvJs3EVKpwIu2gN89cQT/pnrbQtlvd6Yfq7egugi0HlhpIFJ1b3lhbyA8eHJ5MTExQHhyeTExMS5zaXRlPoiTBBMWCgA7FiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQrKrSDhnnEOPHFgD8D9vUToTd1MF5bng9uPJq5y3DfpcxDp+LD3joA3U2TmwA/jZtN9xLH7CGDHeClKZK/ZYELotWfJsqRcthOIGjsdAPuDgEYnkdPhIKKwYBBAGXVQEFAQEHQG+HnNiPZseiBkzYBHwq/nN638o0NPwgYwH70wlKMZhRAwEIB4h4BBgWCgAgFiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwwACgkQrKrSDhnnEOPjXgD/euD64cxwqDIqckUaisT3VCst11RcnO5iRHm6meNIwj0BALLmWplyi7beKrOlqKfuZtCLbiAPywGfCNg8LOTt4iMD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.2 MIME-Version: 1.0 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,LIKELY_SPAM_FROM,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 Fri, 2024-01-05 at 11:40 +0800, Lulu Cheng wrote: > =C2=A0bool > =C2=A0loongarch_explicit_relocs_p (enum loongarch_symbol_type type) > =C2=A0{ > +=C2=A0 /* Instructions pcalau12i, addi.d, lu32i.d and lu52i.d must be ad= jancent > +=C2=A0=C2=A0=C2=A0=C2=A0 so that the linker can infer the PC of pcalau12= i to apply relocations > +=C2=A0=C2=A0=C2=A0=C2=A0 to lu32i.d and lu52i.d.=C2=A0 Otherwise, the re= sults would be incorrect if > +=C2=A0=C2=A0=C2=A0=C2=A0 these four instructions are not in the same 4Ki= B page. > +=C2=A0=C2=A0=C2=A0=C2=A0 Therefore, macro instructions are used when cmo= del=3Dextreme.=C2=A0 */ > +=C2=A0 if (loongarch_symbol_extreme_p (type)) > +=C2=A0=C2=A0=C2=A0 return false; I think this is a bit of strange. With -mexplicit-relocs=3D{auto,always} we should still use explicit relocs, but coding all 4 instructions altogether as "pcalau12i.d\t%1,%pc64_hi12(%2)\n\taddi.d\t%0,$r0,%pclo12(%2)\n\tlu32i.d\t%= 0,%pc64_lo20(%2)\n\tlu52i.d\t%0,%0,%pc64_hi12(%2)" Give me several hours trying to implement this... --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University