From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 925E6C433DF for ; Tue, 7 Jul 2020 19:58:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6FE0020771 for ; Tue, 7 Jul 2020 19:58:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="POB0tDdC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728807AbgGGT6O (ORCPT ); Tue, 7 Jul 2020 15:58:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728804AbgGGT6N (ORCPT ); Tue, 7 Jul 2020 15:58:13 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32849C08C5EE for ; Tue, 7 Jul 2020 12:58:13 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id x11so17163078plo.7 for ; Tue, 07 Jul 2020 12:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VzRu+6RTYvmFttwhsiQLXCF6YnU1lg38nqV7v8N7whw=; b=POB0tDdCbNVqmVQZ6yua+ndmhJsgXFLarIJRrzZHpuDGP0B1FODyoxi9lUTM/pG0IL mE1dMIr/gsK64CjizChpcXywJYXY4Vfi25COfLptk3V+mFNHqoasjVtfubvV2ebCtl7a czRuA5AP473VLGgnEz34EgdAlV0QOt3H67RniAnOVC2+In0mdoC9rSRvmlMzUXfZVzt4 xGEFUHBxADeMLVRzRAoW7/H0iSwTAcsqnlAtpK24wb/U0fEHrp7KMPF2hLocEXQ4+asp 047TKx7zculMEGUVbpwgiExvH3ficDy6d/Wj01wsX8chenP63N6BpBBILOJ6KcW2NDnx OPSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VzRu+6RTYvmFttwhsiQLXCF6YnU1lg38nqV7v8N7whw=; b=nvYgCyFkhvJlBsVRE7mzNV8DcjP+L6RDkhPN+OMVR2h8BkPKIsgrPYNXPIraMQ9WE3 4hJ5b9QoXbK/F35qankOw6dtaIhW7o8GRE9e6ALl8vjfCc3lfffz2KmwEC4mrzqPYR8F 3sozq8W9FHlj7Dr8CpZCdqnMUFjRN7PqW33huRTQ3Lsy9+rxvZOzFHDHWUGh5BpuEJbJ Fno9Jzjd9XwToPkJ+TceyBQs409+4RXm1ATvvOAlY7eOictpUUpF/NyMsUUx6TD2Q/zF g/k0kLxWzjwRLViNCfNTAXXxcwojg4EVoZnJw0HZbYQRvPgBcUGTmUpynxrHA8lwqSJY sG2Q== X-Gm-Message-State: AOAM5312Tmq3teeIwWTzRXLEretl7fEBuSU7iJuRctY2V8FFnjtMGbM5 PnhHwRjW1hUIXtJfxrl8YAvceDEeeANgHJbd3+3vJQ== X-Google-Smtp-Source: ABdhPJwAgKOW6WJkomMyOukfnt4wP2/V35sf6mYJAhQLNyaosM4LY2uIUq7rKvvPZg70NVApdINfIkTmb6+bTRJLXD0= X-Received: by 2002:a17:90b:1296:: with SMTP id fw22mr6086502pjb.20.1594151892296; Tue, 07 Jul 2020 12:58:12 -0700 (PDT) MIME-Version: 1.0 References: <20200707092117.963394-1-masahiroy@kernel.org> In-Reply-To: <20200707092117.963394-1-masahiroy@kernel.org> From: Brendan Higgins Date: Tue, 7 Jul 2020 12:58:01 -0700 Message-ID: Subject: Re: [PATCH v2 1/2] kbuild: introduce ccflags-remove-y and asflags-remove-y To: Masahiro Yamada Cc: linux-kbuild , Ingo Molnar , Steven Rostedt , Anders Roxell , Sami Tolvanen , Michael Ellerman , Benjamin Herrenschmidt , "David S. Miller" , Haren Myneni , Herbert Xu , Ingo Molnar , Jiri Kosina , Joe Lawrence , Jonathan Corbet , Josh Poimboeuf , Michal Marek , Miroslav Benes , Paul Mackerras , Petr Mladek , Rich Felker , Russell King , Tal Gilboa , Yoshinori Sato , KUnit Development , Linux ARM , linux-crypto@vger.kernel.org, "open list:DOCUMENTATION" , Linux Kernel Mailing List , "open list:KERNEL SELFTEST FRAMEWORK" , linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, live-patching@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: live-patching-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: live-patching@vger.kernel.org On Tue, Jul 7, 2020 at 2:22 AM Masahiro Yamada wrote: > > CFLAGS_REMOVE_.o filters out flags when compiling a particular > object, but there is no convenient way to do that for every object in > a directory. > > Add ccflags-remove-y and asflags-remove-y to make it easily. > > Use ccflags-remove-y to clean up some Makefiles. > > The add/remove order works as follows: > > [1] KBUILD_CFLAGS specifies compiler flags used globally > > [2] ccflags-y adds compiler flags for all objects in the > current Makefile > > [3] ccflags-remove-y removes compiler flags for all objects in the > current Makefile (New feature) > > [4] CFLAGS_ adds compiler flags per file. > > [5] CFLAGS_REMOVE_ removes compiler flags per file. > > Having [3] before [4] allows us to remove flags from most (but not all) > objects in the current Makefile. > > For example, kernel/trace/Makefile removes $(CC_FLAGS_FTRACE) > from all objects in the directory, then adds it back to > trace_selftest_dynamic.o and CFLAGS_trace_kprobe_selftest.o > > Please note ccflags-remove-y has no effect to the sub-directories. > In contrast, the previous notation got rid of compiler flags also from > all the sub-directories. > > arch/arm/boot/compressed/ > arch/powerpc/xmon/ > arch/sh/ > kernel/trace/ > > ... have no sub-directories. > > lib/ > > ... has several sub-directories. > > To keep the behavior, I added ccflags-remove-y to all Makefiles > in subdirectories of lib/, except: > > lib/vdso/Makefile - Kbuild does not descend into this Makefile > lib/raid/test/Makefile - This is not used for the kernel build > > I think commit 2464a609ded0 ("ftrace: do not trace library functions") > excluded too much. In later commit, I will try to remove ccflags-remove-y > from sub-directory Makefiles. > > Suggested-by: Sami Tolvanen > Signed-off-by: Masahiro Yamada > Acked-by: Steven Rostedt (VMware) > Acked-by: Michael Ellerman (powerpc) Acked-by: Brendan Higgins (KUnit)