Message ID | 20230406025036.3022894-1-chenhuacai@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp732892vqo; Wed, 5 Apr 2023 19:57:06 -0700 (PDT) X-Google-Smtp-Source: AKy350Y+YGVgyqI0ioHN1QCyt8515xGJV+unEgbDg/W9AYKxwjrfH9Qi9APJQ2f30zLr3C8cuveq X-Received: by 2002:a17:907:bb8c:b0:946:e908:3af0 with SMTP id xo12-20020a170907bb8c00b00946e9083af0mr4195983ejc.26.1680749826382; Wed, 05 Apr 2023 19:57:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680749826; cv=none; d=google.com; s=arc-20160816; b=KPAVUOGtvVJRZxysD5gv+bvP2BqC1SN1uYbIFp92/UvKmNluAvq3Wmy23LgEZ5dZnw B+u4x3seM3mA38IUJOWBZ5FGgqJmgEYMPGxJuf4RCMUk4J2OQQqd8oVdyohQgt8SV9AW V945W12r6w6zCLENDzWIHxoZCbwa9deQnUVEtiz5TkfcmUuaQaxY2VZr3cI3OBTOJdwv DVSLM6Ms8YTsbLpBwMHFG/kmKCGROqZJ4lLOcPv55JV3jGP0lFWlGEI3GdO4yPcBu5il JZIDmGjEjIm5vwEPnxMvamVc7YSMcgMCUl7pQPLIfLG2jNhsv16bPnh/Obkfjs3W6U2B Jq7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=v5cCqKhmi6E6I5oHA+2JZrTa8rkU8njbbvm/6KQaPXw=; b=Dn6OVScIcijQhQh0iI3fVVK/lYvFuoxDkFkw6gFc4EJqAWjT3txx4fmVWBkMwioeye XYnux6H7RiPF/E+dxutxco2eKcMsrgthxEXNluw3loQicJzHKFaETj8oqAJr0WVc2r4d G6WKuAQe+c6cpXxeS5W5sGakIYHN+m9IADkg/wdwhKu+NHtlOu765tEqgvfnMrOP1NXQ mla84bOSaZKaRl5YFaSFzy7uL4yAQYVNp/yOztUJAERj4QHeVH/tNHLjHx0QEVJTpn6f JsBScif3/ss7D/r+oGAffDmaDKIzG7PluxSiU3BDqczMJ4IajVSOUngTMKEdeckvQEyq sGNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne14-20020a1709077b8e00b008dc76bf3a69si325602ejc.735.2023.04.05.19.56.42; Wed, 05 Apr 2023 19:57:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235222AbjDFCwB (ORCPT <rfc822;lkml4gm@gmail.com> + 99 others); Wed, 5 Apr 2023 22:52:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234889AbjDFCvm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 5 Apr 2023 22:51:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C41FAD2C; Wed, 5 Apr 2023 19:51:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 84095638A8; Thu, 6 Apr 2023 02:51:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73A1BC433EF; Thu, 6 Apr 2023 02:50:58 +0000 (UTC) From: Huacai Chen <chenhuacai@loongson.cn> To: Huacai Chen <chenhuacai@kernel.org> Cc: loongarch@lists.linux.dev, Xuefeng Li <lixuefeng@loongson.cn>, Guo Ren <guoren@kernel.org>, Xuerui Wang <kernel@xen0n.name>, Jiaxun Yang <jiaxun.yang@flygoat.com>, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Huacai Chen <chenhuacai@loongson.cn>, stable@vger.kernel.org, Chong Qiao <qiaochong@loongson.cn> Subject: [PATCH] LoongArch: module: set section addresses to 0x0 Date: Thu, 6 Apr 2023 10:50:36 +0800 Message-Id: <20230406025036.3022894-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762393929942591890?= X-GMAIL-MSGID: =?utf-8?q?1762393929942591890?= |
Series |
LoongArch: module: set section addresses to 0x0
|
|
Commit Message
Huacai Chen
April 6, 2023, 2:50 a.m. UTC
These got*, plt* and .text.ftrace_trampoline sections specified for LoongArch have non-zero addressses. Non-zero section addresses in a relocatable ELF would confuse GDB when it tries to compute the section offsets and it ends up printing wrong symbol addresses. Therefore, set them to zero, which mirrors the change in commit 5d8591bc0fbaeb6ded ("arm64 module: set plt* section addresses to 0x0"). Cc: stable@vger.kernel.org Signed-off-by: Chong Qiao <qiaochong@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> --- arch/loongarch/include/asm/module.lds.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Comments
On Thu, Apr 6, 2023 at 10:51 AM Huacai Chen <chenhuacai@loongson.cn> wrote: > > These got*, plt* and .text.ftrace_trampoline sections specified for > LoongArch have non-zero addressses. Non-zero section addresses in a > relocatable ELF would confuse GDB when it tries to compute the section > offsets and it ends up printing wrong symbol addresses. Therefore, set > them to zero, which mirrors the change in commit 5d8591bc0fbaeb6ded > ("arm64 module: set plt* section addresses to 0x0"). Good point, maybe I would check RISC-V! Thx. Reviewed-by: Guo Ren <guoren@kernel.org> > > Cc: stable@vger.kernel.org > Signed-off-by: Chong Qiao <qiaochong@loongson.cn> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> > --- > arch/loongarch/include/asm/module.lds.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/loongarch/include/asm/module.lds.h b/arch/loongarch/include/asm/module.lds.h > index 438f09d4ccf4..88554f92e010 100644 > --- a/arch/loongarch/include/asm/module.lds.h > +++ b/arch/loongarch/include/asm/module.lds.h > @@ -2,8 +2,8 @@ > /* Copyright (C) 2020-2022 Loongson Technology Corporation Limited */ > SECTIONS { > . = ALIGN(4); > - .got : { BYTE(0) } > - .plt : { BYTE(0) } > - .plt.idx : { BYTE(0) } > - .ftrace_trampoline : { BYTE(0) } > + .got 0 : { BYTE(0) } > + .plt 0 : { BYTE(0) } > + .plt.idx 0 : { BYTE(0) } > + .ftrace_trampoline 0 : { BYTE(0) } > } > -- > 2.39.1 >
diff --git a/arch/loongarch/include/asm/module.lds.h b/arch/loongarch/include/asm/module.lds.h index 438f09d4ccf4..88554f92e010 100644 --- a/arch/loongarch/include/asm/module.lds.h +++ b/arch/loongarch/include/asm/module.lds.h @@ -2,8 +2,8 @@ /* Copyright (C) 2020-2022 Loongson Technology Corporation Limited */ SECTIONS { . = ALIGN(4); - .got : { BYTE(0) } - .plt : { BYTE(0) } - .plt.idx : { BYTE(0) } - .ftrace_trampoline : { BYTE(0) } + .got 0 : { BYTE(0) } + .plt 0 : { BYTE(0) } + .plt.idx 0 : { BYTE(0) } + .ftrace_trampoline 0 : { BYTE(0) } }