When I use clang on Windows to compile a program using regular expressions to intermediate code, then run the result through llvm-link and finally try to generate an executable, I get an error. All of these ingredients are necessary; it works if the program doesn't use regular expressions, and it works if I compile it directly instead of going via intermediate code. The use of the exact llvm-link binary, however, is not a necessary ingredient; I get the same result with a linking program of my own that uses the same libraries as llvm-link. Minimal test case: C:\test>type test.cpp #include <regex> int main() { std::cmatch m; regex_match("a", m, std::regex("a")); return 0; } C:\test>clang-cl -Xclang -emit-llvm -c -fms-compatibility-version=19 test.cpp C:\test>move test.obj test.ll Overwrite C:\test\test.ll? (Yes/No/All): y 1 file(s) moved. C:\test>llvm-link test.ll -o=a.ll C:\test>clang-cl -Wno-override-module a.ll a-e22d14.obj : fatal error LNK1243: invalid or corrupt file: COMDAT section 0x373 associated with following section 0x389 clang-cl.exe: error: linker command failed with exit code 1243 (use -v to see invocation) C:\test>llvm-link -version LLVM (http://llvm.org/): LLVM version 3.7.0 DEBUG build. Default target: x86_64-pc-windows-msvc Host CPU: sandybridge -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150916/7ef97803/attachment.html>
That's pretty neat. Can you file a bug and attach a compressed version of a.ll? It looks like link.exe has interesting ordering constraints around associative COMDATs that we haven't run into before. On Wed, Sep 16, 2015 at 9:15 AM, Russell Wallace via llvm-dev < llvm-dev at lists.llvm.org> wrote:> When I use clang on Windows to compile a program using regular expressions > to intermediate code, then run the result through llvm-link and finally try > to generate an executable, I get an error. > > All of these ingredients are necessary; it works if the program doesn't > use regular expressions, and it works if I compile it directly instead of > going via intermediate code. > > The use of the exact llvm-link binary, however, is not a necessary > ingredient; I get the same result with a linking program of my own that > uses the same libraries as llvm-link. > > Minimal test case: > > C:\test>type test.cpp > #include <regex> > > int main() { > std::cmatch m; > regex_match("a", m, std::regex("a")); > return 0; > } > > C:\test>clang-cl -Xclang -emit-llvm -c -fms-compatibility-version=19 > test.cpp > > C:\test>move test.obj test.ll > Overwrite C:\test\test.ll? (Yes/No/All): y > 1 file(s) moved. > > C:\test>llvm-link test.ll -o=a.ll > > C:\test>clang-cl -Wno-override-module a.ll > a-e22d14.obj : fatal error LNK1243: invalid or corrupt file: COMDAT > section 0x373 associated with following section 0x389 > clang-cl.exe: error: linker command failed with exit code 1243 (use -v to > see invocation) > > C:\test>llvm-link -version > LLVM (http://llvm.org/): > LLVM version 3.7.0 > DEBUG build. > Default target: x86_64-pc-windows-msvc > Host CPU: sandybridge > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150916/8137e437/attachment.html>
Done. https://llvm.org/bugs/show_bug.cgi?id=24847 On Wed, Sep 16, 2015 at 6:26 PM, Reid Kleckner <rnk at google.com> wrote:> That's pretty neat. Can you file a bug and attach a compressed version of > a.ll? It looks like link.exe has interesting ordering constraints around > associative COMDATs that we haven't run into before. > > On Wed, Sep 16, 2015 at 9:15 AM, Russell Wallace via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> When I use clang on Windows to compile a program using regular >> expressions to intermediate code, then run the result through llvm-link and >> finally try to generate an executable, I get an error. >> >> All of these ingredients are necessary; it works if the program doesn't >> use regular expressions, and it works if I compile it directly instead of >> going via intermediate code. >> >> The use of the exact llvm-link binary, however, is not a necessary >> ingredient; I get the same result with a linking program of my own that >> uses the same libraries as llvm-link. >> >> Minimal test case: >> >> C:\test>type test.cpp >> #include <regex> >> >> int main() { >> std::cmatch m; >> regex_match("a", m, std::regex("a")); >> return 0; >> } >> >> C:\test>clang-cl -Xclang -emit-llvm -c -fms-compatibility-version=19 >> test.cpp >> >> C:\test>move test.obj test.ll >> Overwrite C:\test\test.ll? (Yes/No/All): y >> 1 file(s) moved. >> >> C:\test>llvm-link test.ll -o=a.ll >> >> C:\test>clang-cl -Wno-override-module a.ll >> a-e22d14.obj : fatal error LNK1243: invalid or corrupt file: COMDAT >> section 0x373 associated with following section 0x389 >> clang-cl.exe: error: linker command failed with exit code 1243 (use -v to >> see invocation) >> >> C:\test>llvm-link -version >> LLVM (http://llvm.org/): >> LLVM version 3.7.0 >> DEBUG build. >> Default target: x86_64-pc-windows-msvc >> Host CPU: sandybridge >> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150916/f72c76b9/attachment.html>