[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH3MdRU_OQ03Jd7Y6RvdaPE2hvXt+qoPn0-+25Gma-HX6k-DnA@mail.gmail.com>
Date: Wed, 6 Mar 2019 17:13:36 -0800
From: Y Song <ys114321@...il.com>
To: Stanislav Fomichev <sdf@...gle.com>
Cc: netdev <netdev@...r.kernel.org>, bpf@...r.kernel.org,
David Miller <davem@...emloft.net>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH bpf 2/2] libbpf: force fixdep compilation at the start of
the build
On Wed, Mar 6, 2019 at 1:14 PM Stanislav Fomichev <sdf@...gle.com> wrote:
>
> 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 \
>
> Reported-by: Eric Dumazet <edumazet@...gle.com>
> Fixes: 7c422f557266 ("tools build: Build fixdep helper from perf and basic libs")
>
> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
Acked-by: Yonghong Song <yhs@...com>
Powered by blists - more mailing lists