From 30339c14a147cf1737fab3dc5e3af71b9101267e Mon Sep 17 00:00:00 2001 From: Vincent Li Date: Tue, 17 Dec 2024 19:24:52 -0800 Subject: [PATCH] toolchain: fix gcc custom linker path Loongarch64 requires gcc/config/loongarch/gnu-user.h change for custom linker path when compiling gcc tool chain fix: https://github.com/vincentmli/BPFire/issues/67 Signed-off-by: Vincent Li --- lfs/gcc | 4 ++++ lfs/glibc | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lfs/gcc b/lfs/gcc index 9abf0ee71..96508e5c4 100644 --- a/lfs/gcc +++ b/lfs/gcc @@ -231,6 +231,10 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) ifeq "$(TOOLCHAIN)" "1" +#loongarch64 +ifeq "$(BUILD_ARCH)" "loongarch64" + sed -i.orig '/ABI_GRLEN_SPEC/s@"/lib" ABI_GRLEN_SPEC@"$(TOOLS_DIR)/lib" ABI_GRLEN_SPEC@g' $(DIR_APP)/gcc/config/loongarch/gnu-user.h +endif for file in $$(find $(DIR_APP)/gcc/config -name linux64.h -o -name linux.h \ -o -name sysv4.h -o -name linux-eabi.h -o -name linux-elf.h -o -name aarch64-linux.h); do \ echo "Processing $${file}..."; \ diff --git a/lfs/glibc b/lfs/glibc index 703f2b94e..829171bb0 100644 --- a/lfs/glibc +++ b/lfs/glibc @@ -157,8 +157,7 @@ ifeq "$(TOOLCHAIN)" "1" cd $(DIR_APP) && $(CROSSTARGET)-gcc dummy.c -o dummy # Must be using a runtime linker from $(TOOLS_DIR) - #cd $(DIR_APP) && readelf -l dummy | grep "Requesting program interpreter: $(TOOLS_DIR)" - cd $(DIR_APP) && readelf -l dummy | grep "Requesting program interpreter: /lib64/ld-linux-loongarch-lp64d.so.1" + cd $(DIR_APP) && readelf -l dummy | grep "Requesting program interpreter: $(TOOLS_DIR)" cd $(DIR_APP) && rm -vf dummy dummy.c endif