Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1327532ybt; Tue, 7 Jul 2020 13:00:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz994gUF7Vd0XQFKj3nhy2UtyWMsbl0a8BZ8kdj1gYVXgZfABcztDYKojXCvLp+pkXINte1 X-Received: by 2002:a17:906:5283:: with SMTP id c3mr46235256ejm.22.1594152006436; Tue, 07 Jul 2020 13:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594152006; cv=none; d=google.com; s=arc-20160816; b=jsMQhh1bqRKorRUggq6535ABegd9LHB4CkZHVlwT7XJMeNBlKbj8oSFNlflPKtAONJ /6wXllGVxPcsiTK/zv6OTXI25HuotlzwAomQ5SEjG9TIjA1wkZ/iflntYjniRgMROyZw o7aWEICLLRJLCPyzRgdEvmfXcUnw2FIGUZZuTQtuygbx4DDQWe515c8aA5sQJTuVJACf esps3XIFf25QD6BG2oBX9tYLMlhMV5y0U8c4kRODxmsTX7frMhhrIE/2W9YYckSKkt5N 9OwfwcSzLPuPgcB900y3b6dFwUByd5uz3WUWkfbniOJ95fK3TIxemIoDGa40TeBeWYvS Sj9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=VzRu+6RTYvmFttwhsiQLXCF6YnU1lg38nqV7v8N7whw=; b=b2tzm6h81eb78ZTDDH33iaHT48ktejhE49WTfbEyNfAZ4np/7gO1t7HWcJjZyPSWCk bTYt+KuNYmKfUuIY94/ggoUs31tZOWV7TtMy9NofWoRTz0EbTn4y4MCzFTeiMemfkroE E+/ijzd/YPMelE04OhIdgbY5jrbrH8CWFG2a7OUBdwf7j6zkLnsNtmQUJAOXajQ2uUO/ l/2bWVf4J8Tif8ZnhJwKrg8DfBKRQv7veIV7y7n2jXL9s2AAv0CuD3kfMmssbsb+1od0 4xyi3CfcUs7W5BgARGej7oRqpRwRpgdw5Nqo1ZYmxB/v35mQ3Hg5TmSIzqZa9CPK+Pv8 riiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=POB0tDdC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l1si16198361edv.381.2020.07.07.12.59.43; Tue, 07 Jul 2020 13:00:06 -0700 (PDT) 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=@google.com header.s=20161025 header.b=POB0tDdC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728489AbgGGT6O (ORCPT + 99 others); Tue, 7 Jul 2020 15:58:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728721AbgGGT6N (ORCPT ); Tue, 7 Jul 2020 15:58:13 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37102C08C5EF for ; Tue, 7 Jul 2020 12:58:13 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id md7so138613pjb.1 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=hO9BXlettY8suZsWeRP5RpMGgd5xvuSodPCgr9vedRK0h0/wIUqQEsXjzeKIi2tHVG h6qX6ZGVQ5fLP7gV72r/j6zoMiBdCfTx5jEFs/feCkZKhIV9dElQHQO53IJ6I4YyEjNF lY2DoZm7s7+KmNE+92K7nidYQ85MLlUu4IAyuTk2iKzTvu4B+OHE6WOl5IFlICxIH8eY 0ARsoBj+4pXDpSOXw8m4PKHiy9McLAZbdtqX08R4lBjG7vyx+9UnWK51r3V7d7byn1AN Ufmqa7KfV/ZdadwoganWZB+D9CkSBGNPKKVJ50C9ifsgcckKGIKtIImH5gX8rfdcM4zQ sdKw== X-Gm-Message-State: AOAM531TpXEiAZ5FhIpUTpLtjMWvrAKHK+Dy6bVMF0YeOBIUjjHdDTL8 mP81WQhJr8GH0fvLr4rG5kYTRfYoATwjWuFBthEciA== 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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)