From patchwork Fri Apr 20 07:34:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 901702 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40S7Cb022Lz9s5H for ; Fri, 20 Apr 2018 17:44:10 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aUlJGVTt"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40S7CZ5JHvzF1x2 for ; Fri, 20 Apr 2018 17:44:10 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aUlJGVTt"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::243; helo=mail-pl0-x243.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aUlJGVTt"; dkim-atps=neutral Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40S70h4MWCzF23D for ; Fri, 20 Apr 2018 17:34:44 +1000 (AEST) Received: by mail-pl0-x243.google.com with SMTP id f7-v6so4790748plr.4 for ; Fri, 20 Apr 2018 00:34:44 -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=Gw0UjFLcTUpg8hQVAv/zAKgNhbsY1GJyxLZKuzP31Fo=; b=aUlJGVTtEix/uGglamL1huxFiXHTsA8Pwk3dQz0haAOF8PsTC3cihjFlKI3m7lWoSz Y1ISrZfbbdZN/PbOmywknPsv7RBy/zQPBVJEuhr1tfsxyvGk74F4pzhI6xSuOueT8FBn /nbhaItSG5N4hHBZ/abINg7d0fi9eXAUZXKmvFgzFXZsWr87KoKsbukElv6ukjXfGBMj qFimMMkYlatNyb+xQiYU93URS9p2clp+NEeyfWaLyBr+/B1VhacxiLaMCNvz7dxgEbai e3PZnmfug4JGijt0IxHxpx1lHBEY+BAmgu6dwOkAooNk9PTw5fmuRZKuYZqoLsYSUpkj qpHg== 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=Gw0UjFLcTUpg8hQVAv/zAKgNhbsY1GJyxLZKuzP31Fo=; b=qvw/G4K8ok/X1y4ITYXgDo+6c8UWSi2okxrIeOhh0KbYtlzwu3IRUnbb6Y66f6hGPF jxkc2e5ALQ40bgU5biMRKsFoFp3Pn7oaMbHfFYtJe7CxwYSzbaN4d/psjCv0FYMaDhZq fjypCJgn19Tdbiui9r85jai1HO4xWJdHLMvIc3YveU1FkQQsQAhOAv+8+qsBhtlOxkjv Pqd6ZbxY98ou7OGZY6M5exWnWWkQdA13sVjTg5BwaPZIxdo0wdEOPXlL9YS40rPGptKz BXcxd2s/0aBYpR8QvZ2MEpWU5NZhw1fAACGpVa56FMtHieipczZFWnr04/PD1bB9+wS7 lsGg== X-Gm-Message-State: ALQs6tDuhqMl6jKujlmAy2EdwiOtXprme8W5qVpONcEmcMDr5qqaZSTW Mv3R86Ns0Tgsje5sLVFYOI1Thg== X-Google-Smtp-Source: AIpwx4+XsUqzP675PZdSW9KgbVWMDmYzi34m18fNk4XpmPsUzbyP//4WeQ0mmegd4YLedjRHFFrJ1Q== X-Received: by 2002:a17:902:a58a:: with SMTP id az10-v6mr185763plb.210.1524209682311; Fri, 20 Apr 2018 00:34:42 -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.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Apr 2018 00:34:41 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 3/4] kbuild: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selectable if enabled Date: Fri, 20 Apr 2018 17:34:13 +1000 Message-Id: <20180420073414.23169-4-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> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Nicolas Pitre , Nicholas Piggin , linux-kbuild@vger.kernel.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Architectures that are capable can select HAVE_LD_DEAD_CODE_DATA_ELIMINATION to enable selection of that option (as an EXPERT kernel option). Signed-off-by: Nicholas Piggin --- arch/Kconfig | 15 --------------- init/Kconfig | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 8e0d665c8d53..3234b73d4626 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -596,21 +596,6 @@ config CC_STACKPROTECTOR_AUTO endchoice -config LD_DEAD_CODE_DATA_ELIMINATION - bool - help - Select this if the architecture wants to do dead code and - data elimination with the linker by compiling with - -ffunction-sections -fdata-sections and linking with - --gc-sections. - - This requires that the arch annotates or otherwise protects - its external entry points from being discarded. Linker scripts - must also merge .text.*, .data.*, and .bss.* correctly into - output sections. Care must be taken not to pull in unrelated - sections (e.g., '.text.init'). Typically '.' in section names - is used to distinguish them from label names / C identifiers. - config HAVE_ARCH_WITHIN_STACK_FRAMES bool help diff --git a/init/Kconfig b/init/Kconfig index f013afc74b11..1706d963766b 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1038,6 +1038,33 @@ config CC_OPTIMIZE_FOR_SIZE endchoice +config HAVE_LD_DEAD_CODE_DATA_ELIMINATION + bool + help + This requires that the arch annotates or otherwise protects + its external entry points from being discarded. Linker scripts + must also merge .text.*, .data.*, and .bss.* correctly into + output sections. Care must be taken not to pull in unrelated + sections (e.g., '.text.init'). Typically '.' in section names + is used to distinguish them from label names / C identifiers. + +config LD_DEAD_CODE_DATA_ELIMINATION + bool "Dead code and data elimination (EXPERIMENTAL)" + depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION + depends on EXPERT + help + Select this if the architecture wants to do dead code and + data elimination with the linker by compiling with + -ffunction-sections -fdata-sections, and linking with + --gc-sections. + + This can reduce on disk and in-memory size of the kernel + code and static data, particularly for small configs and + on small systems. This has the possibility of introducing + silently broken kernel if the required annotations are not + present. This option is not well tested yet, so use at your + own risk. + config SYSCTL bool