[libcxx-commits] [PATCH] D114377: [SystemZ][z/OS] Link library path in libc++ testing

Muiez Ahmed via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 22 09:33:45 PST 2021


muiez created this revision.
muiez added a reviewer: libc++.
Herald added a subscriber: arichardson.
muiez requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.

The functions `configure_link_flags_cxx_library_path` & `configure_link_flags_abi_library_path` are not handling the z/OS specific case correctly when a [cxx|abi]_runtime_root is specified to link. The options are not recognized on z/OS.

Hence, this patch adds a z/OS specific case (similar to the other platform-specific cases) but adds the library path using the `LIBPATH` env variable. In addition, (`add_path`) is modified to account for adding the LIBPATH env variable as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114377

Files:
  libcxx/utils/libcxx/test/config.py
  libcxx/utils/libcxx/test/target_info.py


Index: libcxx/utils/libcxx/test/target_info.py
===================================================================
--- libcxx/utils/libcxx/test/target_info.py
+++ libcxx/utils/libcxx/test/target_info.py
@@ -35,15 +35,16 @@
     def add_cxx_link_flags(self, flags): pass
     def allow_cxxabi_link(self): return True
 
-    def add_path(self, dest_env, new_path):
+    def add_path(self, dest_env, new_path, is_libpath=False):
+        env_var = 'LIBPATH' if is_libpath else 'PATH'
         if not new_path:
             return
-        if 'PATH' not in dest_env:
-            dest_env['PATH'] = new_path
+        if env_var not in dest_env:
+            dest_env[env_var] = new_path
         else:
             split_char = ';' if self.is_windows() else ':'
-            dest_env['PATH'] = '%s%s%s' % (new_path, split_char,
-                                           dest_env['PATH'])
+            dest_env[env_var] = '%s%s%s' % (new_path, split_char,
+                                           dest_env[env_var])
 
 
 class DarwinLocalTI(DefaultTargetInfo):
Index: libcxx/utils/libcxx/test/config.py
===================================================================
--- libcxx/utils/libcxx/test/config.py
+++ libcxx/utils/libcxx/test/config.py
@@ -370,7 +370,9 @@
             if self.target_info.is_windows() and self.link_shared:
                 self.add_path(self.cxx.compile_env, self.cxx_library_root)
         if self.cxx_runtime_root:
-            if not self.target_info.is_windows():
+            if self.target_info.is_zos():
+                self.add_path(self.exec_env, self.cxx_runtime_root, is_libpath=True)
+            elif not self.target_info.is_windows():
                 self.cxx.link_flags += ['-Wl,-rpath,' +
                                         self.cxx_runtime_root]
             elif self.target_info.is_windows() and self.link_shared:
@@ -384,7 +386,9 @@
         if self.abi_library_root:
             self.cxx.link_flags += ['-L' + self.abi_library_root]
         if self.abi_runtime_root:
-            if not self.target_info.is_windows():
+            if self.target_info.is_zos():
+                self.add_path(self.exec_env, self.abi_runtime_root, is_libpath=True)
+            elif not self.target_info.is_windows():
                 self.cxx.link_flags += ['-Wl,-rpath,' + self.abi_runtime_root]
             else:
                 self.add_path(self.exec_env, self.abi_runtime_root)
@@ -481,5 +485,5 @@
     def configure_env(self):
         self.config.environment = dict(os.environ)
 
-    def add_path(self, dest_env, new_path):
-        self.target_info.add_path(dest_env, new_path)
+    def add_path(self, dest_env, new_path, is_libpath=False):
+        self.target_info.add_path(dest_env, new_path, is_libpath)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114377.388949.patch
Type: text/x-patch
Size: 2764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211122/8b31e976/attachment.bin>


More information about the libcxx-commits mailing list