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: 13587966 X-Patchwork-Delegate: bpf@iogearbox.net Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 415AF5662 for ; Sun, 10 Mar 2024 02:05:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710036338; cv=none; b=dE+HgQhyKmV98Kvi1skqN+4wwKS0Q9kYuoJnXpo/rCzsTdJgMlWVjeRLzFmN4qA4sYZvYH58h1lfkeXTpZq4I3/p0t0s5Cf7ZGdMqly6Q/rNc8BYtX/YsJo+2qbzkl4qwWg9tpcmPoHRqheB6DqETqTYiQev9+qeQ6tdD3BRrSY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710036338; c=relaxed/simple; bh=D2uX+Mnk+6vztSUZd5hP00XWtGAz0CoTxvXAkzGNj1I=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=bKV/w1lpBDNFglfiDTghsn7N2v155z7NMkFsnyDdHlV8aur+pGLosgoYYDL6mBb/cWvuAyRVsWV0Sbzd1nyYCRcBI63P7Bxj4fUuWt7EwNl5kPpJcya6fleVYiAMcod4318LdbNmscCGbizjy2wRg1i2deYsHygxTh+cmqb64Ls= 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.202 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-f202.google.com with SMTP id 00721157ae682-609ea26233dso55970847b3.0 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=M5d80vZYYE1h7jp5uDf7NWSqm2IE4KV2sWdHgFh6EQLaMhyT9DQE5+NWqn8AgVb4yq K5gSCOAWYOZ/ryymvo/1Abua9SLg+xTMmfY+XZD7hHANaK2Ee77W+BQM/N2GmrjwiVWB ddlcQerrsX7KirSOEJYv0cC3A5Q9rPFgl/GEXj9xIrCpRHGKT95WHp3ymrlCTvK5GkeE tkOiDhKrkOWsTeT3eNn2OT3lX6dklMFHKLkw6N6EkIpK2WE5sRCN/LxSjxpkfkGNOfM6 Dpr+wUoe2ugaCzv6//l3kzF9MmiUQcxKDZ8wTwMMD65M2dHEz/Rw4/vQMUGMT6NJSIyI NexQ== X-Forwarded-Encrypted: i=1; AJvYcCUwSj7kSF6WCSi26wzV84uzzEkUhc7rL6pFLDxautOH5z8Liu7sQ3SUf6uB/f8gvghu57MU3om//2KeQc66aFFggcQ1 X-Gm-Message-State: AOJu0Yz6GWOuS1ZM/964D1pk4ZTL7POOtG0DMYgAAk+Y1IC4v6cb71yI TgA8KbF/t6YPwl8Akgy56jPo03L8Bg4wtEcck5DSxCR1NNLP0E926GG+yzrPi+VIe/dLepTK68F uhIsftg== 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: bpf@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 X-Patchwork-Delegate: bpf@iogearbox.net 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);