From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Clark Williams <williams@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Eduardo Habkost <ehabkost@redhat.com>,
Adrian Hunter <adrian.hunter@intel.com>,
David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Wang Nan <wangnan0@huawei.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 10/12] perf python: More portable way to make CFLAGS work with clang
Date: Mon, 8 Oct 2018 21:54:25 -0300 [thread overview]
Message-ID: <20181009005427.6607-11-acme@kernel.org> (raw)
In-Reply-To: <20181009005427.6607-1-acme@kernel.org>
From: Eduardo Habkost <ehabkost@redhat.com>
The existing code that tries to make CFLAGS compatible with clang
doesn't work with Python 3.
Instead of trying to touch _sysconfigdata.build_time_vars directly,
change the dictionary returned by disutils.sysconfig.get_config_vars().
This works on both Python 2 and Python 3.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20181005204058.7966-3-ehabkost@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/setup.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 261a55e7e1b2..63f758c655d5 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -9,12 +9,14 @@ def clang_has_option(option):
cc = getenv("CC")
if cc == "clang":
- from _sysconfigdata import build_time_vars
- 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.sysconfig import get_config_vars
+ vars = get_config_vars()
+ for var in ('CFLAGS', 'OPT'):
+ vars[var] = sub("-specs=[^ ]+", "", vars[var])
+ if not clang_has_option("-mcet"):
+ vars[var] = sub("-mcet", "", vars[var])
+ if not clang_has_option("-fcf-protection"):
+ vars[var] = sub("-fcf-protection", "", vars[var])
from distutils.core import setup, Extension
--
2.14.4
next prev parent reply other threads:[~2018-10-09 0:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 0:54 [GIT PULL 00/12] perf/core improvements and fixes Arnaldo Carvalho de Melo
2018-10-09 0:54 ` [PATCH 01/12] tools include: Adopt linux/bits.h Arnaldo Carvalho de Melo
2018-10-09 8:47 ` Alexander Sverdlin
2018-10-09 14:01 ` Arnaldo Carvalho de Melo
2018-10-09 0:54 ` [PATCH 02/12] perf auxtrace: Include missing asm/bitsperlong.h to get BITS_PER_LONG Arnaldo Carvalho de Melo
2018-10-09 8:43 ` Alexander Sverdlin
2018-10-09 0:54 ` [PATCH 03/12] perf test: S390 does not support watchpoints in test 22 Arnaldo Carvalho de Melo
2018-10-09 0:54 ` [PATCH 04/12] perf strbuf: Match va_{add,copy} with va_end Arnaldo Carvalho de Melo
2018-10-09 0:54 ` [PATCH 05/12] perf tools: Cleanup trace-event-info 'tdata' leak Arnaldo Carvalho de Melo
2018-10-09 0:54 ` [PATCH 06/12] perf tools: Free 'printk' string in parse_ftrace_printk() Arnaldo Carvalho de Melo
2018-10-09 0:54 ` [PATCH 07/12] perf tools: Avoid double free in read_event_file() Arnaldo Carvalho de Melo
2018-10-09 0:54 ` [PATCH 08/12] perf tools: Free temporary 'sys' string in read_event_files() Arnaldo Carvalho de Melo
2018-10-09 0:54 ` [PATCH 09/12] perf python: Make clang_has_option() work on Python 3 Arnaldo Carvalho de Melo
2018-10-09 0:54 ` Arnaldo Carvalho de Melo [this message]
2018-10-09 0:54 ` [PATCH 11/12] tools lib traceevent: Separate out tep_strerror() for strerror_r() issues Arnaldo Carvalho de Melo
2018-10-09 0:54 ` [PATCH 12/12] tools lib traceevent, perf tools: Move struct tep_handler definition in a local header file Arnaldo Carvalho de Melo
2018-10-09 5:24 ` [GIT PULL 00/12] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181009005427.6607-11-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=ehabkost@redhat.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=wangnan0@huawei.com \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).