Commit fda684fb authored by Andrii Nakryiko's avatar Andrii Nakryiko

Merge branch 'samples: bpf: fix build issues with Clang/LLVM'

Alexander Lobakin says:

====================

Samples, at least XDP ones, can be built only with the compiler used
to build the kernel itself.
However, XDP sample infra introduced in Aug'21 was probably tested
with GCC/Binutils only as it's not really compilable for now with
Clang/LLVM.
These two are trivial fixes addressing this.
====================
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
parents 29f2e5bd 6f670d06
...@@ -215,6 +215,11 @@ TPROGS_LDFLAGS := -L$(SYSROOT)/usr/lib ...@@ -215,6 +215,11 @@ TPROGS_LDFLAGS := -L$(SYSROOT)/usr/lib
endif endif
TPROGS_LDLIBS += $(LIBBPF) -lelf -lz TPROGS_LDLIBS += $(LIBBPF) -lelf -lz
TPROGLDLIBS_xdp_monitor += -lm
TPROGLDLIBS_xdp_redirect += -lm
TPROGLDLIBS_xdp_redirect_cpu += -lm
TPROGLDLIBS_xdp_redirect_map += -lm
TPROGLDLIBS_xdp_redirect_map_multi += -lm
TPROGLDLIBS_tracex4 += -lrt TPROGLDLIBS_tracex4 += -lrt
TPROGLDLIBS_trace_output += -lrt TPROGLDLIBS_trace_output += -lrt
TPROGLDLIBS_map_perf_test += -lrt TPROGLDLIBS_map_perf_test += -lrt
...@@ -345,7 +350,7 @@ $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h ...@@ -345,7 +350,7 @@ $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h
# Override includes for xdp_sample_user.o because $(srctree)/usr/include in # Override includes for xdp_sample_user.o because $(srctree)/usr/include in
# TPROGS_CFLAGS causes conflicts # TPROGS_CFLAGS causes conflicts
XDP_SAMPLE_CFLAGS += -Wall -O2 -lm \ XDP_SAMPLE_CFLAGS += -Wall -O2 \
-I$(src)/../../tools/include \ -I$(src)/../../tools/include \
-I$(src)/../../tools/include/uapi \ -I$(src)/../../tools/include/uapi \
-I$(LIBBPF_INCLUDE) \ -I$(LIBBPF_INCLUDE) \
......
...@@ -45,7 +45,9 @@ const char *get_driver_name(int ifindex); ...@@ -45,7 +45,9 @@ const char *get_driver_name(int ifindex);
int get_mac_addr(int ifindex, void *mac_addr); int get_mac_addr(int ifindex, void *mac_addr);
#pragma GCC diagnostic push #pragma GCC diagnostic push
#ifndef __clang__
#pragma GCC diagnostic ignored "-Wstringop-truncation" #pragma GCC diagnostic ignored "-Wstringop-truncation"
#endif
__attribute__((unused)) __attribute__((unused))
static inline char *safe_strncpy(char *dst, const char *src, size_t size) static inline char *safe_strncpy(char *dst, const char *src, size_t size)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment