Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4781162imm; Mon, 25 Jun 2018 23:58:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcfTBLtwUXzgMUGlk7HS2Q2JN3kQwE2ZEqdyjx9XC1UJ1JvzG9deiwrR+T0gPPYq0ssiSO9 X-Received: by 2002:a62:5046:: with SMTP id e67-v6mr283750pfb.235.1529996328751; Mon, 25 Jun 2018 23:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529996328; cv=none; d=google.com; s=arc-20160816; b=efnrvzfuFMnEqKPgCrL5thMRLvu6VjTEtj06np1VDklXA67nM1Ush7lGgCbI4pWutz cMntQhWUFwSkOXEppZWkCqXsPrftw9gq3YK8itEkpRAZPgeyFAchrsOxcJcY7xFibF0a BtTYHuo0CrvP9g1nrqmPBOGH1sNBITOBCh3MpTlLu1qaZA7azzoSt3rwZZ4cEItaYzHv Ez7T1DazW2l0dDO8/CeNIKWuUKKP/jewkzOZd41bQvpUr9oDAgl7N+HDRGLCShVUnpUX fcAyo/z8j/IqXiT5n9+OxtzyfmT1ZSfBz0A7Rg8Nw/4Zq3KaXuTl5FFuyrzOFlIAjB95 7AxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=U2mpd4PifsyR5eUmky8TG1xWVgGmYDN/Wb2qL25ydSE=; b=1LAn016OWqzB1yy4GvwKM1ucyPfKo/UourBvLLMIIByBVm6ISgPIAdkyKdJ26O5y+w HiKEW5lq7oKsUmhnX2SdYnY7OBpmeLYISQieRrqvgZEq3FfUkfFOXYb79XnMN6lwZRll 7BTRoZtWuochID0/R56b2saGZdhcD8qGzOKsblTfmVLqfo8vMGBxx0aLmDVs/Xt8yCrl l+1b5AbWbEKV6W2EDhK6aDBVRe2UZbIUod+xYA40UEQe7Gv++CgG7jT8g6KSbS7MFuMp QXuiYwUWNFSqErwobuEFdoL+NaqjB84gyfhtDVUzCTIyp34rREwY1kzsKo9EBPisilZN 1wIg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5-v6si993295plh.340.2018.06.25.23.58.34; Mon, 25 Jun 2018 23:58:48 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751372AbeFZG5y (ORCPT + 99 others); Tue, 26 Jun 2018 02:57:54 -0400 Received: from terminus.zytor.com ([198.137.202.136]:37317 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751885AbeFZG5x (ORCPT ); Tue, 26 Jun 2018 02:57:53 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w5Q6vLYY1591797 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 25 Jun 2018 23:57:22 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w5Q6vLZa1591794; Mon, 25 Jun 2018 23:57:21 -0700 Date: Mon, 25 Jun 2018 23:57:21 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Yonghong Song Message-ID: Cc: tglx@linutronix.de, kafai@fb.com, ast@fb.com, wangnan0@huawei.com, yhs@fb.com, mingo@kernel.org, linux-kernel@vger.kernel.org, jolsa@kernel.org, hpa@zytor.com, daniel@iogearbox.net, acme@redhat.com Reply-To: wangnan0@huawei.com, yhs@fb.com, ast@fb.com, tglx@linutronix.de, kafai@fb.com, linux-kernel@vger.kernel.org, jolsa@kernel.org, mingo@kernel.org, hpa@zytor.com, daniel@iogearbox.net, acme@redhat.com In-Reply-To: <20180616174739.1076733-1-yhs@fb.com> References: <20180616174739.1076733-1-yhs@fb.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf tools: Fix a clang 7.0 compilation error Git-Commit-ID: c6555c14572aeadf4fe2819abd971c4e7608b926 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: c6555c14572aeadf4fe2819abd971c4e7608b926 Gitweb: https://git.kernel.org/tip/c6555c14572aeadf4fe2819abd971c4e7608b926 Author: Yonghong Song AuthorDate: Sat, 16 Jun 2018 10:47:39 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 25 Jun 2018 11:59:37 -0300 perf tools: Fix a clang 7.0 compilation error Arnaldo reported the perf build failure with latest llvm/clang compiler (7.0). $ make LIBCLANGLLVM=1 -C tools/perf/ CC /tmp/tmp.t53Qo38zci/tests/kmod-path.o util/c++/clang.cpp: In function ‘std::unique_ptr > perf::getBPFObjectFromModule(llvm::Module*)’: util/c++/clang.cpp:150:43: error: no matching function for call to ‘llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManager&, llvm::raw_svector_ostream&, llvm::TargetMachine::CodeGenFileType)’ TargetMachine::CGFT_ObjectFile)) { ^ In file included from util/c++/clang.cpp:25:0: /usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate: virtual bool llvm::TargetMachine::addPassesToEmitFile( llvm::legacy::PassManagerBase&, llvm::raw_pwrite_stream&, llvm::raw_pwrite_stream*, llvm::TargetMachine::CodeGenFileType, bool, llvm::MachineModuleInfo*) virtual bool addPassesToEmitFile(PassManagerBase &, raw_pwrite_stream &, ^~~~~~~~~~~~~~~~~~~ /usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate expects 6 arguments, 3 provided mv: cannot stat '/tmp/tmp.t53Qo38zci/util/c++/.clang.o.tmp': No such file or directory make[7]: *** [/home/acme/git/perf/tools/build/Makefile.build:101: /tmp/tmp.t53Qo38zci/util/c++/clang.o] Error 1 make[6]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: c++] Error 2 make[5]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: util] Error 2 make[5]: *** Waiting for unfinished jobs.... CC /tmp/tmp.t53Qo38zci/tests/thread-map.o The function addPassesToEmitFile signature changed in llvm 7.0 and such a change caused the failure. This patch fixed the issue with using proper function signatures under different compiler versions. Reported-by: Arnaldo Carvalho de Melo Signed-off-by: Yonghong Song Tested-by: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Jiri Olsa Cc: Martin KaFai Lau Cc: Wang Nan Link: http://lkml.kernel.org/r/20180616174739.1076733-1-yhs@fb.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/c++/clang.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp index bf31ceab33bd..89512504551b 100644 --- a/tools/perf/util/c++/clang.cpp +++ b/tools/perf/util/c++/clang.cpp @@ -146,8 +146,15 @@ getBPFObjectFromModule(llvm::Module *Module) raw_svector_ostream ostream(*Buffer); legacy::PassManager PM; - if (TargetMachine->addPassesToEmitFile(PM, ostream, - TargetMachine::CGFT_ObjectFile)) { + bool NotAdded; +#if CLANG_VERSION_MAJOR < 7 + NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, + TargetMachine::CGFT_ObjectFile); +#else + NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, nullptr, + TargetMachine::CGFT_ObjectFile); +#endif + if (NotAdded) { llvm::errs() << "TargetMachine can't emit a file of this type\n"; return std::unique_ptr>(nullptr);; }