From nobody Tue Feb 10 20:28:56 2026 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 573FD1DE3C4 for ; Wed, 29 Jan 2025 15:44:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738165484; cv=none; b=Zf8wZO8Mm0YFakenxVPS69Cqb139jcTqj3uVkBixJXXpENOFpou8phlZAVRBWt3pyQCCtUE+e4eDGC5wUJ0Voo2r975a8i77+nFaJb8zdZb8kUoz0KU7ybjsTQUUeTZWxLwm6Kn3a1jgCBVFRwZrTisNHULQmW6CrKnlMEAXOpI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738165484; c=relaxed/simple; bh=cWHfYeyt+oHxSfbBoOrNogusDIOQlCQOMrZ+MWLH8B4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=M5KWGoI4Ob7VUNuW3NmkpXPbozjrDrBYtT25ozIVLOZu7cSlIJ9ZdToxc85UMMRlShSXlQRDH/3TaPFHJMacicGhUxBJif69OJUoxg/RSgRI5YeKNYJfIJmlMgGyGyclV32XXJ0xEkpe+beMx8sxomfgEXPgAmZ6GTZy5rssYx4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=aqtKZ3xm; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aqtKZ3xm" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3862f32a33eso3282574f8f.3 for ; Wed, 29 Jan 2025 07:44:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738165480; x=1738770280; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=b38VL+rBP91884jzBXnnCS1YsVPwzuVXNg23TycEXNw=; b=aqtKZ3xml2F7TSqTDikXxIM0zz9QSJhGLKCCoNRxVT5P1+Z6P8NQaql+vFyUKQle0K jvvTYuQ7pH7VXUYhD/DZr7G58IkeVlJLdFpxYWgwzy+nUAKTjspiqeK3v/XCKm7ZK0wb AhJp/+jW8jHq/e+kRjlN98+bTlcnxGo/sgSbWINpS1vXoTGMxBvJO8WuSq48iIC3DZRf f7bMbCTX5swnsVx1Cp1kaTmcnmHMVCScR8poIZdEaDM2xJQGuU+nxirRn2JHHoqxgO2Y AUttkKM9c8/gdCiuL9evWOt92MPfKNOWd57iJl1ITkYKF5qMZ0gquTYPkA/bBxs9m/Zf 0JBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738165480; x=1738770280; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b38VL+rBP91884jzBXnnCS1YsVPwzuVXNg23TycEXNw=; b=L5curJhyDdqdnVXb8t8phHPGLVo903vgKmk3LkdcMc1eutfTDY3v9jW08GiBmuMz/g OBxs76uweIh8aAgeCnhe29uW4eKjUxvQ91638dRx/LMCuNTNultHONe8AAEJK6tmD1QC QjllKZATUM1EKWz9rx492jq1gooaWV4hnV3q9yAizO1n64462cGDVbOFiiIlbJmXTu92 2JV0EObHGYz67pKdOQpFIU/KvVSgYxwxjhtlS6aiqh0Y9Mqi6UowH40W16XjQ2Sr/FwK JT24zElEGsLtquMFkyiNQEq+c+1JROLPyjMaKfwQ3ipHkBf4g4M3ufA7ABjFuhaN0xts ZqEQ== X-Forwarded-Encrypted: i=1; AJvYcCXT2EIrsnUbYMapaeN5Ha35DROJAywLD3j6wP8vVyZBHR+6AAH5mcCBTaOwB+Bzuiaq6TmMMq/wBFKIVsA=@vger.kernel.org X-Gm-Message-State: AOJu0YyRV9JXfe2eiXJYwhs8I5t15x3S6CLAKa77IWJOhmUdtBG7oGi5 v7+G6HyBVkvqRoQ+cdplVDERPh0qDgjJYX/CazNJgQu8i8J+Rd1c4gSTF4Pvd/c= X-Gm-Gg: ASbGnctofCQokVefpPewCkbckoTmYCWXyw2VqMEb5g9Tu01HZJjqjBjujar4TPmsmaw a7ezQgFJGxZYrJVb19HfvgdVYSx//DrW88XfUXBuGrHUjveEaKj/3gZZymef++g+X1AGh1qqcSA v6xT82njE8Z1Oke1+hrxWEfiJgIXKGQKxYfYf1FSZZraxIKD7yKRwCKFaguM1j1RAunRxqMI1cf bhGE7MrxL3B5G7sUeYvcjr7npFAjaHODw76ocAHNezFiHmDy6WgtTmwWeyu7MdR+PNBa2lypCPh Z4mUOG8DbQ3jy80= X-Google-Smtp-Source: AGHT+IGP8GgwuWRnSTc83q6GU6uSdJwwCAR0ZKLna0aMyBcMy2h+dZwjsLGCBz1Jm35rhc1DQtEc6w== X-Received: by 2002:a05:6000:1888:b0:385:f195:2a8 with SMTP id ffacd0b85a97d-38c5195f5d4mr2910278f8f.30.1738165480523; Wed, 29 Jan 2025 07:44:40 -0800 (PST) Received: from pop-os.. ([145.224.90.107]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a313383sm17917287f8f.36.2025.01.29.07.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2025 07:44:40 -0800 (PST) From: James Clark To: linux-perf-users@vger.kernel.org Cc: James Clark , Ali Utku Selen , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , linux-kernel@vger.kernel.org Subject: [PATCH] perf: Always feature test reallocarray Date: Wed, 29 Jan 2025 15:44:05 +0000 Message-Id: <20250129154405.777533-1-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is also used in util/comm.c now, so instead of selectively doing the feature test, always do it. If it's ever used anywhere else it's less likely to cause another build failure. This doesn't remove the need to manually include libc_compat.h, and missing that will still cause an error for glibc < 2.26. There isn't a way to fix that without poisoning reallocarray like libbpf did, but that has other downsides like making memory debugging tools less useful. So for Perf keep it like this and we'll have to fix up any missed includes. Fixes the following build error: util/comm.c:152:31: error: implicit declaration of function 'reallocarray' [-Wimplicit-function-declaration] 152 | tmp =3D reallocarray(comm_strs->strs, | ^~~~~~~~~~~~ Fixes: 13ca628716c6 ("perf comm: Add reference count checking to 'struct co= mm_str'") Reported-by: Ali Utku Selen Signed-off-by: James Clark Reviewed-by: Ian Rogers --- tools/perf/Makefile.config | 10 ++++------ tools/perf/util/comm.c | 2 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index a148ca9efca9..ed3ba13f1018 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -497,13 +497,14 @@ ifeq ($(feature-setns), 1) $(call detected,CONFIG_SETNS) endif =20 +ifeq ($(feature-reallocarray), 0) + CFLAGS +=3D -DCOMPAT_NEED_REALLOCARRAY +endif + ifdef CORESIGHT $(call feature_check,libopencsd) ifeq ($(feature-libopencsd), 1) CFLAGS +=3D -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS) - ifeq ($(feature-reallocarray), 0) - CFLAGS +=3D -DCOMPAT_NEED_REALLOCARRAY - endif LDFLAGS +=3D $(LIBOPENCSD_LDFLAGS) EXTLIBS +=3D $(OPENCSDLIBS) $(call detected,CONFIG_LIBOPENCSD) @@ -1103,9 +1104,6 @@ ifndef NO_AUXTRACE ifndef NO_AUXTRACE $(call detected,CONFIG_AUXTRACE) CFLAGS +=3D -DHAVE_AUXTRACE_SUPPORT - ifeq ($(feature-reallocarray), 0) - CFLAGS +=3D -DCOMPAT_NEED_REALLOCARRAY - endif endif endif =20 diff --git a/tools/perf/util/comm.c b/tools/perf/util/comm.c index 49b79cf0c5cc..8aa456d7c2cd 100644 --- a/tools/perf/util/comm.c +++ b/tools/perf/util/comm.c @@ -5,6 +5,8 @@ #include #include #include +#include // reallocarray + #include "rwsem.h" =20 DECLARE_RC_STRUCT(comm_str) { --=20 2.34.1