From 69a6939aef88288bdffec3cae5c248b7153666ea Mon Sep 17 00:00:00 2001 From: Renato Botelho do Couto Date: Tue, 10 Dec 2024 11:20:44 -0300 Subject: [PATCH] libxdp: fix build with clang 18 Use compiler to link. While here, retire LD from configure since this is not used anymore Signed-off-by: Renato Botelho do Couto --- configure | 4 +--- lib/libxdp/Makefile | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 66026284..ff9b9696 100755 --- a/configure +++ b/configure @@ -59,7 +59,6 @@ check_toolchain() : ${PKG_CONFIG:=pkg-config} : ${CC=gcc} - : ${LD=ld} : ${OBJCOPY=objcopy} : ${CLANG=clang} : ${LLC=llc} @@ -73,7 +72,7 @@ check_toolchain() CLANG=$(find_tool clang "$CLANG") LLC=$(find_tool llc "$LLC") - for TOOL in $PKG_CONFIG $CC $LD $OBJCOPY $CLANG $LLC $M4 $READELF; do + for TOOL in $PKG_CONFIG $CC $OBJCOPY $CLANG $LLC $M4 $READELF; do if [ ! $(command -v ${TOOL} 2>/dev/null) ]; then echo "*** ERROR: Cannot find tool ${TOOL}" ; exit 1; @@ -130,7 +129,6 @@ check_toolchain() echo "PKG_CONFIG:=${PKG_CONFIG}" >>$CONFIG echo "CC:=${CC}" >>$CONFIG - echo "LD:=${LD}" >>$CONFIG echo "OBJCOPY:=${OBJCOPY}" >>$CONFIG echo "CLANG:=${CLANG}" >>$CONFIG echo "LLC:=${LLC}" >>$CONFIG diff --git a/lib/libxdp/Makefile b/lib/libxdp/Makefile index 403d5a6e..e13743ce 100644 --- a/lib/libxdp/Makefile +++ b/lib/libxdp/Makefile @@ -131,7 +131,7 @@ $(TEMPLATED_SOURCES): %.c: %.c.in Makefile $(QUIET_M4)$(M4) $(DEFINES) $< > $@ || ( ret=$$?; rm -f $@; exit $$ret ) $(EMBEDDED_XDP_OBJS): %.embed.o: %.o - $(QUIET_GEN)$(LD) -r -b binary -o $@ -z noexecstack --format=binary $< + $(QUIET_CC)$(CC) -r -nostdlib -Wl,-z,noexecstack,--format=binary -o $@ $< $(Q)$(OBJCOPY) --rename-section .data=.rodata,alloc,load,readonly,data,contents $@ $(XDP_OBJS): %.o: %.c $(BPF_HEADERS) $(LIBMK)