From dcb84740cd296a92ffc8598b7318faa6c457096a Mon Sep 17 00:00:00 2001 From: William Cohen Date: Mon, 29 Jan 2024 16:34:57 -0500 Subject: [PATCH] Fix gcc-14 -Werror=calloc-transposed-args compatibility --- libpfm-gcc14.patch | 21 +++++++++++++++++++++ libpfm.spec | 9 +++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 libpfm-gcc14.patch diff --git a/libpfm-gcc14.patch b/libpfm-gcc14.patch new file mode 100644 index 0000000..9f2a62d --- /dev/null +++ b/libpfm-gcc14.patch @@ -0,0 +1,21 @@ +commit cb944829e0940d74009e09b8985b4f2139f5cb3b +Author: William Cohen +Date: Mon Jan 29 16:23:43 2024 -0500 + + Correct s390x code to avoid GCC-14 -Werror=calloc-transposed-args errors + +diff --git a/lib/pfmlib_s390x_cpumf.c b/lib/pfmlib_s390x_cpumf.c +index d8ce22d..718f5f8 100644 +--- a/lib/pfmlib_s390x_cpumf.c ++++ b/lib/pfmlib_s390x_cpumf.c +@@ -216,8 +216,8 @@ static int pfm_cpumcf_init(void *this) + break; + } + +- cpumcf_pe = calloc(sizeof(*cpumcf_pe), +- cfvn_set_count + csvn_set_count + ext_set_count); ++ cpumcf_pe = calloc(cfvn_set_count + csvn_set_count + ext_set_count, ++ sizeof(*cpumcf_pe)); + if (cpumcf_pe == NULL) + return PFM_ERR_NOMEM; + diff --git a/libpfm.spec b/libpfm.spec index 699adb1..bd80765 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -12,7 +12,7 @@ Name: libpfm Version: 4.13.0 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Library to encode performance events for use by perf tool @@ -20,6 +20,7 @@ License: MIT URL: http://perfmon2.sourceforge.net/ Source0: http://sourceforge.net/projects/perfmon2/files/libpfm4/%{name}-%{version}.tar.gz Patch2: libpfm-python3-setup.patch +Patch3: libpfm-gcc14.patch BuildRequires: make BuildRequires: gcc @@ -73,7 +74,8 @@ Python bindings for libpfm4 and perf_event_open system call. %prep %setup -q -%patch2 -p1 -b .python3 +%patch -P2 -p1 -b .python3 +%patch -P3 -p1 -b .gcc14 # to prevent setuptools from installing an .egg, we need to pass --root to setup.py install # see https://github.com/pypa/setuptools/issues/3143 # and https://github.com/pypa/pip/issues/11501 @@ -133,6 +135,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Mon Jan 29 2024 William Cohen - 4.13.0-8 +- Fix gcc-14 -Werror=calloc-transposed-args compatibility + * Thu Jan 25 2024 Fedora Release Engineering - 4.13.0-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild