[PATCH] D151020: [llvm-exegesis] Add ability to assign perf counters to specific PID

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 10:52:30 PDT 2023

mstorsjo added a comment.

In D151020#4440457 <https://reviews.llvm.org/D151020#4440457>, @mstorsjo wrote:

> This broke compilation for mingw targets (in particular, for 64 bit targets - the issue seems to be benign for 32 bit targets). For those targets, compilation fails with this error:
>   /home/martin/code/llvm-project/llvm/tools/llvm-exegesis/lib/PerfHelper.h:27:13: error: typedef redefinition with different types ('int' vs '_pid_t' (aka 'long long'))
>      27 | typedef int pid_t;
>         |             ^
>   /home/martin/clang-nightly/aarch64-w64-mingw32/include/sys/types.h:68:16: note: previous definition is here
>      68 | typedef _pid_t  pid_t;
>         |                 ^
>   1 error generated.
> (For 32 bit targets, there's no mismatch between int and long long so it doesn't error out.)
> `HAVE_LIBPFM` isn't a good guard for whether we need to define `pid_t` ourselves, since we can't know whether a transitively included header has defined this type regardless of libpfm. From looking around in e.g. lldb sources, `pid_t` is probably generally available for all targets except for Windows/MSVC (while mingw does have it).

I would really like to unbreak the mingw build. If anybody is reading and listening - do you prefer reverting this commit for now, until we can sort out how to safely typedef int across various OSes, or just add an `&& !defined(__MINGW32__)` into the condition? Or something else?

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list