Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3983159pxb; Tue, 17 Nov 2020 08:26:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+J9vZG5SPjgIBrvF4hK/W02tqDKz5U20qArLSqCcNajtYXbJmreeAynqNf0JLvcslA3Hl X-Received: by 2002:aa7:d64b:: with SMTP id v11mr21321250edr.253.1605630372098; Tue, 17 Nov 2020 08:26:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605630372; cv=none; d=google.com; s=arc-20160816; b=nkxk0OsA2SrDL8OFeEk1hs8V5fSJr+KNxsUa3s2M5pZGA+1vH6EO2QhG+lEW9ghcIB my+pLqS7emDSaPcnyAxVzfUpo9HOW06VFgsYAD8uHbJeL4iIL+jxFKFRcfGUtN1XtXR7 ZDyLbvqW3RaetsypamVQZv+etTnHWY0CfbWr7E+QnLntmPfpSa6brwU9JL6vfWLoipxW ynhiVglj0i5aTyTG4GH//nkuNW4vmcB7YgZdIMFP6lbXTEThKjXJa8gUFFrrm2y9vp65 nkQZW1IS7E3GD0PH0ZdMU1xtASVfUkpLhXjsTKZqqX+goPYurdgd4uGfmU228DOe17o4 dhQA== 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=9JS/uYKk8GrJCTbc2FAe05O+XJ9e/pB4+Xwp7tXwPZ0=; b=UJyQqQ658fBTA/tzljLiy21REe1dAbprZLcjIO9XJLyTQPrC+BlP7r3gz2BBE+wmSv 8YBnlN7Fc1xtMhaFODIBJ6Iz9TpDXHLvBfrhPUuIL8zQeIVlfkrsUzSlF2jcDwIB0CfA slfr5imPEpU2kb340B9uz3LiDnuz/g8oPg1E8WLJ4qB5eYmNlAj+SZw2Z9xcG8ge2raD 6UPI2YBYiKGfyOydB+AuqC1SKbsb9Gla5HBRcgAzyYTKsBWAyaFC2v37OB3kJZJA7djM lv2LIZH49i5JV6dxUlV0YLuNdNF+hZPasc+3v9H0UG4fc7ko1Yk0RpZEdaR7qFBodH4p AO+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aJlDOBsA; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 61si14725642edc.400.2020.11.17.08.25.47; Tue, 17 Nov 2020 08:26:12 -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=@gmail.com header.s=20161025 header.b=aJlDOBsA; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727764AbgKQQW2 (ORCPT + 99 others); Tue, 17 Nov 2020 11:22:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727235AbgKQQW1 (ORCPT ); Tue, 17 Nov 2020 11:22:27 -0500 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FC5BC0613CF; Tue, 17 Nov 2020 08:22:27 -0800 (PST) Received: by mail-qk1-x743.google.com with SMTP id v143so20944512qkb.2; Tue, 17 Nov 2020 08:22:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=9JS/uYKk8GrJCTbc2FAe05O+XJ9e/pB4+Xwp7tXwPZ0=; b=aJlDOBsATEWSe1rlycoHMeV4ei94yuVwrrm65Xysp4oVHYz7irZb27aTwZ7IgeMrMO rwVNaVpE25sjKuSTnOO7NmkzBWOBSTx4fb3R/DCWK4SogrXa2AC7enZkjLsyuNjXxuvM NTnekDgslWYIalrCbTxJ86SdaNtQP3cHwjrypdeVUFonoFUCuScqV6kG/ZkGwOFtl6yH GGnqDGXXV/Rp0vgelpRy+c9ngWmBiSSV1q/ABKAKx6pMiIrVNRaIq9LBAGHm9r1XHYPX JJd8Mz5c3TX5hRrGoRqUPlThTtb3gM5hidlGyqicc9LqyBTLzcNk5GjMNiGQAYvcDs09 OmmA== 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=9JS/uYKk8GrJCTbc2FAe05O+XJ9e/pB4+Xwp7tXwPZ0=; b=jIWr4prY5Tkb16Q2zqWthSJ1cFELIbXYuBlUBYbfALNAxmVEvM7X04EGUW1ltfLR71 NV6SzL+TFLhBAvy/OTs9fA19gkrM5d7bvf/VdMnj7i9dilIHscOoGhI1Z1MeAOGFjGQ3 Og54KMZFxkGriMBdgcdk4R3B+ZhjDApgqvrG9PVnkXglMDInXH2IbThSGT+1NCDn4Y7l BopOjqFZ+hvyaaGSCL4gNDX33wPa8TvJxTK7WLHCDnGYW7ICdxiEIydbxk8USia3hkIk 5RT1D2r1jQ9kKTEIpnJEYdY97stxMuew5Au6k5/9qcyCyZcLZH5s0t3CaFtJYtwebaiD W0iQ== X-Gm-Message-State: AOAM533eyOx2KFvZTNATDVjb4ryKQ6CHz3p058VmFiUk3ZPZHFbP/dH/ ztksbbhm86edvlPvKV14DzOkKfC8ZMdCyQ== X-Received: by 2002:a37:8542:: with SMTP id h63mr366329qkd.102.1605630146479; Tue, 17 Nov 2020 08:22:26 -0800 (PST) Received: from ubuntu-m3-large-x86 ([2604:1380:45f1:1d00::1]) by smtp.gmail.com with ESMTPSA id v16sm15074576qka.72.2020.11.17.08.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 08:22:25 -0800 (PST) Date: Tue, 17 Nov 2020 09:22:23 -0700 From: Nathan Chancellor To: Michael Ellerman Cc: Masahiro Yamada , Michal Marek , Kees Cook , Russell King , Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Nick Desaulniers , Arvind Sankar , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH 1/2] kbuild: Hoist '--orphan-handling' into Kconfig Message-ID: <20201117162223.GA1428250@ubuntu-m3-large-x86> References: <20201113195553.1487659-1-natechancellor@gmail.com> <87tuto2qke.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87tuto2qke.fsf@mpe.ellerman.id.au> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 17, 2020 at 10:03:29PM +1100, Michael Ellerman wrote: > Nathan Chancellor writes: > > Currently, '--orphan-handling=warn' is spread out across four different > > architectures in their respective Makefiles, which makes it a little > > unruly to deal with in case it needs to be disabled for a specific > > linker version (in this case, ld.lld 10.0.1). > > > > To make it easier to control this, hoist this warning into Kconfig and > > the main Makefile so that disabling it is simpler, as the warning will > > only be enabled in a couple places (main Makefile and a couple of > > compressed boot folders that blow away LDFLAGS_vmlinx) and making it > > conditional is easier due to Kconfig syntax. One small additional > > benefit of this is saving a call to ld-option on incremental builds > > because we will have already evaluated it for CONFIG_LD_ORPHAN_WARN. > > > > To keep the list of supported architectures the same, introduce > > CONFIG_ARCH_WANT_LD_ORPHAN_WARN, which an architecture can select to > > gain this automatically after all of the sections are specified and size > > asserted. A special thanks to Kees Cook for the help text on this > > config. > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/1187 > > Signed-off-by: Nathan Chancellor > > --- > > Makefile | 6 ++++++ > > arch/Kconfig | 9 +++++++++ > > arch/arm/Kconfig | 1 + > > arch/arm/Makefile | 4 ---- > > arch/arm/boot/compressed/Makefile | 4 +++- > > arch/arm64/Kconfig | 1 + > > arch/arm64/Makefile | 4 ---- > > arch/powerpc/Kconfig | 1 + > > arch/powerpc/Makefile | 1 - > > Acked-by: Michael Ellerman (powerpc) > > > > arch/x86/Kconfig | 1 + > > arch/x86/Makefile | 3 --- > > arch/x86/boot/compressed/Makefile | 4 +++- > > init/Kconfig | 3 +++ > > 13 files changed, 28 insertions(+), 14 deletions(-) > > > > diff --git a/Makefile b/Makefile > > index 008aba5f1a20..c443afd61886 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -984,6 +984,12 @@ ifeq ($(CONFIG_RELR),y) > > LDFLAGS_vmlinux += --pack-dyn-relocs=relr > > endif > > > > +# We never want expected sections to be placed heuristically by the > > +# linker. All sections should be explicitly named in the linker script. > > +ifeq ($(CONFIG_LD_ORPHAN_WARN),y) > > +LDFLAGS_vmlinux += --orphan-handling=warn > > +endif > > This is a nit, but you can use ifdef with bool CONFIG symbols in > Makefiles, which reads a bit nicer, eg: > > ifdef CONFIG_LD_ORPHAN_WARN > LDFLAGS_vmlinux += --orphan-handling=warn > endif That is indeed cleaner, I did not realize I could do that as long as the config was a boolean. I will use that in v2, which I will send along within the next few days to give Masahiro some time to comment. Cheers, Nathan