Message ID | 20240126033932.3577932-1-mengqinggang@loongson.cn |
---|---|
State | Unresolved |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:e09d:b0:103:945f:af90 with SMTP id gm29csp425151dyb; Thu, 25 Jan 2024 19:39:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcpnAN95Xeb7ucO+5QHatqHLjQ7sHuMufeEeNkw3G6Xl6OyYi27IaZ6F4kg209ZotX705m X-Received: by 2002:a05:620a:618f:b0:783:bccd:3c21 with SMTP id or15-20020a05620a618f00b00783bccd3c21mr867556qkn.90.1706240386894; Thu, 25 Jan 2024 19:39:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706240386; cv=pass; d=google.com; s=arc-20160816; b=HuMM9TElcXIEWj25InaniK9YoVkPSOEJ45HYdiuD2i7gBxGo8lwpTI6qyBimqV2TSK u0bSZ1qgEf6ek6Rb9NosZBSWug3cKl+bk2Un9OejzgJZDKWUcafz86NBMA/AIQsRzRhE 7RuUJMxUbmDSDcZPoCgFAOGwAZr7StOsDYEcptn+DTKXBUSaYUYYKdmR2gwIF6OMa43+ R9e4LzMCyJcCFC/eyGqiFBfPHuIxM2qgaw/NoDHIWx9IeTNbyHDsulKcttHeGwf6VTlL 7vSIl0okC9Fj5uzYntpHCkxWhfnOpmgDGmTzmvbGa/BU5wPEbG5ed0p4J8/ZtGf3rn5V kwJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:arc-filter :dmarc-filter:delivered-to; bh=S/1vOeGRGfwIfS2STBdI7/oRhH3aslLsebZ3/7UW35Q=; fh=U2r70r6lM4CaLsg0nD1ogRZumvRYkjzjFyMUYCthtC0=; b=bNWb7pMU2HybiFxFs9N+ap9/7hUoPR9wyyVeFg6Z978t7It5D5sFfRmer3bzA7+5Li MXQ7MJB9yTJqAwfPK1ZFXElRV0fpGdbkI6TXoNaKRl+yT8jBYhQGEFUW+J64aQKJ5nDZ JBMZa/g+XricU1yz2HNQ4PrRmptexWu5VflYz2daLkBdLzVkNDaKOsefTn5NL77em9jW 2hFdVEq8hoNuZXhRlUXETbw7mEGiUA4uh2tCCGinAYYdZ5I/u7doEEUHqWgLiRJRKyOE p508UEwR03Lrl0zt14P3JGV3no46S3pGIr0LBPqEJOPIqute9+yKrsNBqlyMvSGpklIn oAQg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id s11-20020a05620a0bcb00b0078333a213cdsi476822qki.368.2024.01.25.19.39.46 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 19:39:46 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 982333858401 for <ouuuleilei@gmail.com>; Fri, 26 Jan 2024 03:39:46 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id B8EDA3858D28 for <binutils@sourceware.org>; Fri, 26 Jan 2024 03:39:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B8EDA3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B8EDA3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706240379; cv=none; b=wFobHXB46YwzouR2mFJ3++aYFQQDmVlFUbZJWrUTbSeKbQebbh455j/dtZO+UIZinsDNArF8NaLVqeC3oMORfUzVUSsYrXdP3f9pRL6AhbRtb16G6QJQdC0u46ZRXL627GaadovPY3NE6NCpUwd3hCrE5SK4QoCz/xg944mos58= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706240379; c=relaxed/simple; bh=fctr5/LiQJE5EpFJkNU2i25HFAgnxFhXi2RmAyYw8o8=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=KLb43zGqMZj69hQXq3vEjJbX0CZI8Hx4TdS8dyesHhxEsSTfBExkKsE20MthGhSMjvByOBaylUT+0ENbGsphHDV1gOwEEJRGMGqQEpAO2zioW/cOeVNQhTih5e7NxGzbEV+us1DYTJyg+iVwJ+qGIB62feLzM7xg9Lw5A7v6ALo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from loongson.cn (unknown [10.2.6.5]) by gateway (Coremail) with SMTP id _____8Axeeh1KbNlPg4GAA--.2035S3; Fri, 26 Jan 2024 11:39:34 +0800 (CST) Received: from 5.5.5 (unknown [10.2.6.5]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cx_c51KbNlwhcbAA--.51983S2; Fri, 26 Jan 2024 11:39:33 +0800 (CST) From: mengqinggang <mengqinggang@loongson.cn> To: binutils@sourceware.org Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn, liuzhensong@loongson.cn, cailulu@loongson.cn, xry111@xry111.site, i.swmail@xen0n.name, maskray@google.com, luweining@loongson.cn, wanglei@loongson.cn, hejinyang@loongson.cn, mengqinggang@loongson.cn Subject: [PATCH] LoongArch: Fix a bug of getting relocation type Date: Fri, 26 Jan 2024 11:39:32 +0800 Message-Id: <20240126033932.3577932-1-mengqinggang@loongson.cn> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Cx_c51KbNlwhcbAA--.51983S2 X-CM-SenderInfo: 5phqw15lqjwttqj6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj9xXoWrZF45KFWfuw1kCrWfJrWftFc_yoWfGrcEgF y3Kr1UCr47trWFvr15Xw1YyryFqr4fGF4kCF1Dtr1xGa1UXF4YkryxW34SkF1YyFWFq3sx urZFgr13Aw43ZosvyTuYvTs0mTUanT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUj1kv1TuYvT s0mT0YCTnIWjqI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUI cSsGvfJTRUUUb7kYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20x vaj40_Wr0E3s1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8JVWxJwA2z4x0Y4vEx4A2jsIE14v26F4j6r4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr1j6F4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc 02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAF wI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxAIw28IcxkI7V AKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCj r7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6x IIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAI w20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x 0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxU7XTmDUUUU X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789122719922278062 X-GMAIL-MSGID: 1789122719922278062 |
Series |
LoongArch: Fix a bug of getting relocation type
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | warning | Git am fail log |
Commit Message
mengqinggang
Jan. 26, 2024, 3:39 a.m. UTC
The old code works because R_LARCH_RELAX has no symbol index. It causes '(rel + 1)->r_info == R_LARCH_RELAX' is 1 and ELFNN_R_TYPE (1) is 1. --- bfd/elfnn-loongarch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Nick, This patch and 969f5c0e1 LoongArch: gas: Add support for s9 register a0aa6f4ab LoongArch: ld: Add support for TLS LE symbol with addend need to apply to 2.42 branch. 在 2024/1/26 上午11:39, mengqinggang 写道: > The old code works because R_LARCH_RELAX has no symbol index. It causes > '(rel + 1)->r_info == R_LARCH_RELAX' is 1 and ELFNN_R_TYPE (1) is 1. > --- > bfd/elfnn-loongarch.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c > index b2caa5fc3e1..0cc6273726c 100644 > --- a/bfd/elfnn-loongarch.c > +++ b/bfd/elfnn-loongarch.c > @@ -4166,7 +4166,7 @@ loongarch_relax_tls_le (bfd *abfd, asection *sec, > static uint32_t insn_rj,insn_rd; > symval = symval - elf_hash_table (link_info)->tls_sec->vma; > /* Whether the symbol offset is in the interval (offset < 0x800). */ > - if (ELFNN_R_TYPE ((rel + 1)->r_info == R_LARCH_RELAX) && (symval < 0x800)) > + if (ELFNN_R_TYPE ((rel + 1)->r_info) == R_LARCH_RELAX && (symval < 0x800)) > { > switch (ELFNN_R_TYPE (rel->r_info)) > {
Hi mengqinggang, > This patch and > > 969f5c0e1 LoongArch: gas: Add support for s9 register > a0aa6f4ab LoongArch: ld: Add support for TLS LE symbol with addend > > need to apply to 2.42 branch. Applied. I am hoping that this is the last of these as I am planning on creating the release on Monday, and I am always worried that last minute changes will bring in new bugs rather than fix old ones... Cheers Nick
On Fri, 2024-01-26 at 10:55 +0000, Nick Clifton wrote: > Hi mengqinggang, > > > This patch and > > > > 969f5c0e1 LoongArch: gas: Add support for s9 register > > a0aa6f4ab LoongArch: ld: Add support for TLS LE symbol with addend > > > > need to apply to 2.42 branch. > > Applied. > > I am hoping that this is the last of these as I am planning on creating the > release on Monday, and I am always worried that last minute changes will > bring in new bugs rather than fix old ones... Pity that we still have the __thread vs. -mcmodel=extreme issue (https://sourceware.org/pipermail/binutils/2024-January/132120.html and all the following discussion) not resolved yet. Possible to apply my straightforward (stupid) "fix" for 2.42 if a proper fix cannot be made soon?
Hi Xi, >> I am hoping that this is the last of these as I am planning on creating the >> release on Monday, and I am always worried that last minute changes will >> bring in new bugs rather than fix old ones... > > Pity that we still have the __thread vs. -mcmodel=extreme issue > (https://sourceware.org/pipermail/binutils/2024-January/132120.html and > all the following discussion) not resolved yet. > > Possible to apply my straightforward (stupid) "fix" for 2.42 if a proper > fix cannot be made soon? Yes. Please let me know, before Monday, which patch you want to use. Cheers Nick
On 1/26/24 7:02 PM, Xi Ruoyao wrote: > On Fri, 2024-01-26 at 10:55 +0000, Nick Clifton wrote: >> Hi mengqinggang, >> >>> This patch and >>> >>> 969f5c0e1 LoongArch: gas: Add support for s9 register >>> a0aa6f4ab LoongArch: ld: Add support for TLS LE symbol with addend >>> >>> need to apply to 2.42 branch. >> Applied. >> >> I am hoping that this is the last of these as I am planning on creating the >> release on Monday, and I am always worried that last minute changes will >> bring in new bugs rather than fix old ones... > Pity that we still have the __thread vs. -mcmodel=extreme issue > (https://sourceware.org/pipermail/binutils/2024-January/132120.html and > all the following discussion) not resolved yet. > > Possible to apply my straightforward (stupid) "fix" for 2.42 if a proper > fix cannot be made soon? > Hi, We have sent a new patch to fix the incorrect type transition problem caused by -mcmodel=extreme. Now only TLS type transition will be performed for normal. [PATCH 1/2] LoongArch: Fix incorrect type transition under extreme cmodel [PATCH 2/2] LoongArch: update test cases about TLS Can you help us merge it into the 2.42 branch? Thanks. Related discussions: [PATCH] LoongArch: Disallow TLS transition when a section contains TLS_IE64 or TLS_DESC64 reloc
On 1/27/2024 9:37 PM, Lulu Cai wrote: > On 1/26/24 7:02 PM, Xi Ruoyao wrote: >> On Fri, 2024-01-26 at 10:55 +0000, Nick Clifton wrote: >>> Hi mengqinggang, >>> >>>> This patch and >>>> >>>> 969f5c0e1 LoongArch: gas: Add support for s9 register >>>> a0aa6f4ab LoongArch: ld: Add support for TLS LE symbol with >>>> addend >>>> >>>> need to apply to 2.42 branch. >>> Applied. >>> >>> I am hoping that this is the last of these as I am planning on >>> creating the >>> release on Monday, and I am always worried that last minute changes >>> will >>> bring in new bugs rather than fix old ones... >> Pity that we still have the __thread vs. -mcmodel=extreme issue >> (https://sourceware.org/pipermail/binutils/2024-January/132120.html and >> all the following discussion) not resolved yet. >> >> Possible to apply my straightforward (stupid) "fix" for 2.42 if a proper >> fix cannot be made soon? >> > > Hi, > We have sent a new patch to fix the incorrect type transition problem > caused by -mcmodel=extreme. > Now only TLS type transition will be performed for normal. > [PATCH 1/2] LoongArch: Fix incorrect type transition under extreme cmodel > [PATCH 2/2] LoongArch: update test cases about TLS > Here is a link to the relevant patch. https://sourceware.org/pipermail/binutils/2024-January/132194.html https://sourceware.org/pipermail/binutils/2024-January/132195.html > Can you help us merge it into the 2.42 branch? > Thanks. > > Related discussions: > [PATCH] LoongArch: Disallow TLS transition when a section contains > TLS_IE64 or TLS_DESC64 reloc
Hi lulu Tsai, > Here is a link to the relevant patch. > > https://sourceware.org/pipermail/binutils/2024-January/132194.html > https://sourceware.org/pipermail/binutils/2024-January/132195.html Thanks for the links. Both of these patches are now in the 2.42 branch. Just in time! :-) Cheers Nick
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index b2caa5fc3e1..0cc6273726c 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -4166,7 +4166,7 @@ loongarch_relax_tls_le (bfd *abfd, asection *sec, static uint32_t insn_rj,insn_rd; symval = symval - elf_hash_table (link_info)->tls_sec->vma; /* Whether the symbol offset is in the interval (offset < 0x800). */ - if (ELFNN_R_TYPE ((rel + 1)->r_info == R_LARCH_RELAX) && (symval < 0x800)) + if (ELFNN_R_TYPE ((rel + 1)->r_info) == R_LARCH_RELAX && (symval < 0x800)) { switch (ELFNN_R_TYPE (rel->r_info)) {