From patchwork Tue Apr 23 20:24:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel T. Lee" X-Patchwork-Id: 1089733 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="easPTW8U"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44pZgj0drTz9sCJ for ; Wed, 24 Apr 2019 06:25:05 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727068AbfDWUZD (ORCPT ); Tue, 23 Apr 2019 16:25:03 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46380 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbfDWUZD (ORCPT ); Tue, 23 Apr 2019 16:25:03 -0400 Received: by mail-pg1-f194.google.com with SMTP id v2so5743412pge.13 for ; Tue, 23 Apr 2019 13:25:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=fR1yU3Ew5TgbC1yCMkJN3NCS+WHZOs4qheiPNTnOk8I=; b=easPTW8UQp3U7NjlEtyTdFJrpLQvY+1YxiTNn7Cwh56+i0RiMdu/DlDXslBvdZc5bg xZoXpdx2zs4UFyHGrZBjit1F9wKIW9NUwQjj2dGOppdx4LdR5KBVaLoqqm1sOqaPWMaY TAd+KUmTwus2+ws95dPOCOwpGAXcqZnyAui0oqVWiBOxEp1NR4jinJAwjYOgdxanJ0QV w0gz3kAnly8/GZ5HLtSPsE3uWel+9S/Ucp4XwuTLWLUnq7PsgMhsjwtJS1Z8vp0qScRu Ptm+rg0Kc+A0kJC0XpHc9eO7ai6r8bjBYCExz/FFscSfYqHMoPhCCFR7wrZQw+loByuO EXnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=fR1yU3Ew5TgbC1yCMkJN3NCS+WHZOs4qheiPNTnOk8I=; b=tPxQGWchKcw2wPBhVifVCAhWwmoHXyIYveFG2mIb7sddZJxGmM8K658eJYVC7cgAza 7X5r8Y275hPTr402LySAMFBOwuspMXQ1PElpO4xr+9M/byhVsB4J7prZ/haiWywmP+RA eEhrHoeDLC1n3encKFvRCJZbJadYTzohi1GBGuOOattWA/BpshbDlCANaFmZCU/bAgm2 wi6HYmGPuZwoN+HGGrV7nW4K0T0YDCtZyF9c0nNm09M4OgALWWGljoK6V8M7FtvW/4/U BRPq7/tbPl7k5pd9AdTItEDxL6wXwDOOczXBueEBaP8ZLLXGBgjjpEoQryewwc9TrQNi Rp9Q== X-Gm-Message-State: APjAAAWwLSOZzGudcbF32SSosHy+GLXdy4bjcaJSxZoXmM2sh3kur3q9 HTcc3yIhNymfbYRFHVBTNzBYpWg= X-Google-Smtp-Source: APXvYqybjePTXfSYJBROVt9X2tN+H2VGHvWuz4IVxjvEx1vF88O5w03mCFX+AiwyZf3+0twCinhLJw== X-Received: by 2002:a63:360e:: with SMTP id d14mr26607840pga.188.1556051102165; Tue, 23 Apr 2019 13:25:02 -0700 (PDT) Received: from localhost.localdomain ([111.118.56.180]) by smtp.gmail.com with ESMTPSA id x5sm24789562pfi.91.2019.04.23.13.25.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Apr 2019 13:25:01 -0700 (PDT) From: "Daniel T. Lee" To: Daniel Borkmann , Alexei Starovoitov Cc: netdev@vger.kernel.org Subject: [PATCH] libbpf: fix samples/bpf build failure due to undefined UINT32_MAX Date: Wed, 24 Apr 2019 05:24:56 +0900 Message-Id: <20190423202456.1477-1-danieltimlee@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently, building bpf samples will cause the following error. ./tools/lib/bpf/bpf.h:132:27: error: 'UINT32_MAX' undeclared here (not in a function) .. #define BPF_LOG_BUF_SIZE (UINT32_MAX >> 8) /* verifier maximum in kernels <= 5.1 */ ^ ./samples/bpf/bpf_load.h:31:25: note: in expansion of macro 'BPF_LOG_BUF_SIZE' extern char bpf_log_buf[BPF_LOG_BUF_SIZE]; ^~~~~~~~~~~~~~~~ Due to commit 4519efa6f8ea ("libbpf: fix BPF_LOG_BUF_SIZE off-by-one error") hard-coded size of BPF_LOG_BUF_SIZE has been replaced with UINT32_MAX which is defined in header. Even with this change, bpf selftests are running fine since these are built with clang and it includes header(-idirafter) from clang/6.0.0/include. (it has ) clang -I. -I./include/uapi -I../../../include/uapi -idirafter /usr/local/include -idirafter /usr/include \ -idirafter /usr/lib/llvm-6.0/lib/clang/6.0.0/include -idirafter /usr/include/x86_64-linux-gnu \ -Wno-compare-distinct-pointer-types -O2 -target bpf -emit-llvm -c progs/test_sysctl_prog.c -o - | \ llc -march=bpf -mcpu=generic -filetype=obj -o /linux/tools/testing/selftests/bpf/test_sysctl_prog.o But bpf samples are compiled with GCC, and it only searches and includes headers declared at the target file. As '#include ' hasn't been declared in tools/lib/bpf/bpf.h, it causes build failure of bpf samples. gcc -Wp,-MD,./samples/bpf/.sockex3_user.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes \ -O2 -fomit-frame-pointer -std=gnu89 -I./usr/include -I./tools/lib/ -I./tools/testing/selftests/bpf/ \ -I./tools/ lib/ -I./tools/include -I./tools/perf -c -o ./samples/bpf/sockex3_user.o ./samples/bpf/sockex3_user.c; This commit add declaration of '#include ' to tools/lib/bpf/bpf.h to fix this problem. Signed-off-by: Daniel T. Lee Acked-by: Yonghong Song --- tools/lib/bpf/bpf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h index ff2506fe6bd2..9593fec75652 100644 --- a/tools/lib/bpf/bpf.h +++ b/tools/lib/bpf/bpf.h @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" {