From patchwork Fri Apr 20 07:34:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 10351971 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 E374760365 for ; Fri, 20 Apr 2018 07:34:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D25282869A for ; Fri, 20 Apr 2018 07:34:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C720A286A1; Fri, 20 Apr 2018 07:34:44 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BA8D2823D for ; Fri, 20 Apr 2018 07:34:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754018AbeDTHem (ORCPT ); Fri, 20 Apr 2018 03:34:42 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:41052 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753980AbeDTHej (ORCPT ); Fri, 20 Apr 2018 03:34:39 -0400 Received: by mail-pf0-f194.google.com with SMTP id a2so3887319pff.8; Fri, 20 Apr 2018 00:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NtUQ3MLhI0KkR+tP4zgN34/92tIDR9PVqIU2JLAa+I8=; b=WL5UNdpXwTPTWw6q1t4APXmzTnbZ+EJjJwoo5ZAbUeoaeYplQwlwd/9Oi1TerVnlj2 uD2JRwKnpxnkrhyR8eHvkv9BaD7BOjc9zCsMnafleLkilHvGHdy8oMx8Hg/70cwPsTp+ Y9FoXhvgBqBcz8UXeU23qm5srg4WidVjkmKDzyjCE23GTzNmop71Yrw4d0x02anDs0pz vaqb69BWTZQg5wNeCwk+7NwiebC4Tw4lWrTlFjWhvk4urCLFpo4YNn4FnwNAVjPEL6PO sfPmXy6QZWmiUlK1q8/GXIURYbbUTa4qTXWcXnsBZ6Ja/mbv4EQUlrbDGtZCJgYyEvQo RR3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NtUQ3MLhI0KkR+tP4zgN34/92tIDR9PVqIU2JLAa+I8=; b=fOFeNpNK3OuKrJKXTkalVc5rcyXyh5D64BkZ4LjJZQ/92l1XzVTHNQ3ga5Xm28ayIu 6bAB5gPbkx5H6otA8swzSyFMV084FLu4xagcE3XIdehqagpygqZhL8vVuMkUd77mKmN3 9f/tmL7dS9hWlA3SVf84e9pfMLz5g4A02/ee1OpeBycxO2biawnNw6JqlZdSFp4JjlHX eCVaUzxRqVCkn9Vfn1YpjvuE8Wb5DNaFBeVNTJBQ2iBlwrUlV6QcGB07u1vzcfTBKRPF wB0JE+kW5bBq3DfSYLTnSZco/tLk/Bxeo55M51kvCWJszW2T8gWeaL3moSUqxepQDPzl 3auw== X-Gm-Message-State: ALQs6tDSuXmRmVHPGcRHFfQn22RNcx7y73eU4l0KF4+xx35shLUq/U4d kFo7afm8VHK0hWJRoy/eiU94WQ== X-Google-Smtp-Source: AIpwx4+7pDZBZqZLLVoA6Jt4ukPZ6bVcXZOdLRUGapzHXAx6xSbltTOxff56HD3ymZCOq8TL+LExfQ== X-Received: by 10.98.23.134 with SMTP id 128mr8662196pfx.120.1524209678502; Fri, 20 Apr 2018 00:34:38 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id v15sm12568724pfa.116.2018.04.20.00.34.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Apr 2018 00:34:37 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Cc: Nicholas Piggin , linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, Christophe Leroy , Nicolas Pitre Subject: [PATCH 2/4] kbuild: LD_DEAD_CODE_DATA_ELIMINATION no -ffunction-sections/-fdata-sections for module build Date: Fri, 20 Apr 2018 17:34:12 +1000 Message-Id: <20180420073414.23169-3-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180420073414.23169-1-npiggin@gmail.com> References: <20180420073414.23169-1-npiggin@gmail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Modules do not tend to cope with -ffunction-sections, even though they do not link with -gc-sections. It may be possible for unused symbols to be trimmed from modules, but in general that would take much more work in architecture module linker scripts. For now, enable these only for kernel build. Signed-off-by: Nicholas Piggin --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e811e0c509c5..2ed651403bb4 100644 --- a/Makefile +++ b/Makefile @@ -799,8 +799,8 @@ KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION -KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) -KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) +KBUILD_CFLAGS_KERNEL += $(call cc-option,-ffunction-sections,) +KBUILD_CFLAGS_KERNEL += $(call cc-option,-fdata-sections,) endif # arch Makefile may override CC so keep this after arch Makefile is included