Skip to content

Commit c673cf6

Browse files
committed
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 <[email protected]>
1 parent c2eb81e commit c673cf6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

configure

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,18 @@ check_libxdp()
196196
LIBBPF_INCLUDE_DIR="$(readlink -m lib/install/include)" \
197197
LIBBPF_UNBUILT=1;
198198
cd lib/xdp-tools; ./configure)
199+
200+
# libxdp.a has to come before libbpf.a so the former can pick up symbols
201+
# from the latter
202+
sed -i 's/-l:libbpf.a/-l:libxdp.a -l:libbpf.a/' $CONFIG
199203
else
200204
echo "Configuring libxdp without our libbpf"
201205
(cd lib/xdp-tools; ./configure)
206+
207+
echo 'LDLIBS += -l:libxdp.a' >>$CONFIG
202208
fi
209+
203210
echo 'LDFLAGS += -L$(LIB_DIR)/install/lib' >>$CONFIG
204-
echo 'LDLIBS += -l:libxdp.a' >>$CONFIG
205211
echo 'OBJECT_LIBXDP = $(LIB_DIR)/install/lib/libxdp.a' >>$CONFIG
206212
if ! [ -d "lib/xdp-tools/lib" ] && [ -f ".gitmodules" ] && [ -e ".git" ]; then
207213
git submodule init && git submodule update

0 commit comments

Comments
 (0)