<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 12, 2017 at 1:17 AM, Shoaib Meenai <span dir="ltr"><<a href="mailto:smeenai@fb.com" target="_blank">smeenai@fb.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">What was the rationale for forcing the use of lld? Were errors encountered<br>
with link? It's slightly annoying to have the extra dependency;</blockquote><div><br></div><div><br></div><div>Initially I thought it was required in order to avoid re-writing all of the linker flags.</div><div>However that is probably incorrect, and having the extra dependency is annoying.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> I've also found link to work fine in my testing.<br></blockquote><div><br></div><div>Awesome! I'll confirm and remove the dependency on lld.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="gmail-"><br>
On 1/4/17, 7:57 PM, "cfe-commits on behalf of Eric Fiselier via cfe-commits" <<a href="mailto:cfe-commits-bounces@lists.llvm.org">cfe-commits-bounces@lists.<wbr>llvm.org</a> on behalf of <a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
<br>
    Author: ericwf<br>
    Date: Wed Jan  4 21:57:40 2017<br>
    New Revision: 291072<br>
<br>
</span>    URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D291072-26view-3Drev&d=DgIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=jS0vP-p0BnF2TFo1eVjVMYDQAs59MFAk7Df_s6nplms&s=cUS_8mdoEB_rXOeiVb12wPPxI4SMXpq9A_cY9hOGe2g&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=http-3A__llvm.<wbr>org_viewvc_llvm-2Dproject-<wbr>3Frev-3D291072-26view-3Drev&d=<wbr>DgIGaQ&c=<wbr>5VD0RTtNlTh3ycd41b3MUw&r=<wbr>o3kDXzdBUE3ljQXKeTWOMw&m=<wbr>jS0vP-<wbr>p0BnF2TFo1eVjVMYDQAs59MFAk7Df_<wbr>s6nplms&s=cUS_8mdoEB_<wbr>rXOeiVb12wPPxI4SMXpq9A_<wbr>cY9hOGe2g&e=</a><br>
<span class="gmail-">    Log:<br>
    Get test-suite configuring on Windows with clang-cl<br>
<br>
    This patch gets the test suite "working" on Windows, although<br>
    none of the tests pass.<br>
<br>
    In order to reuse the existing configuration, which uses UNIX<br>
    style flags not accepted by clang-cl, this patch only works with clang++.<br>
    When clang-cl is specified the test harness secretly looks for<br>
    clang++ and then it configures it using the INCLUDE and LIB enviroment<br>
    variables.<br>
<br>
    This is very much a work in progress.<br>
<br>
    Modified:<br>
        libcxx/trunk/test/libcxx/test/<wbr>config.py<br>
<br>
    Modified: libcxx/trunk/test/libcxx/test/<wbr>config.py<br>
</span>    URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_libcxx_trunk_test_libcxx_test_config.py-3Frev-3D291072-26r1-3D291071-26r2-3D291072-26view-3Ddiff&d=DgIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=jS0vP-p0BnF2TFo1eVjVMYDQAs59MFAk7Df_s6nplms&s=VifHtrNoBswm5JlmYYAj81SdYnWxg3XJxLzZsaw9vrs&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=http-3A__llvm.<wbr>org_viewvc_llvm-2Dproject_<wbr>libcxx_trunk_test_libcxx_test_<wbr>config.py-3Frev-3D291072-26r1-<wbr>3D291071-26r2-3D291072-26view-<wbr>3Ddiff&d=DgIGaQ&c=<wbr>5VD0RTtNlTh3ycd41b3MUw&r=<wbr>o3kDXzdBUE3ljQXKeTWOMw&m=<wbr>jS0vP-<wbr>p0BnF2TFo1eVjVMYDQAs59MFAk7Df_<wbr>s6nplms&s=<wbr>VifHtrNoBswm5JlmYYAj81SdYnWxg3<wbr>XJxLzZsaw9vrs&e=</a><br>
<div><div class="gmail-h5">    ==============================<wbr>==============================<wbr>==================<br>
    --- libcxx/trunk/test/libcxx/test/<wbr>config.py (original)<br>
    +++ libcxx/trunk/test/libcxx/test/<wbr>config.py Wed Jan  4 21:57:40 2017<br>
    @@ -57,7 +57,9 @@ class Configuration(object):<br>
         def __init__(self, lit_config, config):<br>
             self.lit_config = lit_config<br>
             self.config = config<br>
    +        self.is_windows = platform.system() == 'Windows'<br>
             self.cxx = None<br>
    +        self.cxx_is_clang_cl = None<br>
             self.cxx_stdlib_under_test = None<br>
             self.project_obj_root = None<br>
             self.libcxx_src_root = None<br>
    @@ -95,6 +97,13 @@ class Configuration(object):<br>
             self.lit_config.fatal(<br>
                 "parameter '{}' should be true or false".format(name))<br>
