Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3378529img; Mon, 25 Mar 2019 09:06:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqwugXcARsH1WfbCl/9GfmOULrmTyUTxWCrPfEDJ1nUuWQiLw0TdV4GS2qzOmHugXwwONa/G X-Received: by 2002:a62:29c5:: with SMTP id p188mr24079431pfp.203.1553529966742; Mon, 25 Mar 2019 09:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553529966; cv=none; d=google.com; s=arc-20160816; b=tsdQQ3c7bk2fqTqYJYNokoG3GCCdt0e+r3hR765a1NGVkmQd8TTWsHauz6VIrAnkpu 0ZFLsDQtJY0XmQvFFvSL6g4u0ylfa0IFa0LvD3IF9Q3JrXXMoS5NaJAckNarQ9ja/YN5 UGbJV0d3Xx6kKuPkTc1auI1ufTLgQ/lkH9Bx46TCBgUm+OGPuH2CzU3AW7SOBVL3rwHU yi6NC4GdbIRLj2hT/0bUTxrNBFsNXJswPngOttuvwcro2HUGZ1nSSQy/6Xe56kFz4G37 Du7MmUFlsK/EvvF0CZclfQYmBTz+p295qA12WyXfrrnyR+krIhOMO7K+pN8GQsjwBqKS os0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=45lb8Y5XsAj5RrfZqRNmPymU82P1tRwoopzwqIa8c2k=; b=U4WCyF0d3mU12nuz48qkcMWCT7ktM4MNtdtSNAdBz4GkH1j7OUcdFwww6Z21x61cFI 6K6W1qm3Plb01kago7dDLUQiOAtMTamwyOfZ2rubBKWuwOY+w0c+SK7/PuA/SuucAfsQ yBtzX61GRDNCdfl9mMnaFesZ4tpx7UUSuIFc/3OvIgPN3yMRlia8AvJsgGW2F1tPNGXR //ZNFLSDpmFYSOc/RnXPWoLpeVcPtnJQKzFeMMOHWAuW+VExklL4NBQcz6F3cowmSLQf zcsaT8maLxnw/gNFnmB8mDRrCQfTKcgaCwBKBtI9p/ktDR/WsE7RhsdV4x1aiDuvwx9e YEWw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o24si3043448pgh.260.2019.03.25.09.05.52; Mon, 25 Mar 2019 09:06:06 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729779AbfCYQE6 (ORCPT + 99 others); Mon, 25 Mar 2019 12:04:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59630 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728991AbfCYQE4 (ORCPT ); Mon, 25 Mar 2019 12:04:56 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 656B63086211; Mon, 25 Mar 2019 16:04:56 +0000 (UTC) Received: from jlaw-desktop.bos.redhat.com (dhcp-17-208.bos.redhat.com [10.18.17.208]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38255909FF; Mon, 25 Mar 2019 16:04:53 +0000 (UTC) From: Joe Lawrence To: linux-kbuild@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Joe Lawrence , Masahiro Yamada , Michal Marek , Nicholas Piggin , Steven Rostedt Subject: [PATCH] kbuild: strip whitespace in cmd_record_mcount findstring Date: Mon, 25 Mar 2019 12:04:38 -0400 Message-Id: <20190325160438.8982-1-joe.lawrence@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 25 Mar 2019 16:04:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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