diff options
author | Jean-Philippe Brucker <jean-philippe@linaro.org> | 2021-12-16 16:38:40 +0000 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2021-12-16 12:15:05 -0800 |
commit | 4980beb4cda2bc413a3a044e1851b0daaf137bf6 (patch) | |
tree | ea2b7813ea156e16418e232ef23a098de68968e5 /tools/lib/bpf/Makefile | |
parent | bf1be903461a404a9d1c720b0872501ca35abc89 (diff) | |
download | linux-4980beb4cda2bc413a3a044e1851b0daaf137bf6.tar.gz linux-4980beb4cda2bc413a3a044e1851b0daaf137bf6.tar.bz2 linux-4980beb4cda2bc413a3a044e1851b0daaf137bf6.zip |
tools/libbpf: Enable cross-building with clang
Cross-building using clang requires passing the "-target" flag rather
than using the CROSS_COMPILE prefix. Makefile.include transforms
CROSS_COMPILE into CLANG_CROSS_FLAGS. Add them to the CFLAGS.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20211216163842.829836-4-jean-philippe@linaro.org
Diffstat (limited to 'tools/lib/bpf/Makefile')
-rw-r--r-- | tools/lib/bpf/Makefile | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index 5f7086fae31c..f947b61b2107 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile @@ -90,6 +90,7 @@ override CFLAGS += -Werror -Wall override CFLAGS += $(INCLUDES) override CFLAGS += -fvisibility=hidden override CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +override CFLAGS += $(CLANG_CROSS_FLAGS) # flags specific for shared library SHLIB_FLAGS := -DSHARED -fPIC @@ -162,7 +163,7 @@ $(BPF_HELPER_DEFS): $(srctree)/tools/include/uapi/linux/bpf.h $(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION) $(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN_SHARED) $(VERSION_SCRIPT) - $(QUIET_LINK)$(CC) $(LDFLAGS) \ + $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \ --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \ -Wl,--version-script=$(VERSION_SCRIPT) $< -lelf -lz -o $@ @ln -sf $(@F) $(OUTPUT)libbpf.so |