<br>
    +    def make_static_lib_name(self, name):<br>
    +        """Return the full filename for the specified library name"""<br>
    +        if self.is_windows:<br>
    +            return name + '.lib'<br>
    +        else:<br>
    +            return 'lib' + name + '.a'<br>
    +<br>
         def configure(self):<br>
             self.configure_executor()<br>
             self.configure_target_info()<br>
    @@ -171,20 +180,25 @@ class Configuration(object):<br>
         def configure_cxx(self):<br>
             # Gather various compiler parameters.<br>
             cxx = self.get_lit_conf('cxx_under_<wbr>test')<br>
    -<br>
    +        self.cxx_is_clang_cl = cxx is not None and \<br>
    +                               os.path.basename(cxx) == 'clang-cl.exe'<br>
             # If no specific cxx_under_test was given, attempt to infer it as<br>
             # clang++.<br>
    -        if cxx is None:<br>
    +        if cxx is None or self.cxx_is_clang_cl:<br>
                 clangxx = lit.util.which('clang++',<br>
                                          self.config.environment['PATH'<wbr>])<br>
                 if clangxx:<br>
                     cxx = clangxx<br>
                     self.lit_config.note(<br>
                         "inferred cxx_under_test as: %r" % cxx)<br>
    +            elif self.cxx_is_clang_cl:<br>
    +                self.lit_config.fatal('Failed to find clang++ substitution for'<br>
    +                                      ' clang-cl')<br>
             if not cxx:<br>
                 self.lit_config.fatal('must specify user parameter cxx_under_test '<br>
                                       '(e.g., --param=cxx_under_test=clang++<wbr>)')<br>
    -        self.cxx = CXXCompiler(cxx)<br>
    +        self.cxx = CXXCompiler(cxx) if not self.cxx_is_clang_cl else \<br>
    +                   self._configure_clang_cl(cxx)<br>
             cxx_type = self.cxx.type<br>
             if cxx_type is not None:<br>
                 assert self.cxx.version is not None<br>
    @@ -194,6 +208,25 @@ class Configuration(object):<br>
                 self.config.available_<wbr>features.add('%s-%s.%s' % (<br>
                     cxx_type, maj_v, min_v))<br>
<br>
    +    def _configure_clang_cl(self, clang_path):<br>
    +        assert self.cxx_is_clang_cl<br>
    +        # FIXME: don't hardcode the target<br>
    +        flags = ['-fms-compatibility-version=<wbr>19.00',<br>
    +                 '--target=i686-unknown-<wbr>windows']<br>
    +        compile_flags = []<br>
    +        link_flags = ['-fuse-ld=lld']<br>
    +        if 'INCLUDE' in os.environ:<br>
    +            compile_flags += ['-isystem %s' % p.strip()<br>
    +                              for p in os.environ['INCLUDE'].split(';<wbr>')<br>
    +                              if p.strip()]<br>
    +        if 'LIB' in os.environ:<br>
    +            link_flags += ['-L%s' % p.strip()<br>
    +                           for p in os.environ['LIB'].split(';') if p.strip()]<br>
    +        return CXXCompiler(clang_path, flags=flags,<br>
    +                           compile_flags=compile_flags,<br>
    +                           link_flags=link_flags)<br>
    +<br>
    +<br>
         def configure_src_root(self):<br>
             self.libcxx_src_root = self.get_lit_conf(<br>
                 'libcxx_src_root', os.path.dirname(self.config.<wbr>test_source_root))<br>
    @@ -400,7 +433,8 @@ class Configuration(object):<br>
