[PATCH] D38635: Add 'first link flags' for building tests

Brian Cain via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 6 09:43:21 PDT 2017


bcain created this revision.

In order to build test executables with a link line that explicitly includes init.o, fini.o, etc we need to have greater control over the order of the link args from the target_info class.


Repository:
  rL LLVM

https://reviews.llvm.org/D38635

Files:
  libcxx/utils/libcxx/compiler.py


Index: libcxx/utils/libcxx/compiler.py
===================================================================
--- libcxx/utils/libcxx/compiler.py
+++ libcxx/utils/libcxx/compiler.py
@@ -29,6 +29,7 @@
         self.flags = list(flags or [])
         self.compile_flags = list(compile_flags or [])
         self.link_flags = list(link_flags or [])
+        self.first_link_flags = []
         self.warning_flags = list(warning_flags or [])
         self.verify_supported = verify_supported
         self.use_verify = use_verify
@@ -99,13 +100,14 @@
         self.version = (major_ver, minor_ver, patchlevel)
 
     def _basicCmd(self, source_files, out, mode=CM_Default, flags=[],
-                  input_is_cxx=False):
+                  input_is_cxx=False, first_flags=[]):
         cmd = []
         if self.use_ccache \
                 and not mode == self.CM_Link \
                 and not mode == self.CM_PreProcess:
             cmd += ['ccache']
         cmd += [self.path]
+        cmd += first_flags
         if out is not None:
             cmd += ['-o', out]
         if input_is_cxx:
@@ -147,10 +149,12 @@
 
     def linkCmd(self, source_files, out=None, flags=[]):
         return self._basicCmd(source_files, out, flags=flags,
-                              mode=self.CM_Link)
+                              mode=self.CM_Link,
+                              first_flags=self.first_link_flags)
 
     def compileLinkCmd(self, source_files, out=None, flags=[]):
-        return self._basicCmd(source_files, out, flags=flags)
+        return self._basicCmd(source_files, out, flags=flags,
+                              first_flags=self.first_link_flags)
 
     def preprocess(self, source_files, out=None, flags=[], cwd=None):
         cmd = self.preprocessCmd(source_files, out, flags)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38635.118024.patch
Type: text/x-patch
Size: 1798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171006/03a3c09e/attachment.bin>


More information about the llvm-commits mailing list