Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp910647imm; Wed, 15 Aug 2018 08:11:21 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwqiv3T6Hsa0tyQQkn4Hl4+AYaEqLCzkFFntKCm/3haNZv35iR9kE25n+V9cN7m+BJqzlye X-Received: by 2002:a17:902:3225:: with SMTP id y34-v6mr9665618plb.206.1534345881375; Wed, 15 Aug 2018 08:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534345881; cv=none; d=google.com; s=arc-20160816; b=TS4TO9502P/pcLRrY0nOBo+eXpwKMul3dQZsnazSPyVip94J7WSUhxPrVxdXSc2J65 91zIi8wTVSu5Nj9wTt3Smr5U4UcsLlztQNYLNXRS+P4d345+9d/9ljZLEqVzh85zDNVA U0YNutVVAnknPAKB8koV5Cvr05e3QEoEmUZyDwpd9wGBWn5h63XIUSeIXx02do9+pz2H bIlEuKA68BCCXW5yFIO5ZMkSCmwY+JKldezy+D11QiJ73UhlcBB9NTSQZ4MRSwXP2Be+ mjabTNpqi00efQsH0twA2WzpI059OPhGA1uERavJeaX5wTT5nCOYgZKlW/uJG0A1ormz jlVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=2F36DqkSCe4MSV+jdAcfbIagLNZPauzQwp8B9wfd3VE=; b=WO+MOSsKVeI5A6dFKPkIFBJMmN3rDHcNeelqPRBXq/7/+RBlQyTDY+D5ko4tu4sRG1 FY21D+B8k+K+yXEW1tf4u5VJiQ78zOquEWKto7xbrAD848AdnuxQIJWd7UwfVdRnO4SL 4LJBS1sVjGnwwlQAE4mra92ph0PeIpOgsPUb8zNI8u0IaCLZ/6rJmvtKq1c55r8twE60 BO8Adp4Tin+TMCeBgTLQyFPoIJwH03n4owDeeJNDRNXKq8MDynnOflY5bADycFlQs+Qq sgDCXLz49DOPOBSGZ5tbPVZTIli2Tyush1Lmq3tAqrHjSbciDBJcHw8m/VJaIAU5yuo7 mJFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fKavpyHl; 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 h187-v6si27229542pfb.62.2018.08.15.08.11.06; Wed, 15 Aug 2018 08:11:21 -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=fKavpyHl; 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 S1730729AbeHOSBM (ORCPT + 99 others); Wed, 15 Aug 2018 14:01:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:51086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729528AbeHOSBL (ORCPT ); Wed, 15 Aug 2018 14:01:11 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (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 7E4EE208E0; Wed, 15 Aug 2018 15:08:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1534345719; bh=9BU7cdRnpuEyfQsc+dN5zvaQQzUjH8eLvBoTcGBOA5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fKavpyHlgnodX0dHgZPOw1oNsXWsB/mBts4ZsTFe0WA6QYnFJHwZtgGj1SagPbzrk i9b9a4+e8JemWh3kMWkcg8Rbm2qBBE4w0l9ZpTy8s6f+zia53uTZrSInd2HBM5Vel9 5AMZc8Yd61sF16MAa1sn1s8n01rAIKdA0ksukh6o= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Adrian Hunter , David Ahern , Jiri Olsa , Namhyung Kim , Wang Nan Subject: [PATCH 31/35] perf python: Remove -mcet and -fcf-protection when building with clang Date: Wed, 15 Aug 2018 12:06:07 -0300 Message-Id: <20180815150611.32080-32-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180815150611.32080-1-acme@kernel.org> References: <20180815150611.32080-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo These options are not present in older clang versions, so when we build for a distro that has a gcc new enough to have these options and that the distro python build config settings use them but clang doesn't support, b00m. This is the case with fedora 28 and rawhide, so check if clang has the options and remove the missing ones from CFLAGS. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-7asds7yn6gzg6ns1lw17ukul@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/setup.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 001be4f9d3b9..97efbcad076e 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -1,12 +1,20 @@ #!/usr/bin/python from os import getenv +from subprocess import Popen, PIPE +from re import sub + +def clang_has_option(option): + return [o for o in Popen(['clang', option], stderr=PIPE).stderr.readlines() if "unknown argument" in o] == [ ] cc = getenv("CC") if cc == "clang": from _sysconfigdata import build_time_vars - from re import sub build_time_vars["CFLAGS"] = sub("-specs=[^ ]+", "", build_time_vars["CFLAGS"]) + if not clang_has_option("-mcet"): + build_time_vars["CFLAGS"] = sub("-mcet", "", build_time_vars["CFLAGS"]) + if not clang_has_option("-fcf-protection"): + build_time_vars["CFLAGS"] = sub("-fcf-protection", "", build_time_vars["CFLAGS"]) from distutils.core import setup, Extension -- 2.14.4