From patchwork Fri Jun 30 22:58:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 9820631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3C00A603F2 for ; Fri, 30 Jun 2017 22:59:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BA31285CE for ; Fri, 30 Jun 2017 22:59:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E809285D9; Fri, 30 Jun 2017 22:59:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 90389285CE for ; Fri, 30 Jun 2017 22:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=oTjUO85oLyvulMaSQo5pMIZt2rEENgQmfc+HOdM+9gw=; b=RC3 hV4AYM47CwyRR0C/9XmkJw8gEhNUPcCzbxgLcLeysB5nv7cxCMjdSDblMozL3gW/AaxNDzSf3znrB CnGB48XrYDz/2Lq5SJTOQ6DISidU4rq2WfV2jlOXc3fdQ3/fndQuv1lrs9rJtfw3Eemkvx6N0Aq4z iIx7+pNFod8WqztznfNop5VOF6Bwujqweo1bUn3SVoteJsp+eT/FnvAk5/3j9l2gOs32pHbLunE2H YsHjCzw0ufSVec0z8i13coyLZ2N6aFWy4lhSl/R0bLwn8nprFzEDeOLvz7vNpZHRGwivWCm19Q7rs W+tfwV8lngekz2BHXdDCJxMFzMxL//g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dR4sE-0001NP-6z; Fri, 30 Jun 2017 22:58:50 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dR4s9-0001H5-UT for linux-arm-kernel@lists.infradead.org; Fri, 30 Jun 2017 22:58:48 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0AE2E6084E; Fri, 30 Jun 2017 22:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1498863505; bh=dbP0wfl4eGg2hKqQXfOCb3aM1Pm9FDPbEKkH9uKt6oY=; h=From:To:Cc:Subject:Date:From; b=Thea4GdlYRn9Ym/fzqZ8d38YUs3qMU02r79KnXJx3nzO/pnn6/U/djmJlICSgq1oh hFHr/abjLbOG0lpr45Zw7Lz9Wkv3/mKaYiDCVpYJcypFMvpCRK3elIo11lMNDLSHGi oW4UguWXGhWLIviK8ctYrh8d0uTupBR9wU3IgppE= Received: from sboyd-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sboyd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1DC6960727; Fri, 30 Jun 2017 22:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1498863504; bh=dbP0wfl4eGg2hKqQXfOCb3aM1Pm9FDPbEKkH9uKt6oY=; h=From:To:Cc:Subject:Date:From; b=NBCxJS4AgTtfsKDIi+gc6lMUozjhShl67bW/IxQOFqTJ8iRDfYHkTVLrQo9xovDxu 5xZqSlAsibaS0sI3Lm+Zidg1Bod94M4OBUSQL1TXp50l07j3bb4BSNecKygZnMEbq0 auB7n5wXHycD1IG6YN6x5LyS5ry4v20ck4fhvLBA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1DC6960727 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sboyd@codeaurora.org From: Stephen Boyd To: Masahiro Yamada , Michal Marek Subject: [PATCH] kbuild: modpost: Warn about references from rodata to __init text Date: Fri, 30 Jun 2017 15:58:22 -0700 Message-Id: <20170630225822.25349-1-sboyd@codeaurora.org> X-Mailer: git-send-email 2.13.0.67.g10c78a162fa8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170630_155846_092759_E8A93016 X-CRM114-Status: GOOD ( 12.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kbuild@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Rob Clark , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If we have a structure that's marked const it will be placed into the .rodata section but it could reference an init section function. Include the read only data section in the check we have for read/write data sections referencing init sections so we can find this class of problems. This exposes quite a few places where const marked structures are referencing __init functions and __init data that we were previously ignoring. Cc: Rob Clark Cc: Bjorn Andersson Signed-off-by: Stephen Boyd --- Making this change leads to quite a few other errors even on the multi_v7_defconfig for ARM[1]. I still need to do a build of the allmodconfig to see how many other errors there, but it seems to be quite a few. I suppose those will need to be fixed before we can merge this? [1] https://www.irccloud.com/pastebin/zzqfWGQY/ scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 48397feb08fb..4f2be5c6727d 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -903,7 +903,7 @@ static void check_section(const char *modname, struct elf_info *elf, #define ALL_INIT_SECTIONS INIT_SECTIONS, ALL_XXXINIT_SECTIONS #define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS -#define DATA_SECTIONS ".data", ".data.rel" +#define DATA_SECTIONS ".rodata", ".data", ".data.rel" #define TEXT_SECTIONS ".text", ".text.unlikely", ".sched.text", \ ".kprobes.text", ".cpuidle.text" #define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \