Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp120135rwe; Tue, 23 Aug 2022 20:01:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR44ZC+dFrxczQnMtQbs2ByYAi5FHTT+ohF7XsiJgkToeEmenKZ2pQ6hccUMEt1/CvJVmSSt X-Received: by 2002:a05:6402:176a:b0:445:d87f:b42d with SMTP id da10-20020a056402176a00b00445d87fb42dmr5702910edb.157.1661310066777; Tue, 23 Aug 2022 20:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661310066; cv=none; d=google.com; s=arc-20160816; b=VaygdIC8ItjRCkuVOeXDFknZ5X702mm7JGhTGSgl627y1tgcGmfRevK84qqc/8aYkC 887W6+91FZ0E15rzpWidRmxza7mk0WOLdaibcbZBkN9eXNliNWkolZqWYK3gILYikA02 T511KkZizkiYikq17THYT8SRXp6+dL22Ruj/kH7O5AhCJwRYMFVqTHpYOMIHYM5Ygt0Y 04hpGgCZdTPMkv4Th2ViJl732wk+HtWZiGdjeBQrle3zdMRhjeAle3mKLcIvI7zwxW9O 6gMvpbnglx4wi+1zMSRsC5EsSdqCGr5m726kX5jS35I7i4kW7zkoPQba2BP7TIRJBvmz gVpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=WOHJeeaMvFZH/LjoKQuyMecqYYsO6Td99Hh41OfnthQ=; b=lpj7AllC4A3fnFiCZKFfiJEsHs9WhebKpAY3BszhqpQqFWKge1FEgxUzf/EO9F+U5W GdoXJVAxG9trqq2e9+/VHyW7tOWA8dZLR1tnHgcJ+lxNsEpFOOIHKO9PxeaO/sgbm0Gk nRWMHaC1/NCz1ZvixY2lK3+O5UeZzmKrnfZSt2/l1LCwrS8GfG67S8hbNIYcg2Y21CGP mCB8SlDdCzm9BuB0d5ldJ5/nZNuZFFf+aABCeNx9V+t4O3TQAtJZ6fDChw5O/e1YATHi 1GvkSL/we3uJEKrtoPeyW5FsVIIGQFmMbMuNk86qVgJWW8WRQ6U2cqrQAih6goA1Z8CG VcIA== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a056402519100b004469a602b4esi3694458edd.66.2022.08.23.20.00.39; Tue, 23 Aug 2022 20:01: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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230316AbiHXCsM (ORCPT + 99 others); Tue, 23 Aug 2022 22:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbiHXCsL (ORCPT ); Tue, 23 Aug 2022 22:48:11 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF8D36A4BD for ; Tue, 23 Aug 2022 19:48:09 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MC9RV1KKCz1N7Td; Wed, 24 Aug 2022 10:44:38 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 24 Aug 2022 10:48:01 +0800 Received: from [127.0.0.1] (10.67.108.67) by dggpemm500013.china.huawei.com (7.185.36.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 24 Aug 2022 10:48:01 +0800 Message-ID: <48ca5e9e-eb03-3fb1-96d0-4755e1d39c3f@huawei.com> Date: Wed, 24 Aug 2022 10:48:01 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.0 Subject: Re: [PATCH] objtool: replace _ASM_PTR with quad in macros Content-Language: en-US To: , , "peterz@infradead.org" CC: , , , , , References: <20220823133124.55914-1-chenzhongjin@huawei.com> From: Chen Zhongjin In-Reply-To: <20220823133124.55914-1-chenzhongjin@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.108.67] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500013.china.huawei.com (7.185.36.172) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/8/23 21:31, Chen Zhongjin wrote: > Macros STACK_FRAME_NON_STANDARD and ANNOTATE_NOENDBR uses > _ASM_PTR. It switch between .long and .quad based on 32bit > or 64bit. However objtool doesn't work for 32bit, so _ASM_PTR > makes no sense. > > Considering that _ASM_PTR comes from asm.h, which is x86 > specific head file, while objtool.h is generic. Replace > _ASM_PTR with quad and remove asm.h reference. > > Signed-off-by: Chen Zhongjin > --- > include/linux/objtool.h | 6 ++---- > tools/include/linux/objtool.h | 6 ++---- > 2 files changed, 4 insertions(+), 8 deletions(-) > > diff --git a/include/linux/objtool.h b/include/linux/objtool.h > index 62c54ffbeeaa..d2413cb78037 100644 > --- a/include/linux/objtool.h > +++ b/include/linux/objtool.h > @@ -45,8 +45,6 @@ struct unwind_hint { > > #ifdef CONFIG_OBJTOOL > > -#include > - > #ifndef __ASSEMBLY__ > > #define UNWIND_HINT(sp_reg, sp_offset, type, end) \ > @@ -87,7 +85,7 @@ struct unwind_hint { > #define ANNOTATE_NOENDBR \ > "986: \n\t" \ > ".pushsection .discard.noendbr\n\t" \ > - _ASM_PTR " 986b\n\t" \ > + ".quad 986b\n\t" \ > ".popsection\n\t" > > #define ASM_REACHABLE \ > @@ -144,7 +142,7 @@ struct unwind_hint { > > .macro STACK_FRAME_NON_STANDARD func:req > .pushsection .discard.func_stack_frame_non_standard, "aw" > - _ASM_PTR \func > + .quad \func > .popsection > .endm > > diff --git a/tools/include/linux/objtool.h b/tools/include/linux/objtool.h > index 62c54ffbeeaa..d2413cb78037 100644 > --- a/tools/include/linux/objtool.h > +++ b/tools/include/linux/objtool.h > @@ -45,8 +45,6 @@ struct unwind_hint { > > #ifdef CONFIG_OBJTOOL > > -#include > - > #ifndef __ASSEMBLY__ > > #define UNWIND_HINT(sp_reg, sp_offset, type, end) \ > @@ -87,7 +85,7 @@ struct unwind_hint { > #define ANNOTATE_NOENDBR \ > "986: \n\t" \ > ".pushsection .discard.noendbr\n\t" \ > - _ASM_PTR " 986b\n\t" \ > + ".quad 986b\n\t" \ > ".popsection\n\t" > > #define ASM_REACHABLE \ > @@ -144,7 +142,7 @@ struct unwind_hint { > > .macro STACK_FRAME_NON_STANDARD func:req > .pushsection .discard.func_stack_frame_non_standard, "aw" > - _ASM_PTR \func > + .quad \func > .popsection > .endm > As ppc said they will use objtool for both 32 and 64bit, maybe we still need a switchable symbol type for this. How about this one? diff --git a/include/linux/objtool.h b/include/linux/objtool.h index 62c54ffbeeaa..14af2bcc460b 100644 --- a/include/linux/objtool.h +++ b/include/linux/objtool.h @@ -45,10 +45,14 @@ struct unwind_hint {  #ifdef CONFIG_OBJTOOL -#include -  #ifndef __ASSEMBLY__ +#ifdef CONFIG_64BIT +#define _RELOC_PTR __stringify(.quad) +#else +#define _RELOC_PTR __stringify(.long) +#endif +  #define UNWIND_HINT(sp_reg, sp_offset, type, end)              \         "987: \n\t"                                             \         ".pushsection .discard.unwind_hints\n\t"                \ @@ -87,7 +91,7 @@ struct unwind_hint {  #define ANNOTATE_NOENDBR                                       \         "986: \n\t"                                             \         ".pushsection .discard.noendbr\n\t"                     \ -       _ASM_PTR " 986b\n\t"                                    \ +       _RELOC_PTR " 986b\n\t"                                  \         ".popsection\n\t"  #define ASM_REACHABLE                                                  \ @@ -98,6 +102,12 @@ struct unwind_hint {  #else /* __ASSEMBLY__ */ +#ifdef CONFIG_64BIT +#define _RELOC_PTR .quad +#else +#define _RELOC_PTR .long +#endif +  /*   * This macro indicates that the following intra-function call is valid.   * Any non-annotated intra-function call will cause objtool to issue a warning. @@ -144,7 +154,7 @@ struct unwind_hint {  .macro STACK_FRAME_NON_STANDARD func:req         .pushsection .discard.func_stack_frame_non_standard, "aw" -       _ASM_PTR \func +       _RELOC_PTR \func         .popsection  .endm