Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3920690img; Mon, 25 Mar 2019 22:31:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdSMqX9+DQATdUYR9DQUN2nsGwAhTfD3mH/Fq2Tpg9s6VRWskKgI/HJQs2k424SY+Xxlsr X-Received: by 2002:a63:7152:: with SMTP id b18mr19041487pgn.186.1553578294192; Mon, 25 Mar 2019 22:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553578294; cv=none; d=google.com; s=arc-20160816; b=MFhdUyLXu1HGKW+IjT+5dOYtaaepQH6UjnJUJHlVwfoDkff324fqeOMnWUWxFpEvKv jaWmBRXt2vVBh8uHnxJNWHrSHPQuMk5AsUhhhL5gR94BS786DkaLrzFL+u0b+itmbNEc ATSi6tyYtQxne3c4Ufh+2+55IUBEmHGqqIpuFuae6Em3idwk9AVYQ0DYYlK0NGaTjRWI Pxoivy2yMQmqeATahXJ6fRh8QXoCYPvTtx2R9SS8EtylSqhNZunOZTTv3o5S7Ipz3ciD 8gyBEGx24XGEBzKoP9852/NsER23Af/o3rqyD1Sp+uODGvDRLGslDUlY6eADp/F0efxv 7U8g== 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:dkim-filter; bh=2V8oJ4SOZOoa9r88dWoDFuRZe2fco3wf/520gsHE4Y0=; b=v6+nyoP9IAu2epvuTHs77RBIvpMVSFAfDbyy/IpaRBxh/TnW1elrLCWkGr9eUs83Ph UraHf21LXDl398j7tMNZ/wgdZ9ALswk3U0+hJIn6b3ndk4hbC+yJJpxZSZ8hAURV9kwU OYmnjWYd/E6/7+TzqsyxRA6aj07oJjsRcaEm9Mb7yt4dP2kQk9Cxyy8488UaG5dD9Mwl A/HXS3bsZeSyJ1RMpCn826EZus5xCqQB8a+ZO3kg4cuRqZVjhg8miU0TK4odRUFwxD8f 2xygjloUqjrW6MFOAH/2kUdgDpc9PpqVcEoiXuGdf3Rp1MGymp2EgyD2HWzGr16B1irJ rNDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=tq5a2XQJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q72si15241902pfa.163.2019.03.25.22.31.19; Mon, 25 Mar 2019 22:31:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=tq5a2XQJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731024AbfCZFai (ORCPT + 99 others); Tue, 26 Mar 2019 01:30:38 -0400 Received: from conssluserg-03.nifty.com ([210.131.2.82]:63828 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbfCZFag (ORCPT ); Tue, 26 Mar 2019 01:30:36 -0400 Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53]) (authenticated) by conssluserg-03.nifty.com with ESMTP id x2Q5UOaA021638; Tue, 26 Mar 2019 14:30:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com x2Q5UOaA021638 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1553578225; bh=2V8oJ4SOZOoa9r88dWoDFuRZe2fco3wf/520gsHE4Y0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tq5a2XQJYg5mJXLOOo7OEqmCWD5Uck6dPci0qDI4HwNwBK1bRhyLyj/VPet0jspyJ LXFrfFGkb+S2qnb1ujQgoJK8s5+D0Al54EyANQ8zFYkYB0QrC6WFvHa42qhhCC6XR9 j5bVL3WtozNQhGyvBxbUHfnGBTqc58cWv7TLTQDH79fcrvDqn6bhm6uQ8lpjaO9SQN ASc9lkXs0meixZWEvoZqG2qLE/1RxpF43nYkYNB/x12yL5hVmakpwM36kw0RkdCqxU AALlKTLF1O3Pa5oc+HVaJL39jqN7e0Ljo8RE7dEYYOOMpCN4+xCW+1aw25/uml1QUs TWKF7mQ9fdN1w== X-Nifty-SrcIP: [209.85.217.53] Received: by mail-vs1-f53.google.com with SMTP id j184so6895317vsd.11; Mon, 25 Mar 2019 22:30:24 -0700 (PDT) X-Gm-Message-State: APjAAAX4c+YL2LYI8FtfPZwToYiHvG4UoJ7govER6Y2cVziKQugCYXA2 +0GX4/5P3umRtMV416G5mFb5AzKHWA3p2s/+mHY= X-Received: by 2002:a67:f105:: with SMTP id n5mr17676008vsk.181.1553578223556; Mon, 25 Mar 2019 22:30:23 -0700 (PDT) MIME-Version: 1.0 References: <20190325160438.8982-1-joe.lawrence@redhat.com> In-Reply-To: <20190325160438.8982-1-joe.lawrence@redhat.com> From: Masahiro Yamada Date: Tue, 26 Mar 2019 14:29:47 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: strip whitespace in cmd_record_mcount findstring To: Joe Lawrence Cc: Linux Kbuild mailing list , linuxppc-dev , Linux Kernel Mailing List , Michal Marek , Nicholas Piggin , Steven Rostedt 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, Mar 26, 2019 at 1:05 AM Joe Lawrence wrote: > > CC_FLAGS_FTRACE may contain trailing whitespace that interferes with > findstring. > > For example, commit 6977f95e63b9 ("powerpc: avoid -mno-sched-epilog on > GCC 4.9 and newer") introduced a change such that on my ppc64le box, > CC_FLAGS_FTRACE="-pg -mprofile-kernel ". (Note the trailing space.) > When cmd_record_mcount is now invoked, findstring fails as the ftrace > flags were found at very end of _c_flags, without the trailing space. > > _c_flags=" ... -pg -mprofile-kernel" > CC_FLAGS_FTRACE="-pg -mprofile-kernel " > ^ > findstring is looking for this extra space > > Remove the redundant whitespaces from CC_FLAGS_FTRACE in > cmd_record_mcount to avoid this problem. > > Fixes: 6977f95e63b9 ("powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer"). > Signed-off-by: Joe Lawrence > --- > > Standard disclaimer: I'm not a kbuild expert, but this works around the > problem I reported where ftrace and livepatch self-tests were failing as > specified object files were not run through the recordmcount.pl script: > > ppc64le: ftrace self-tests and $(CC_FLAGS_FTRACE) broken? > https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-March/187298.html > > scripts/Makefile.build | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index 2554a15ecf2b..74d402b5aa3c 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -199,10 +199,10 @@ sub_cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ > "$(if $(part-of-module),1,0)" "$(@)"; > recordmcount_source := $(srctree)/scripts/recordmcount.pl > endif # BUILD_C_RECORDMCOUNT > -cmd_record_mcount = \ > - if [ "$(findstring $(CC_FLAGS_FTRACE),$(_c_flags))" = \ > - "$(CC_FLAGS_FTRACE)" ]; then \ > - $(sub_cmd_record_mcount) \ > +cmd_record_mcount = \ > + if [ "$(findstring $(strip $(CC_FLAGS_FTRACE)),$(_c_flags))" = \ > + "$(strip $(CC_FLAGS_FTRACE))" ]; then \ > + $(sub_cmd_record_mcount) \ > fi > endif # CC_USING_RECORD_MCOUNT > endif # CONFIG_FTRACE_MCOUNT_RECORD > -- > 2.20.1 > I do not see a point in using the shell command here in the first place. Instead of adding crappy workarounds, I guess the following simple code should work: index 2554a15..5f13021 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -199,11 +199,8 @@ sub_cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ "$(if $(part-of-module),1,0)" "$(@)"; recordmcount_source := $(srctree)/scripts/recordmcount.pl endif # BUILD_C_RECORDMCOUNT -cmd_record_mcount = \ - if [ "$(findstring $(CC_FLAGS_FTRACE),$(_c_flags))" = \ - "$(CC_FLAGS_FTRACE)" ]; then \ - $(sub_cmd_record_mcount) \ - fi +cmd_record_mcount = $(if $(findstring $(CC_FLAGS_FTRACE),$(_c_flags)),\ + $(sub_cmd_record_mcount)) endif # CC_USING_RECORD_MCOUNT endif # CONFIG_FTRACE_MCOUNT_RECORD -- Best Regards Masahiro Yamada