From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Namhyung Kim <namhyung@kernel.org>,
Ian Rogers <irogers@google.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Nathan Chancellor <nathan@kernel.org>
Subject: Re: [Linux-6.11-rc4] perf BROKEN with LLVM/Clang 19.1.0-rc3
Date: Thu, 22 Aug 2024 12:09:59 -0300 [thread overview]
Message-ID: <ZsdUxxBrpbuYxtXN@x1> (raw)
In-Reply-To: <ZsdKhLaPy-uzKsuH@x1>
On Thu, Aug 22, 2024 at 11:26:16AM -0300, Arnaldo Carvalho de Melo wrote:
> So the cast is ok, I think we should disable that
> -Wcast-function-type-mismatch for util/python.o when building with
> clang.
> Lemme try to cook a patch for you to test...
Can you try the patch below? Notice that there was already a patch
disabling that for !clang (gcc) for a similar reason:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b7a313d84e853049062011d78cb04b6decd12f5c
------------------------------------------------------------------------------------------
perf tools: Fix python extension build for gcc 8
The gcc 8 compiler won't compile the python extension code with the
following errors (one example):
python.c:830:15: error: cast between incompatible function types from \
‘PyObject * (*)(struct pyrf_evsel *, PyObject *, PyObject *)’ \
uct _object * (*)(struct pyrf_evsel *, struct _object *, struct _object *)’} to \
‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _objeuct \
_object *)’} [-Werror=cast-function-type]
.ml_meth = (PyCFunction)pyrf_evsel__open,
The problem with the PyMethodDef::ml_meth callback is that its type is
determined based on the PyMethodDef::ml_flags value, which we set as
METH_VARARGS | METH_KEYWORDS.
<SNIP>
------------------------------------------------------------------------------------------
Can you please check with both clang versions? I just checked with clang
18 as available in in Fedora 40 and it failed in the first, naïve patch,
that simply adds that -Wno- variant:
GEN /tmp/build/perf-tools-next/python/perf.cpython-312-x86_64-linux-gnu.so
error: unknown warning option '-Wno-cast-function-type-mismatch'; did you mean '-Wno-cast-function-type-strict'? [-Werror,-Wunknown-warning-option]
error: command '/usr/bin/clang' failed with exit code 1
cp: cannot stat '/tmp/build/perf-tools-next/python_ext_build/lib/perf*.so': No such file or directory
we need to check if clang has that option, we have infra for that, the
patch below works, please try it.
If it works with clang 19 I'll add two patches, one enhancing
clang_has_option and the other using it for this warning only present in
clang 19.
- Arnaldo
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 142e9d447ce721e3..649550e9b7aa8c8f 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -17,7 +17,7 @@ src_feature_tests = getenv('srctree') + '/tools/build/feature'
def clang_has_option(option):
cc_output = Popen([cc, cc_options + option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines()
- return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o))] == [ ]
+ return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o) or (b"unknown warning option" in o))] == [ ]
if cc_is_clang:
from sysconfig import get_config_vars
@@ -63,6 +63,8 @@ cflags = getenv('CFLAGS', '').split()
cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls' ]
if cc_is_clang:
cflags += ["-Wno-unused-command-line-argument" ]
+ if clang_has_option("-Wno-cast-function-type-mismatch"):
+ cflags += ["-Wno-cast-function-type-mismatch" ]
else:
cflags += ['-Wno-cast-function-type' ]
next prev parent reply other threads:[~2024-08-22 15:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 19:23 [Linux-6.11-rc4] perf BROKEN with LLVM/Clang 19.1.0-rc3 Sedat Dilek
2024-08-21 19:37 ` Sedat Dilek
2024-08-21 20:37 ` Namhyung Kim
2024-08-22 15:34 ` Arnaldo Carvalho de Melo
2024-08-22 14:26 ` Arnaldo Carvalho de Melo
2024-08-22 15:09 ` Arnaldo Carvalho de Melo [this message]
2024-08-22 17:02 ` Sedat Dilek
2024-08-22 17:12 ` Arnaldo Carvalho de Melo
2024-08-22 17:19 ` Arnaldo Carvalho de Melo
2024-08-22 17:31 ` Sedat Dilek
2024-08-22 17:40 ` Arnaldo Carvalho de Melo
2024-08-22 17:59 ` Sedat Dilek
2024-08-22 18:17 ` Namhyung Kim
2024-08-22 18:20 ` Arnaldo Carvalho de Melo
2024-08-22 18:29 ` Sedat Dilek
2024-08-22 20:11 ` Namhyung Kim
2024-08-22 20:26 ` Arnaldo Carvalho de Melo
2024-08-22 20:30 ` Namhyung Kim
2024-08-23 13:58 ` Sedat Dilek
2024-08-23 15:03 ` Namhyung Kim
2024-08-22 18:17 ` Arnaldo Carvalho de Melo
2024-08-22 18:19 ` Sedat Dilek
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=ZsdUxxBrpbuYxtXN@x1 \
--to=acme@kernel.org \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=peterz@infradead.org \
--cc=sedat.dilek@gmail.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