[llvm] f882f8c - [AIX] use LIBPATH on AIX instead of LD_LIBRARY_PATH (#94602)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 08:50:02 PDT 2024


Author: Chen Zheng
Date: 2024-06-06T11:49:58-04:00
New Revision: f882f8c293d2064619f7eb3dc716dcaf3e2da875

URL: https://github.com/llvm/llvm-project/commit/f882f8c293d2064619f7eb3dc716dcaf3e2da875
DIFF: https://github.com/llvm/llvm-project/commit/f882f8c293d2064619f7eb3dc716dcaf3e2da875.diff

LOG: [AIX] use LIBPATH on AIX instead of LD_LIBRARY_PATH (#94602)

LD_LIBRARY_PATH will become invalid when LIBPATH is also set on AIX.

See below example on AIX:
```
$ldd a.out
a.out needs:
	 /usr/lib/libc.a(shr.o)
Cannot find libtest.a
	 /unix
	 /usr/lib/libcrypt.a(shr.o)

$./a.out
Could not load program ./a.out:
	Dependent module libtest.a could not be loaded.
Could not load module libtest.a.
System error: No such file or directory

$export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp
$./a.out ; echo $?
10

$export LIBPATH=./
$./a.out ; echo $?  >>>>>> Now LD_LIBRARY_PATH is not used by system loader
Could not load program ./a.out:
	Dependent module libtest.a could not be loaded.
Could not load module libtest.a.
System error: No such file or directory
```

This breaks many AIX LIT cases on our downstream buildbots which sets
LIBPATH.

---------

Co-authored-by: Anh Tuyen Tran <34661776+anhtuyenibm at users.noreply.github.com>
Co-authored-by: David Tenty <daltenty.dev at gmail.com>

Added: 
    

Modified: 
    llvm/utils/lit/lit/llvm/config.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index 1d4babc99984b..afb7f078072fc 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -588,7 +588,10 @@ def use_clang(
             if getattr(self.config, pp, None)
         ]
 
-        self.with_environment("LD_LIBRARY_PATH", lib_paths, append_path=True)
+        if platform.system() == "AIX":
+            self.with_environment("LIBPATH", lib_paths, append_path=True)
+        else:
+            self.with_environment("LD_LIBRARY_PATH", lib_paths, append_path=True)
 
         shl = getattr(self.config, "llvm_shlib_dir", None)
         pext = getattr(self.config, "llvm_plugin_ext", None)


        


More information about the llvm-commits mailing list