<br>
         def configure_compile_flags_<wbr>header_includes(self):<br>
             support_path = os.path.join(self.libcxx_src_<wbr>root, 'test/support')<br>
    -        if self.cxx_stdlib_under_test != 'libstdc++':<br>
    +        if self.cxx_stdlib_under_test != 'libstdc++' and \<br>
    +           not self.is_windows:<br>
                 self.cxx.compile_flags += [<br>
                     '-include', os.path.join(support_path, 'nasty_macros.hpp')]<br>
             self.configure_config_site_<wbr>header()<br>
    @@ -459,6 +493,8 @@ class Configuration(object):<br>
             # Transform each macro name into the feature name used in the tests.<br>
             # Ex. _LIBCPP_HAS_NO_THREADS -> libcpp-has-no-threads<br>
             for m in feature_macros:<br>
    +            if m == '_LIBCPP_DISABLE_VISIBILITY_<wbr>ANNOTATIONS':<br>
    +                continue<br>
                 if m == '_LIBCPP_ABI_VERSION':<br>
                     self.config.available_<wbr>features.add('libcpp-abi-<wbr>version-v%s'<br>
                         % feature_macros[m])<br>
    @@ -558,15 +594,16 @@ class Configuration(object):<br>
             if not self.use_system_cxx_lib:<br>
                 if self.cxx_library_root:<br>
                     self.cxx.link_flags += ['-L' + self.cxx_library_root]<br>
    -            if self.cxx_runtime_root:<br>
    +            if self.cxx_runtime_root and not self.is_windows:<br>
                     self.cxx.link_flags += ['-Wl,-rpath,' + self.cxx_runtime_root]<br>
<br>
         def configure_link_flags_abi_<wbr>library_path(self):<br>
             # Configure ABI library paths.<br>
             self.abi_library_root = self.get_lit_conf('abi_<wbr>library_path')<br>
             if self.abi_library_root:<br>
    -            self.cxx.link_flags += ['-L' + self.abi_library_root,<br>
    -                                    '-Wl,-rpath,' + self.abi_library_root]<br>
    +            self.cxx.link_flags += ['-L' + self.abi_library_root]<br>
    +            if not self.is_windows:<br>
    +                self.cxx.link_flags += ['-Wl,-rpath,' + self.abi_library_root]<br>
<br>
         def configure_link_flags_cxx_<wbr>library(self):<br>
             libcxx_experimental = self.get_lit_bool('enable_<wbr>experimental', default=False)<br>
    @@ -579,7 +616,10 @@ class Configuration(object):<br>
             else:<br>
                 cxx_library_root = self.get_lit_conf('cxx_<wbr>library_root')<br>
                 if cxx_library_root:<br>
    -                abs_path = os.path.join(cxx_library_root, 'libc++.a')<br>
    +                libname = self.make_static_lib_name('c++<wbr>')<br>
    +                abs_path = os.path.join(cxx_library_root, libname)<br>
    +                assert os.path.exists(abs_path) and \<br>
    +                       "static libc++ library does not exist"<br>
                     self.cxx.link_flags += [abs_path]<br>
                 else:<br>
                     self.cxx.link_flags += ['-lc++']<br>
    @@ -598,7 +638,8 @@ class Configuration(object):<br>
                     else:<br>
                         cxxabi_library_root = self.get_lit_conf('abi_<wbr>library_path')<br>
                         if cxxabi_library_root:<br>
    -                        abs_path = os.path.join(cxxabi_library_<wbr>root, 'libc++abi.a')<br>
    +                        libname = self.make_static_lib_name('c++<wbr>abi')<br>
    +                        abs_path = os.path.join(cxxabi_library_<wbr>root, libname)<br>
                             self.cxx.link_flags += [abs_path]<br>
                         else:<br>
                             self.cxx.link_flags += ['-lc++abi']<br>
<br>
<br>
    ______________________________<wbr>_________________<br>
    cfe-commits mailing list<br>
    <a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
</div></div>    <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits&d=DgIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=jS0vP-p0BnF2TFo1eVjVMYDQAs59MFAk7Df_s6nplms&s=0bJPrzT8cGOR-4NThzsZY0hJjgj8ZN6uI7u17ZnekqY&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=http-3A__lists.<wbr>llvm.org_cgi-2Dbin_mailman_<wbr>listinfo_cfe-2Dcommits&d=<wbr>DgIGaQ&c=<wbr>5VD0RTtNlTh3ycd41b3MUw&r=<wbr>o3kDXzdBUE3ljQXKeTWOMw&m=<wbr>jS0vP-<wbr>p0BnF2TFo1eVjVMYDQAs59MFAk7Df_<wbr>s6nplms&s=0bJPrzT8cGOR-<wbr>4NThzsZY0hJjgj8ZN6uI7u17ZnekqY<wbr>&e=</a><br>
<br>
<br>
</blockquote></div><br></div></div>