<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.gmail-
        {mso-style-name:gmail-;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Calibri;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">Ah. lld-link actually only accepts link-style options, so it wouldn't solve<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">that particular problem. Happily, it seems like we aren't relying on ld-style<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">options to begin with.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:Calibri;color:black">From: </span>
</b><span style="font-family:Calibri;color:black">Eric Fiselier <eric@efcs.ca><br>
<b>Date: </b>Friday, January 13, 2017 at 5:52 PM<br>
<b>To: </b>Shoaib Meenai <smeenai@fb.com><br>
<b>Cc: </b>"cfe-commits@lists.llvm.org" <cfe-commits@lists.llvm.org><br>
<b>Subject: </b>Re: [libcxx] r291072 - Get test-suite configuring on Windows with clang-cl<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Thu, Jan 12, 2017 at 1:17 AM, Shoaib Meenai <<a href="mailto:smeenai@fb.com" target="_blank">smeenai@fb.com</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">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;<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Initially I thought it was required in order to avoid re-writing all of the linker flags.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">However that is probably incorrect, and having the extra dependency is annoying.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"> I've also found link to work fine in my testing.<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Awesome! I'll confirm and remove the dependency on lld.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><br>
<span class="gmail-">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.llvm.org</a> on behalf of
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:</span><br>
<br>
<span class="gmail-">    Author: ericwf</span><br>
<span class="gmail-">    Date: Wed Jan  4 21:57:40 2017</span><br>
<span class="gmail-">    New Revision: 291072</span><br>
<br>
    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=" target="_blank">
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=</a><br>
<span class="gmail-">    Log:</span><br>
<span class="gmail-">    Get test-suite configuring on Windows with clang-cl</span><br>
<br>
<span class="gmail-">    This patch gets the test suite "working" on Windows, although</span><br>
<span class="gmail-">    none of the tests pass.</span><br>
<br>
<span class="gmail-">    In order to reuse the existing configuration, which uses UNIX</span><br>
<span class="gmail-">    style flags not accepted by clang-cl, this patch only works with clang++.</span><br>
<span class="gmail-">    When clang-cl is specified the test harness secretly looks for</span><br>
<span class="gmail-">    clang++ and then it configures it using the INCLUDE and LIB enviroment</span><br>
<span class="gmail-">    variables.</span><br>
<br>
<span class="gmail-">    This is very much a work in progress.</span><br>
<br>
<span class="gmail-">    Modified:</span><br>
<span class="gmail-">        libcxx/trunk/test/libcxx/test/config.py</span><br>
<br>
<span class="gmail-">    Modified: libcxx/trunk/test/libcxx/test/config.py</span><br>
    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=" target="_blank">
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=</a><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">    ==============================================================================<br>
    --- libcxx/trunk/test/libcxx/test/config.py (original)<br>
    +++ libcxx/trunk/test/libcxx/test/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_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'])<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++)')<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_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=19.00',<br>
    +                 '--target=i686-unknown-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(';')<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.test_source_root))<br>
    @@ -400,7 +433,8 @@ class Configuration(object):<br>
<br>
         def configure_compile_flags_header_includes(self):<br>
             support_path = os.path.join(self.libcxx_src_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_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_ANNOTATIONS':<br>
    +                continue<br>
                 if m == '_LIBCPP_ABI_VERSION':<br>
                     self.config.available_features.add('libcpp-abi-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_library_path(self):<br>
             # Configure ABI library paths.<br>
             self.abi_library_root = self.get_lit_conf('abi_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_library(self):<br>
             libcxx_experimental = self.get_lit_bool('enable_experimental', default=False)<br>
    @@ -579,7 +616,10 @@ class Configuration(object):<br>
             else:<br>
                 cxx_library_root = self.get_lit_conf('cxx_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++')<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_library_path')<br>
                         if cxxabi_library_root:<br>
    -                        abs_path = os.path.join(cxxabi_library_root, 'libc++abi.a')<br>
    +                        libname = self.make_static_lib_name('c++abi')<br>
    +                        abs_path = os.path.join(cxxabi_library_root, libname)<br>
                             self.cxx.link_flags += [abs_path]<br>
                         else:<br>
                             self.cxx.link_flags += ['-lc++abi']<br>
<br>
<br>
    _______________________________________________<br>
    cfe-commits mailing list<br>
    <a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">    <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=" target="_blank">
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=</a><br>
<br>
<o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>