Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5655872img; Wed, 27 Mar 2019 12:33:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxp7wLPEazTZ2JRqUGt2BGUlvshGwfwvYTKZNUmIg2Ry0KTAVhoGZKgweZQXzqGv/tIJEdF X-Received: by 2002:a17:902:e084:: with SMTP id cb4mr14871802plb.77.1553715214716; Wed, 27 Mar 2019 12:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553715214; cv=none; d=google.com; s=arc-20160816; b=OPuvT+/W7X7q+hwqdEqClmtBLvzqi23EY4FhAloNCJvVohD3LfPYU+P3o3lURq+ZT5 4evZWerdQLzgoERJYyFlA8wGlG28e0KKJ7cW2jcnf+BIDWO4loi13tARfaelo/P3oEwi AEz8WQDAVNmvojp/Y/YlZVRXzVnxsR53O63z7RVlmZynj68K9rWDWTjnspRgdQ8R60Yq 0KEZF+kKyuputey0AWTzaAWwF6Lj/A4pXp9XFDWEzIoH+0XGb4WACXwYhGiqqmHhmwPw IxwWoFdIbpODFJCy3UjC9E6Ou0dc6QdJRlP08uNEfdM6xIVyUhMEWkiM13Ud9A3L50jF 3Mww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6uHj+rVSSbgyYkVbGUHN3x1szlce8E+2iNiZ4Ho+IQM=; b=d7NGppLvCmQU642XW8opO2gg19uchNP+3559hMHYOf1LVaFQ4wDqsvSjAIJ95ynnyc OIrQROdQ45orkJPpkjNiiRGyJxD3AWbfAq6G0duXt9SPTiC54wPyAS5aSUiirIdDL92W Wtr2ZW0eWHNPoa4OgihBrWz01gBymPoVaLi5CjRsx31gemw7vv7eg61w1y/xvDjFSILS HH2MxxAtTkbwi+axOshho5W56F23wAxc/BJZP/HrliP+dUu9sg1G4toBnFiM55d6r2ip VYMtjFc4dZRZQ+yPnaHYGCgrsnRFJg4znSaVvw4qaH2FJ+mfeXvNbuYhaB5wp1U/ioAo DKpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cKiBEVO4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s35si19129195pgl.101.2019.03.27.12.33.19; Wed, 27 Mar 2019 12:33:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cKiBEVO4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387578AbfC0Tcp (ORCPT + 99 others); Wed, 27 Mar 2019 15:32:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:42582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731120AbfC0SCj (ORCPT ); Wed, 27 Mar 2019 14:02:39 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A43142177E; Wed, 27 Mar 2019 18:02:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553709758; bh=QxT++6H9Ub1czxq143z5rjk+Ci+OD4P3uiOUB8xIhLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cKiBEVO4Rx/Y1e72mWPOh1pJMCp9flQ6DG8mSjcy35KnJob0t/nuzVjKHLDxyW8ZI 8I9jExA2T7ynALm48y/tOsykVC4jzVmOrB79XI8keNl02xSN5x879MKyYk2FxCkKXH SWdvKpTTcJSUujjviz3orLJJio0kUuwevOwgWdHg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stanislav Fomichev , Daniel Borkmann , Sasha Levin , netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 024/262] libbpf: force fixdep compilation at the start of the build Date: Wed, 27 Mar 2019 13:57:59 -0400 Message-Id: <20190327180158.10245-24-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stanislav Fomichev [ Upstream commit 8e2688876c7f7073d925e1f150e86b8ed3338f52 ] libbpf targets don't explicitly depend on fixdep target, so when we do 'make -j$(nproc)', there is a high probability, that some objects will be built before fixdep binary is available. Fix this by running sub-make; this makes sure that fixdep dependency is properly accounted for. For the same issue in perf, see commit abb26210a395 ("perf tools: Force fixdep compilation at the start of the build"). Before: $ rm -rf /tmp/bld; mkdir /tmp/bld; make -j$(nproc) O=/tmp/bld -C tools/lib/bpf/ Auto-detecting system features: ... libelf: [ on ] ... bpf: [ on ] HOSTCC /tmp/bld/fixdep.o CC /tmp/bld/libbpf.o CC /tmp/bld/bpf.o CC /tmp/bld/btf.o CC /tmp/bld/nlattr.o CC /tmp/bld/libbpf_errno.o CC /tmp/bld/str_error.o CC /tmp/bld/netlink.o CC /tmp/bld/bpf_prog_linfo.o CC /tmp/bld/libbpf_probes.o CC /tmp/bld/xsk.o HOSTLD /tmp/bld/fixdep-in.o LINK /tmp/bld/fixdep LD /tmp/bld/libbpf-in.o LINK /tmp/bld/libbpf.a LINK /tmp/bld/libbpf.so LINK /tmp/bld/test_libbpf $ head /tmp/bld/.libbpf.o.cmd # cannot find fixdep (/usr/local/google/home/sdf/src/linux/xxx//fixdep) # using basic dep data /tmp/bld/libbpf.o: libbpf.c /usr/include/stdc-predef.h \ /usr/include/stdlib.h /usr/include/features.h \ /usr/include/x86_64-linux-gnu/sys/cdefs.h \ /usr/include/x86_64-linux-gnu/bits/wordsize.h \ /usr/include/x86_64-linux-gnu/gnu/stubs.h \ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \ After: $ rm -rf /tmp/bld; mkdir /tmp/bld; make -j$(nproc) O=/tmp/bld -C tools/lib/bpf/ Auto-detecting system features: ... libelf: [ on ] ... bpf: [ on ] HOSTCC /tmp/bld/fixdep.o HOSTLD /tmp/bld/fixdep-in.o LINK /tmp/bld/fixdep CC /tmp/bld/libbpf.o CC /tmp/bld/bpf.o CC /tmp/bld/nlattr.o CC /tmp/bld/btf.o CC /tmp/bld/libbpf_errno.o CC /tmp/bld/str_error.o CC /tmp/bld/netlink.o CC /tmp/bld/bpf_prog_linfo.o CC /tmp/bld/libbpf_probes.o CC /tmp/bld/xsk.o LD /tmp/bld/libbpf-in.o LINK /tmp/bld/libbpf.a LINK /tmp/bld/libbpf.so LINK /tmp/bld/test_libbpf $ head /tmp/bld/.libbpf.o.cmd cmd_/tmp/bld/libbpf.o := gcc -Wp,-MD,/tmp/bld/.libbpf.o.d -Wp,-MT,/tmp/bld/libbpf.o -g -Wall -DHAVE_LIBELF_MMAP_SUPPORT -DCOMPAT_NEED_REALLOCARRAY -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wstrict-aliasing=3 -Werror -Wall -fPIC -I. -I/usr/local/google/home/sdf/src/linux/tools/include -I/usr/local/google/home/sdf/src/linux/tools/arch/x86/include/uapi -I/usr/local/google/home/sdf/src/linux/tools/include/uapi -fvisibility=hidden -D"BUILD_STR(s)=$(pound)s" -c -o /tmp/bld/libbpf.o libbpf.c source_/tmp/bld/libbpf.o := libbpf.c deps_/tmp/bld/libbpf.o := \ /usr/include/stdc-predef.h \ /usr/include/stdlib.h \ /usr/include/features.h \ /usr/include/x86_64-linux-gnu/sys/cdefs.h \ /usr/include/x86_64-linux-gnu/bits/wordsize.h \ Fixes: 7c422f557266 ("tools build: Build fixdep helper from perf and basic libs") Reported-by: Eric Dumazet Signed-off-by: Stanislav Fomichev Acked-by: Yonghong Song Signed-off-by: Daniel Borkmann Signed-off-by: Sasha Levin --- tools/lib/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index 34d9c3619c96..78fd86b85087 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile @@ -162,7 +162,8 @@ endif TARGETS = $(CMD_TARGETS) -all: fixdep all_cmd +all: fixdep + $(Q)$(MAKE) all_cmd all_cmd: $(CMD_TARGETS) check -- 2.19.1