From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 75B963858D37 for ; Sun, 4 Sep 2022 07:39:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 75B963858D37 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=google.com Received: by mail-lf1-x135.google.com with SMTP id w8so9081011lft.12 for ; Sun, 04 Sep 2022 00:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=47c0wEwjny1ZW+WFZqmUd6N4Sw6NBGC53Icv5Rfw+ok=; b=F8SINZxMp1SdszIQPpAfmn8scN4lRe0nUxoM2MPNAO5WsA42Q2aOBqVTiyphOasgrQ yjl7VKWbDq9XP+bqMDLn99TbXPpCwkxH+tPtRUrhkOodrtJFGBbeZVAv/PzzQdhEwYMh cqSYEZaX1Gk0ZGND8l1ALoYTTWI1c9rKRdgzAxQ/TQY1RqedgtqtDQ22WalPDpxauM0H mKXm/P0EKko2RJ1VK3F4TD0GTNUT6mBbw8Ta9QnGMFL78q9VmA5ZrKa0ddZ6w/F/2Rru Z4yBzV7iRAwM5NQAr5Zkde+ZM64c8vXFYk9GvaR7nO7zs0XaECWWiT9oHkRaxKCPn+nS c7eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=47c0wEwjny1ZW+WFZqmUd6N4Sw6NBGC53Icv5Rfw+ok=; b=8DCflms7o0S3DytbmhJlOHpXFm8VWwg4y0czbdunR4h0pQNttY8xw04WieuWqajs3f HL7yhN0Ipo4ei3nF/gkcNSRQN7pgQ7z9RjyR45a64wCzB+g+BOyKcbjeNyOYEGqmQVkB gJcXrxfxn4ME88IOmFLNgCo3OFWTWSRa/Zf80mzzla1DMzXIAtPEiAoo9q87lrfSgdWF 3PP+j9EJIlbXLmgS6Y1VHOPYf7b6MwuflaBL7WM6/fo4Jytf66Nbav9e2vxey/1mmDbX NXOMYbTyNbpl5SImgzuGXJeu9R+RxW1X74tTnlaVlb7QMeFujDVFdbKdF8SPhyLMWRv0 u6JQ== X-Gm-Message-State: ACgBeo34QnSd2iLkAk6MnQf+g2Z5WYofSZIh4HJW1S2Gvt4QH75XRew+ hRUgLzxg3j1ml3ft/vf6MTvUI9/XJpoMCeB5+2/iCQ== X-Google-Smtp-Source: AA6agR4uGYCI2rYPlGT3l9aj9Tg6vCXwBLKMAyKqDE8Xq40D/ERUlz+M69cNbaht2R+Y4vfTyMZRlAg5SHq1zMs0v4E= X-Received: by 2002:a05:6512:6c8:b0:48a:f375:9ecc with SMTP id u8-20020a05651206c800b0048af3759eccmr13866499lff.206.1662277150328; Sun, 04 Sep 2022 00:39:10 -0700 (PDT) MIME-Version: 1.0 References: <20220901105412.42242-1-xry111@xry111.site> <11ab925378eb7f4ee3a0e8a6a81be45c64aebe00.camel@xry111.site> <496bac6b-95b0-00ec-a212-0142104950c4@loongson.cn> In-Reply-To: <496bac6b-95b0-00ec-a212-0142104950c4@loongson.cn> From: Fangrui Song Date: Sun, 4 Sep 2022 00:38:58 -0700 Message-ID: Subject: Re: [PATCH] LoongArch: add -mdirect-extern-access option To: Lulu Cheng Cc: Xi Ruoyao , gcc-patches@gcc.gnu.org, liuzhensong , Chenghua Xu , Huacai Chen , Wang Xuerui Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.9 required=5.0 tests=BAYES_00,DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 Sun, Sep 4, 2022 at 12:00 AM Lulu Cheng wrote: > > > =E5=9C=A8 2022/9/4 =E4=B8=8B=E5=8D=882:35, Xi Ruoyao =E5=86=99=E9=81=93: > > On Sun, 2022-09-04 at 11:22 +0800, Lulu Cheng wrote: > >> =E5=9C=A8 2022/9/4 =E4=B8=8A=E5=8D=8810:51, Xi Ruoyao =E5=86=99=E9=81= =93: > >> > >>> On Sun, 2022-09-04 at 10:26 +0800, Lulu Cheng wrote: > >>> > >>>> If the above modifications are not added, the function call is: > >>>> > >>>> bl %plt(test1) > >>>> > >>>> now is : > >>>> > >>>> bl test1 > >>> Regarding "%plt(...)", in the binutils code: > >>> > >>> /* For compatible old asm code. */ > >>> if (0 =3D=3D strcmp (op_c_str, "plt")) > >>> btype =3D BFD_RELOC_LARCH_B26; > >>> > >>> Link: > >>> https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dblob;f=3Dgas/con= fig/loongarch-parse.y;h=3D8704687706df50aa15aff05f97e4560d7ec6fa23;hb=3Dref= s/heads/master#l131 > >>> > >>> Zhensong: does "old asm code" here mean we should remove %plt from > >>> "new" > >>> assembly code, i. e. stop to print %plt(...) in GCC completely? > >>> > >> > >> I think '%plt' also needs to be removed from the readability of the > >> assembly code.:-\ > > I understand, but maybe we should remove %plt unconditionally, with or > > without -mdirect-extern-access. Note that for -mcmodel=3Dmedium we don= 't > > say something like "%pc_hi20(%plt(x))" either. > > > I have thought about this problem. For example, there is no '%plt' in > aarch64, but I think it can be added and easily distinguished at the > assembly code level, > > so this is not removed. I think @plt should be removed unconditionally. It was a mistake in some ABI (e.g. i386, riscv).