Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp683590pxb; Thu, 25 Feb 2021 12:18:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJwstlgxFTX10ndEaPGpX35Aqk/iqzp8flcnRW+2dB7QSMsJ+qTN9iXk0AkvVphhmiZjSjT9 X-Received: by 2002:a05:6402:c84:: with SMTP id cm4mr4774595edb.276.1614284339793; Thu, 25 Feb 2021 12:18:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614284339; cv=none; d=google.com; s=arc-20160816; b=IWPE5LhTIcyMcPaiBu+6O5yqZfP75P8iz0v0oTdvgxu9Ymkptl+JrT8ii97D4Z8mis beV3tx09AHIMqIBfa90rAB4baKkzD7+sD2XjoSs5o/V6JaXKCnj53l5711IRwJTY+tvx aiNk/40fACj7JKV7zLJkzZ1Pl/SXW/zSS+HKeUAksWZm3s1ACNM/10jfYXtYpj5ZU0Gc ptlU4pgofjgbrFXXuod1pcuRk007JzHKlvKeHLqDdbn+g/QdAgFTUOxmLrMb6DazuERV cRNH6xFoaVhRICuIyyt2FT/g1z2KOR02PS+rE7f6ZOvwN8uK+U3VACdUOD/pb5/d1fOW bxDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mr0qfRB0Ik/agsf3L0HG3xZ8g9VBKc2G+9roJzfPeiY=; b=AMbHqag6d+64eCWaTLLYcksG86StEmAX5SGgl09tGuCjtGh0dGthtZTTwgihPzZ6BM 9/P/n6mmpIxOclsr9c9kaGciHPP8ZWUW6h2wklE2NJqdYf1JaAQn0pbd3aHr9yGHeoRd yLuW+6kRO7+TmKdceLxxOM50aqZxaMgTi3O3ZULT5nUAw+k64/kKGVoTR7JSr6rg6/HL ydt0fQSmp5WQJPVFAah521NbLZQAMRejcXAdw/hALtmPs2hoEnFIaXm3xrzM3pqTKADv wf1GvIEbt2mRQBXjLHMhtk9AmG5S9fShqpJeAskJusSfNpIie/k3NwTw4WbfG/cCKrGq JGLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=euraqYIp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by3si803668edb.496.2021.02.25.12.18.37; Thu, 25 Feb 2021 12:18:59 -0800 (PST) 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; dkim=pass header.i=@chromium.org header.s=google header.b=euraqYIp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234141AbhBYUR5 (ORCPT + 99 others); Thu, 25 Feb 2021 15:17:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234102AbhBYURZ (ORCPT ); Thu, 25 Feb 2021 15:17:25 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 360F2C06174A for ; Thu, 25 Feb 2021 12:16:42 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id h4so4528627pgf.13 for ; Thu, 25 Feb 2021 12:16:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mr0qfRB0Ik/agsf3L0HG3xZ8g9VBKc2G+9roJzfPeiY=; b=euraqYIpl64XJWU+m2Fw7Fyq+kDa7eJRiurKUHe2oMGf4JZeSakNYjP5Zg9jvV2Y7i dJiYfNpaLC8ukwM3GczFJRylLgC4twIIVyuMxLgJYzja/cJ+/0R5UQPG7WddojrljFxZ EmncsucyA2xWo3DbkTZiRg0sSr53Zfo49Yiwk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mr0qfRB0Ik/agsf3L0HG3xZ8g9VBKc2G+9roJzfPeiY=; b=c1pnb0KMP1oxHZx0QVza+RwBMjykox3bGW7qWorBMuVmn7W1wfcw0L2XsC61VBJMz8 mEWB2h6fv4tQpJUsjO+ZVMIjhfvZVyEp1Pm4gpDF7NG7tZQ5kuGKBT9EI4cka66tPO1K MQ/Qkf1j/7fJkfiC4jV5C9YoUcwomGyEi+CT240tOhVkCKBsTpFDCPlSe9ZC2rxQykad RNmcZJ3JecQtRtAZ9L3Nyllvp5J/BW9aopMVp7djQy8WLhVSAl5Uwhsi0Pg2gZgtg8AP CV+okfMslUM0LTdKqnF8RtAo2cHFCY4I3Rx5ngI5DTOxz2jxOnkKUB2B0zOlgR3YtjOV iuEA== X-Gm-Message-State: AOAM530PCc2SsucKWiVhYNhtosAEVdvIRC0ElgVZ0HPpBlBvG9K38Cit /cMd12vkvhCz0QbeRcyJ7TmdoQ== X-Received: by 2002:a62:187:0:b029:1da:e323:a96b with SMTP id 129-20020a6201870000b02901dae323a96bmr5028766pfb.28.1614284201699; Thu, 25 Feb 2021 12:16:41 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h3sm6888983pgm.67.2021.02.25.12.16.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Feb 2021 12:16:41 -0800 (PST) Date: Thu, 25 Feb 2021 12:16:40 -0800 From: Kees Cook To: Arnd Bergmann Cc: Catalin Marinas , Will Deacon , Nathan Chancellor , Nick Desaulniers , Arnd Bergmann , Mark Brown , Vincenzo Frascino , Geert Uytterhoeven , Kristina Martsenko , Ionela Voinescu , Mark Rutland , Andrew Scull , David Brazdil , Marc Zyngier , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Message-ID: <202102251216.935EFD7F@keescook> References: <20210225112122.2198845-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210225112122.2198845-1-arnd@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 25, 2021 at 12:20:56PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > When looking at kernel size optimizations, I found that arm64 > does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, > which enables the --gc-sections flag to the linker. > > I see that for a defconfig build with llvm, there are some > notable improvements from enabling this, in particular when > combined with the recently added CONFIG_LTO_CLANG_THIN > and CONFIG_TRIM_UNUSED_KSYMS: > > text data bss dec hex filename > 16570322 10998617 506468 28075407 1ac658f defconfig/vmlinux > 16318793 10569913 506468 27395174 1a20466 trim_defconfig/vmlinux > 16281234 10984848 504291 27770373 1a7be05 gc_defconfig/vmlinux > 16029705 10556880 504355 27090940 19d5ffc gc+trim_defconfig/vmlinux > 17040142 11102945 504196 28647283 1b51f73 thinlto_defconfig/vmlinux > 16788613 10663201 504196 27956010 1aa932a thinlto+trim_defconfig/vmlinux > 16347062 11043384 502499 27892945 1a99cd1 gc+thinlto_defconfig/vmlinux > 15759453 10532792 502395 26794640 198da90 gc+thinlto+trim_defconfig/vmlinux > > I needed a small change to the linker script to get clean randconfig > builds, but I have not done any meaningful boot testing on it to > see if it works. If there are no regressions, I wonder whether this > should be autmatically done for LTO builds, given that it improves > both kernel size and compile speed. > > Link: https://lore.kernel.org/lkml/CAK8P3a05VZ9hSKRzVTxTn+1nf9E+gqebJWTj6N23nfm+ELHt9A@mail.gmail.com/ > Signed-off-by: Arnd Bergmann Reviewed-by: Kees Cook -- Kees Cook