Re: [PATCH bpf-next] tools/bpf: move linux/types.h for selftests and bpftool

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ +acme ]

On 3/13/20 5:52 PM, Andrii Nakryiko wrote:
On Fri, Mar 13, 2020 at 4:31 AM Tobias Klauser <tklauser@xxxxxxxxxx> wrote:

Commit fe4eb069edb7 ("bpftool: Use linux/types.h from source tree for
profiler build") added a build dependency on tools/testing/selftests/bpf
to tools/bpf/bpftool. This is suboptimal with respect to a possible
stand-alone build of bpftool.

Fix this by moving
tools/testing/selftests/bpf/include/uapi/linux/types.h to
tools/include/uapi/linux/types.h

This requires an adjustment in the include search path order for the
tests in tools/testing/selftests/bpf so that tools/include/linux/types.h
is selected when building host binaries and
tools/include/uapi/linux/types.h is selected when building bpf binaries.

Verified by compiling bpftool and the bpf selftests on x86_64 with this
change.

Thanks for following up!

My only concern is that tools/include/uapi/ is also used at least by
perf and libperf, we need to double check that they are fine with this
as well.

Given this is needed for BPF target compilation only, one way to limit
the scope of this change would be to have a `#if defined(__bpf__)`
check and falling back to "normal" uapi/linux/types.h. Alternatively,
we could have a bpf-specific subdirectory and put this header into
tools/include/bpf/uapi/linux/types.h.

I don't have any strong preferences, whatever maintainers are happy with.

I would prefer to keep it generic if possible before we take measures of
making special cases for bpf in tools include infra. Compilation of perf
and libperf seems fine on my side as well, so I've applied it, thanks!



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux