configure: Make sure libxdp is before libbpf in linker arguments

When libxdp is linked against the submodule libbpf, the order of linker
arguments is important because libxdp.a needs symbols from libbpf.a. Fix up
configure so it ensures this.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
This commit is contained in:
Toke Høiland-Jørgensen
2022-04-27 00:43:02 +02:00
parent c2eb81ec70
commit c673cf628f

8
configure vendored
View File

@@ -196,12 +196,18 @@ check_libxdp()
LIBBPF_INCLUDE_DIR="$(readlink -m lib/install/include)" \
LIBBPF_UNBUILT=1;
cd lib/xdp-tools; ./configure)
# libxdp.a has to come before libbpf.a so the former can pick up symbols
# from the latter
sed -i 's/-l:libbpf.a/-l:libxdp.a -l:libbpf.a/' $CONFIG
else
echo "Configuring libxdp without our libbpf"
(cd lib/xdp-tools; ./configure)
echo 'LDLIBS += -l:libxdp.a' >>$CONFIG
fi
echo 'LDFLAGS += -L$(LIB_DIR)/install/lib' >>$CONFIG
echo 'LDLIBS += -l:libxdp.a' >>$CONFIG
echo 'OBJECT_LIBXDP = $(LIB_DIR)/install/lib/libxdp.a' >>$CONFIG
if ! [ -d "lib/xdp-tools/lib" ] && [ -f ".gitmodules" ] && [ -e ".git" ]; then
git submodule init && git submodule update