linux-stable/tools/bpf/resolve_btfids
Viktor Malik 6860a1ac54 tools/resolve_btfids: Fix setting HOSTCFLAGS
[ Upstream commit edd75c8028 ]

Building BPF selftests with custom HOSTCFLAGS yields an error:

    # make HOSTCFLAGS="-O2"
    [...]
      HOSTCC  ./tools/testing/selftests/bpf/tools/build/resolve_btfids/main.o
    main.c:73:10: fatal error: linux/rbtree.h: No such file or directory
       73 | #include <linux/rbtree.h>
          |          ^~~~~~~~~~~~~~~~

The reason is that tools/bpf/resolve_btfids/Makefile passes header
include paths by extending HOSTCFLAGS which is overridden by setting
HOSTCFLAGS in the make command (because of Makefile rules [1]).

This patch fixes the above problem by passing the include paths via
`HOSTCFLAGS_resolve_btfids` which is used by tools/build/Build.include
and can be combined with overridding HOSTCFLAGS.

[1] https://www.gnu.org/software/make/manual/html_node/Overriding.html

Fixes: 56a2df7615 ("tools/resolve_btfids: Compile resolve_btfids as host program")
Signed-off-by: Viktor Malik <vmalik@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20230530123352.1308488-1-vmalik@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-19 16:35:26 +02:00
..
.gitignore tools/resolve_btfids: Add /libsubcmd to .gitignore 2023-03-06 16:23:01 +01:00
Build tools/resolve_btfids: Compile resolve_btfids as host program 2023-02-07 22:47:16 +01:00
Makefile tools/resolve_btfids: Fix setting HOSTCFLAGS 2023-07-19 16:35:26 +02:00
main.c ELF: fix all "Elf" typos 2023-04-08 13:45:37 -07:00