[OS-BUILD PATCHv2 1/2] tools/resolve_btfids: Fix setting HOSTCFLAGS

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

 



From: Viktor Malik <vmalik@xxxxxxxxxx>

tools/resolve_btfids: Fix setting HOSTCFLAGS

commit edd75c802855271c8610f58a2fc9e54aefc49ce5
Author: Viktor Malik <vmalik@xxxxxxxxxx>
Date:   Tue May 30 14:33:52 2023 +0200

    tools/resolve_btfids: Fix setting HOSTCFLAGS

    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: 56a2df7615fa ("tools/resolve_btfids: Compile resolve_btfids as host program")
    Signed-off-by: Viktor Malik <vmalik@xxxxxxxxxx>
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20230530123352.1308488-1-vmalik@xxxxxxxxxx

Signed-off-by: Viktor Malik <vmalik@xxxxxxxxxx>

diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
index blahblah..blahblah 100644
--- a/tools/bpf/resolve_btfids/Makefile
+++ b/tools/bpf/resolve_btfids/Makefile
@@ -67,7 +67,7 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU
 LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null)
 LIBELF_LIBS  := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf)
 
-HOSTCFLAGS += -g \
+HOSTCFLAGS_resolve_btfids += -g \
           -I$(srctree)/tools/include \
           -I$(srctree)/tools/include/uapi \
           -I$(LIBBPF_INCLUDE) \
@@ -76,7 +76,7 @@ HOSTCFLAGS += -g \
 
 LIBS = $(LIBELF_LIBS) -lz
 
-export srctree OUTPUT HOSTCFLAGS Q HOSTCC HOSTLD HOSTAR
+export srctree OUTPUT HOSTCFLAGS_resolve_btfids Q HOSTCC HOSTLD HOSTAR
 include $(srctree)/tools/build/Makefile.include
 
 $(BINARY_IN): fixdep FORCE prepare | $(OUTPUT)

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2490
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux