[PATCH] LoongArch: Add standard search paths for 32-bit

mengqinggang mengqinggang@loongson.cn
Mon Aug 24 09:48:52 GMT 2026


Previously, add_system_dir added different paths depending on the ABI:
  ilp32d: /lib32
  ilp32s: /lib32/sf

Now, add_sysmtem_dir adds all of the following directories to standard
search path for both ilp32d ABI and ilp32s ABI:
  /lib
  /lib32
  /lib32/sf
  /lib64
  /lib64/sf

This change fixes elf/tst-ptrguard-static-dlopen on ilp32s ABI.
The test is a statically linked executable with dlopen
tst-ptrguard-static-dlopen-mod.so. Without this patch, the test fails
because it looks for ld.so in /lib32/sf, but the file is actually
in /lib32.
---
 sysdeps/unix/sysv/linux/loongarch/dl-cache.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/loongarch/dl-cache.h b/sysdeps/unix/sysv/linux/loongarch/dl-cache.h
index 955f0dc68f..e52c6e2090 100644
--- a/sysdeps/unix/sysv/linux/loongarch/dl-cache.h
+++ b/sysdeps/unix/sysv/linux/loongarch/dl-cache.h
@@ -33,6 +33,8 @@
    LoongArch, libraries can be found in paths ending in:
      - /lib64
      - /lib64/sf
+     - /lib32
+     - /lib32/sf
    so this will add all of those paths.  */
 
 #define add_system_dir(dir) 						\
@@ -41,6 +43,8 @@
       static const char* lib_dirs[] = {					\
 	"/lib64",							\
 	"/lib64/sf",							\
+	"/lib32",							\
+	"/lib32/sf",							\
 	NULL,								\
       };								\
       const size_t lib_len = sizeof ("/lib") - 1;			\
-- 
2.34.1



More information about the Libc-alpha mailing list