From patchwork Wed May 9 12:59:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 10389391 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 4E8D760153 for ; Wed, 9 May 2018 13:00:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F46728FB6 for ; Wed, 9 May 2018 13:00:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33F9E28FC6; Wed, 9 May 2018 13:00:37 +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 DB46C28FB6 for ; Wed, 9 May 2018 13:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934875AbeEINAf (ORCPT ); Wed, 9 May 2018 09:00:35 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:41495 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934710AbeEINAU (ORCPT ); Wed, 9 May 2018 09:00:20 -0400 Received: by mail-pl0-f66.google.com with SMTP id az12-v6so4260721plb.8; Wed, 09 May 2018 06:00:20 -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=WoJyccsJ3UNlBn+WSFhRy77I6UAE7iHOxj+ZbIruWjk=; b=Q90KVoQpd9AIFRIIzn5sHswGSwC1sZvDbHjpI12cR4XLKeROvHBA9xlaHIL9bmX5+x BSVlL6SdvVxEw9rrjMRffpQP0I4XyLbBQA0t5NL4bgG43dYTjZr0nTdWvEywTAEwcvse oFQSsoMM1Y1Bykj7C+vAhWGOTpeYlXfIooaRDdmNYJuac9HZoRFhzbCla58HXPmFSiSL 1GeSm5HSCK5X+SuSnYUGDZtV+eTHfBjukxUBwPsy3EaTwmFgT1dyx0ezwaJtmWv5EmZs nIhJpmaIAKPzbsotwpYhe+NXXvaL2ahpVPRSBp+6xO0NeiV3bTv+PPW/LKF3E/DJ0kh3 gdpg== 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=WoJyccsJ3UNlBn+WSFhRy77I6UAE7iHOxj+ZbIruWjk=; b=T+/L/cXaCN0Ehu/Ac6X1bpGQq0SZzFVpHuw7TuysGDdy4xf9/vs6eh4sMtZN+mlHTu PHPohyeun+RndxBMr6QpuGnbhZ4bsCcDa9X0N7f6iyeekYD1VH5fTTXTFCNhQ0xEqzdn G+csJ7m8qsdLmYoW+4mIbQsa54Y//5jUi58I5JOpWT859EFjODJohbXQ7PfgnPkh0Jbi dpYYZU2yl6iUa27FtGzXOBoIei1ZbhUufDYUjUw4/m3Me+9Vs8XMXmCs+ab8FusG9D8p OvuPtrsvwZS0EBygUO4n7fnWfbUEUh6cFKBS8Y6rltEjWyLEVvzyslOCjAjiNoC8aDI9 mQCg== X-Gm-Message-State: ALQs6tCbWcOjOdxJ27mOmVkMfxanXS/xYNdnO6LkDoIhb5LU1ow9JSGd 5mHyEIn/Bxgl4IRd0LyOM20= X-Google-Smtp-Source: AB8JxZrqgXsg6lgDL65RCVXf2s8ahxyA8IAFJlwxicNaQ9H9q/QS9o7jQ55mC1YmLbG8g6PXjqwjeg== X-Received: by 2002:a17:902:7685:: with SMTP id m5-v6mr14224877pll.340.1525870819811; Wed, 09 May 2018 06:00:19 -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 u4-v6sm4271184pgn.10.2018.05.09.06.00.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 06:00:18 -0700 (PDT) From: Nicholas Piggin To: Masahiro Yamada Cc: Nicholas Piggin , linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 2/4] kbuild: LD_DEAD_CODE_DATA_ELIMINATION no -ffunction-sections/-fdata-sections for module build Date: Wed, 9 May 2018 22:59:59 +1000 Message-Id: <20180509130001.24276-3-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509130001.24276-1-npiggin@gmail.com> References: <20180509130001.24276-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 619a85ad716b..9dcbfb353f81 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