From patchwork Sun Mar 10 02:04:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13587952 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 414235394 for ; Sun, 10 Mar 2024 02:05:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710036339; cv=none; b=DFNr8G6h8kcGb/3fV92FXonG2AsN2RmmTPY0Ne3bkHb2fmKOYQZPJcoZFTt69FrMYEX/f5+K6rFsexMw517y22LAHZ9LX/XHfhyZNAkqD6pddbGGFTdNrgh/v0OuCUmi6636nXN2+2CIoyhvJQMARtTdSfqlYbcGy7XZ4I/u60s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710036339; c=relaxed/simple; bh=D2uX+Mnk+6vztSUZd5hP00XWtGAz0CoTxvXAkzGNj1I=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=kAJ+vBJXxIkC9AtljqsX5vcI15/yVrPb8W6L3sK8jMSb/Xsn83lAo7mKo4Wyz+UuA7+QgcwF/glSUTzrazL2v+RTMjWy8AusJ32Lz4yM8nSK3LFJq8qwpzGRfE0wduIC8QrNIaStlkfldTRz2676R+cLi1gMNVsQp/sgUCUDnsA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=kMIRydFx; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kMIRydFx" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-60a2386e932so7272877b3.1 for ; Sat, 09 Mar 2024 18:05:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1710036336; x=1710641136; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=T7XIYLAkcLSrj5FLrGjKI8q+UW4mZzYyudvGuQ4/TZo=; b=kMIRydFxidKzY7BpYx9EUp/eSGgFea4GwwQrTWrZFWAG+5gWnMJU0Gbf6KDWEXRVbB yt7yTV4W7LoKxr4bwuLNicNelGV0VJdo8+Xxc3tr9qWqEormXicnooeGM+XBHP/F8Lpv MkZPbXBbSyvDxovJoSlKKkCQ8NeOEsoPsWWeQ/wCQOw3jDd+VazdaPjgJjjglqJ2YrqQ DzXZQwEmve8ZRYv9vrjP3ObWuuQVtRPblfKrVNINjUlnr0Z/lkXrGfycXXpfWJCveve2 LkbG7/7/jskn+XiPH/2MRqGAtT1mcFiev5F2k5tRA7Uy3qUjHzrB0948Z1PAUaO33IXn CXSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710036336; x=1710641136; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=T7XIYLAkcLSrj5FLrGjKI8q+UW4mZzYyudvGuQ4/TZo=; b=vTMQBr5uNME6yyU02IZU4E06GLIMJAFSMAawOMwihJRUwT/fessxFxeMlqDp1zm4Dg Zjo+nDSeZ0CBMX+9YXpHpvhSxap25YqdsjffWeamRkWszI0RIQYhWKn0eUrWMFgXPwOU bAHQPkX76vzqjHO7y6V+oBya/EGvv7roaGvEWdoSzGJ+CRHVMsIE+nCFL8jjX3hvakC2 2VJQxqFwopOTrdVzJj1Krhi74Cwbyte9izksWBn+WFa0Vz2fVvrBNx6N75De1qeVfLS/ 7rhf2P8Xonh4yaIhahC7tKjI4ljn8ICIncYuN2Pk/X5NSPq9qBYyra6pP6lcq6YoLUDh tP2Q== X-Forwarded-Encrypted: i=1; AJvYcCWWFurnIxBJvA0at7mXQ9BemLIhOn5BBSNjm3G77UL7ZfdCXtkEMUjOmEZuElC6aca9Cz4k9vR8/RUM9/fZ2jEC6zmfg+Q1RnaE9C9Mdaze X-Gm-Message-State: AOJu0YxK0ZsFPmZxkli9qU7xwCUIlGzskQ6Z1UoThGOk5bqSOPFpEuL+ +SseXYyI7sMx/3GVbvWE/+qZfY3BIc+7zOmiUeK5yHLKtcHPrMmxOhj1Yp/MlDKeXPnJpfRU6Ix vwPorMA== X-Google-Smtp-Source: AGHT+IHgDNWM+Z4QXgFMm7GizvEhHToqcLHuZHJtXyYeO1MzHp7huAG4ihDQbMUHqCDQpOBGjLQSGQDO0YZe X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:a63d:1b65:e810:3ad3]) (user=irogers job=sendgmr) by 2002:a0d:d7cd:0:b0:608:72fe:b8a1 with SMTP id z196-20020a0dd7cd000000b0060872feb8a1mr953360ywd.4.1710036336387; Sat, 09 Mar 2024 18:05:36 -0800 (PST) Date: Sat, 9 Mar 2024 18:04:57 -0800 In-Reply-To: <20240310020509.647319-1-irogers@google.com> Message-Id: <20240310020509.647319-3-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240310020509.647319-1-irogers@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v1 02/13] libbpf: Make __printf define conditional From: Ian Rogers To: Arnd Bergmann , Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Ian Rogers , Adrian Hunter , Paolo Bonzini , Shuah Khan , Kees Cook , "Gustavo A. R. Silva" , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andrew Morton , Liam Howlett , Miguel Ojeda , Will Deacon , Mark Brown , David Laight , "Michael S. Tsirkin" , Shunsuke Mie , Yafang Shao , Kui-Feng Lee , James Clark , Nick Forrington , Leo Yan , German Gomez , Rob Herring , John Garry , Sean Christopherson , Anup Patel , Fuad Tabba , Andrew Jones , Chao Peng , Haibo Xu , Peter Xu , Vishal Annapurve , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev libbpf depends upon linux/err.h which has a linux/compiler.h dependency. In the kernel includes, as opposed to the tools version, linux/compiler.h includes linux/compiler_attributes.h which defines __printf. As the libbpf.c __printf definition isn't guarded by an ifndef, this leads to a duplicate definition compilation error when trying to update the tools/include/linux/compiler.h. Fix this by adding the missing ifndef. Signed-off-by: Ian Rogers Acked-by: Andrii Nakryiko --- tools/lib/bpf/libbpf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index afd09571c482..2152360b4b18 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -66,7 +66,9 @@ */ #pragma GCC diagnostic ignored "-Wformat-nonliteral" -#define __printf(a, b) __attribute__((format(printf, a, b))) +#ifndef __printf +# define __printf(a, b) __attribute__((format(printf, a, b))) +#endif static struct bpf_map *bpf_object__add_map(struct bpf_object *obj); static bool prog_is_subprog(const struct bpf_object *obj, const struct bpf_program *prog);