Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4237974pxj; Tue, 25 May 2021 03:32:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfoQQvhhmv4AuNrZrw7/Nkx79W0sLSHH9eamhb3BLY6Iz2rqqU0OR3KK89E9DeArxunq6C X-Received: by 2002:a05:6402:35c5:: with SMTP id z5mr32080263edc.210.1621938724900; Tue, 25 May 2021 03:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621938724; cv=none; d=google.com; s=arc-20160816; b=gRORT+hn/DjScornN5T1vlRerApKMyU2EVv/vghebOl2rE3de7j/RQ5/vwQPKPBsLV 7pnHCBT7wfgB//UpzhJMvSSTwayp4izopq3o671nXAEsoCoSFpKYKnyamx+ycpyOQPTC w2Fid2yNXRteaG+SId2nlmEWiYDu9dIlj9lAlR5EptWbHLHEKtxd14zf9s1cj/FPxefv F0QkMtPStBIevtTjfrRdgGVDAMT0iW518kcq1635PaQoXLr/v2+taBH5tQIbSfBQqQQJ oh5a+HO7z4Qk1cYr6uBhQqy5a69on/9Qn0XPpMGkBATXMQntOGrrh8y+gf6wh9q3Ff1c 5rWQ== 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=hldDP0CNEywd8VeFc/TjWNyMES0eJBPXdm+uW8kKJiw=; b=HcUOvdEqadWjjjVhv4I9PBnboPmunFygU8Ok1jItgXzxhuGN7jV49bAReIDHCHm6UU ooItBi6ISTkAumjNCv99/oPoIWMuGPvc3eryeG3ubRnFAY5vN6YiP8rOorYT57SLjIKk 1VdTL7+3mJBsBOu5QAlFH6BV84ZlefE0Dy12fx85CBWpO6KP7Lb1GBvFUSmc0DpH0BiE UAYNv6pL4DApkWWVjeUzQr6i/D/J+Z+kC4EDAw1ZLh09IvGjkEb/8rpywKkObTy7DICw g8dLCxQDy1ge8Ra3M1mI6zWbIit5y+wSOLGQBEMeWj3rksVGlOTgp63Y786+SKxIP8Yb KDbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l14si11040784ejg.496.2021.05.25.03.31.40; Tue, 25 May 2021 03:32:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232575AbhEYJ3V (ORCPT + 99 others); Tue, 25 May 2021 05:29:21 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:4001 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232487AbhEYJ3U (ORCPT ); Tue, 25 May 2021 05:29:20 -0400 Received: from dggems706-chm.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Fq7wT0gkXzmbRj; Tue, 25 May 2021 17:25:29 +0800 (CST) Received: from dggpemm500004.china.huawei.com (7.185.36.219) by dggems706-chm.china.huawei.com (10.3.19.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 25 May 2021 17:27:49 +0800 Received: from huawei.com (10.174.28.241) by dggpemm500004.china.huawei.com (7.185.36.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 25 May 2021 17:27:48 +0800 From: Bixuan Cui To: CC: , , , , Bixuan Cui Subject: [PATCH -next v2] module: fix build error when CONFIG_SYSFS is disabled Date: Tue, 25 May 2021 18:50:49 +0800 Message-ID: <20210525105049.34804-1-cuibixuan@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="y" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.28.241] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500004.china.huawei.com (7.185.36.219) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix build error when disable CONFIG_SYSFS: kernel/module.c:2805:8: error: implicit declaration of function ‘sect_empty’; did you mean ‘desc_empty’? [-Werror=implicit-function-declaration] 2805 | if (!sect_empty(sechdr) && sechdr->sh_type == SHT_NOTE && Fixes: 9ee6682aa528 ("module: add printk formats to add module build ID to stacktraces") Reported-by: Hulk Robot Signed-off-by: Bixuan Cui Signed-off-by: Stephen Boyd --- Changes from v2: Put the sect_empty() definition outside of #ifdef CONFIG_SYSFS. kernel/module.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index decf4601e943..0543b44db81d 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1462,6 +1462,13 @@ resolve_symbol_wait(struct module *mod, return ksym; } +#ifdef CONFIG_KALLSYMS +static inline bool sect_empty(const Elf_Shdr *sect) +{ + return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0; +} +#endif + /* * /sys/module/foo/sections stuff * J. Corbet @@ -1469,11 +1476,6 @@ resolve_symbol_wait(struct module *mod, #ifdef CONFIG_SYSFS #ifdef CONFIG_KALLSYMS -static inline bool sect_empty(const Elf_Shdr *sect) -{ - return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0; -} - struct module_sect_attr { struct bin_attribute battr; unsigned long address; -- 2.17.1