Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3996780imm; Mon, 18 Jun 2018 07:33:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ3XZPZRaWWc3b8TDpPw5MeRG1yTsUW+LBE3L9b+5cqRwe5i7FyAoKIAC2cnu0QFfcqSS0U X-Received: by 2002:a62:4ad3:: with SMTP id c80-v6mr13856346pfj.23.1529332383154; Mon, 18 Jun 2018 07:33:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529332383; cv=none; d=google.com; s=arc-20160816; b=tlfKLJwHuXKZhUPj9+nY+0J576eO4aGhS3299M61zMf82/jUZua0iA78dXg4XLyyGk qvcwMj5jHgOLenVZwOrlJxu1GwjCQdDTiz0Zkcq9wTwM7AaXgOs6xFcvW3pYbX1zaC75 8WuYabg4zHVnrnyDLhJJTl+ld050w/nB5HubSDfits1N2UYSkWMJe+WoWDTQT7y9+xYM UPUIZyOPpNHW10j7+C7ZMZfEVXALsRS/0zOSK/PjpAVK44wPYaWV7NCDy+MgrajPPDyE 60JK1ZDYX/6JvL65t7M7qA4yY09jGP6+jWlEQuAJFNj8a+gCx2sNkLDQwcH1pzU8rvNo GVVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=8/2uUv1ZTEs0hyz5G/BRdEsVe6H8BxUXk4211fwAxzc=; b=OXfZeiXYMS4FjuCglAESOe62Lblx2WaVnWWWQmTETAfrzZWDU+iXXqNksB81IQ6y88 0qG4UFfpcsgB4ZqLS7S1Xf/Pl9QUdpkkbbDKsipc0+NA13rLb9RNzpYZTZFY/uzR5icV yv59m7bjjE9YsMbFLu3wkdEsUUl3RT2Zv7PLKpbeA5bRRBlSWoOAi+9ToqSLFrXJlPPy GtG9H/6YXH4VSD/gMJInokDrpAaA6M0Z55U1doHB/LozloAzoPKJZUvf2LTwkUQvbyiw cxt5NPuTu6axeMUlDd63/N267+JnWgKgjnTJt0jGqNUtaUpQMcemVzBRnSJjtfbySCoj nJpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="o/8555gY"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be3-v6si14753066plb.67.2018.06.18.07.32.49; Mon, 18 Jun 2018 07:33:03 -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=@kernel.org header.s=default header.b="o/8555gY"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934769AbeFROb4 (ORCPT + 99 others); Mon, 18 Jun 2018 10:31:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:44956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934470AbeFRObz (ORCPT ); Mon, 18 Jun 2018 10:31:55 -0400 Received: from jouet.infradead.org (unknown [187.65.76.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5EC0720852; Mon, 18 Jun 2018 14:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1529332314; bh=UyFM/mdQBXQTqQEBDRVobpnTK15uQ0JBtdOMZ2HTFxM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o/8555gYgYuUIW34nTy1ZuAy+gM/QQtZJLXEZJXwpe0dHCin3fx7Uwdy38b59IChz oINwD4MZfYOSKlmRx9dOyuHu6xaHowX2YZ75bOPTZYi0MzrJLUY2fzXopGeAVfqFu3 3x5Aa28Tp5VPq3Gyyzf2bbXx8qIPnZqrbJPJVUtc= Received: by jouet.infradead.org (Postfix, from userid 1000) id 676451457B8; Mon, 18 Jun 2018 11:31:39 -0300 (-03) Date: Mon, 18 Jun 2018 11:31:39 -0300 From: Arnaldo Carvalho de Melo To: Yonghong Song Cc: Wang Nan , Jiri Olsa , Linux Kernel Mailing List , Alexei Starovoitov , Martin KaFai Lau , Daniel Borkmann Subject: Re: perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6 Message-ID: <20180618143139.GA20477@kernel.org> References: <20180616122608.GM30043@kernel.org> <91a76633-54e4-984d-cb68-ca0445146b15@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <91a76633-54e4-984d-cb68-ca0445146b15@fb.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sat, Jun 16, 2018 at 10:20:21AM -0700, Yonghong Song escreveu: > > > On 6/16/18 5:26 AM, Arnaldo Carvalho de Melo wrote: > > Hi Wang, Yogong, > > > > While reviewing the BTF patches for pahole, I updated llvm/clang > > to HEAD and then building perf with clang embedded I noticed this, will > > investigate, posting here to document the regression, maybe this is > > something you came across in other scenario: > > > > $ 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 > > There is an interface change in llvm 7.0 (trunk) for function > llvm::TargetMachine::addPassesToEmitFile. The following patch > should fix the problem. Please submit it, I just tested and the the build finishes Ok. - Arnaldo > -bash-4.2$ git diff > diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp > index bf31cea..11dee58 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);; > } > -bash-4.2$ > > Will submit a formal patch soon. > > > > > - Arnaldo > >