[builtins] Get the builtins tests passing on Windows
authorReid Kleckner <rnk@google.com>
Fri, 7 Apr 2017 16:35:09 +0000 (16:35 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 7 Apr 2017 16:35:09 +0000 (16:35 +0000)
commit8c78ca2e8f14ba15dbfcee13259806fff0649735
treed87d25aa957f4ade3edb875383977416508c9212
parent478b81982f3457c47ab02e4fee3fbd880eb88d3a
[builtins] Get the builtins tests passing on Windows

Many things were broken:

- We stopped building most builtins on Windows in r261432 for reasons
  that are not at all clear to me. This essentially reverts that patch.

- Fix %librt to expand to clang_rt.builtins-$arch.lib on Windows instead
  of libclang_rt.builtins-$arch.a.

- Fix memory protection tests (trampoline, enable executable, clear
  cache) on Windows. One issue was that the MSVC incremental linker
  generates ILT thunks for functions with external linkage, so memcpying
  the functions into the executable stack buffer wasn't working. You
  can't memcpy an RIP-relative jump without fixing up the offset.

- Disable tests that rely on C99 complex library functions when using
  the MSVC CRT, which isn't compatible with clang's C99 _Complex.

In theory, these could all be separate patches, but it would not green
the tests, so let's try for it all at once. Hopefully this fixes the
clang-x64-ninja-win7 bot.

llvm-svn: 299780
14 files changed:
compiler-rt/lib/builtins/CMakeLists.txt
compiler-rt/test/builtins/CMakeLists.txt
compiler-rt/test/builtins/Unit/clear_cache_test.c
compiler-rt/test/builtins/Unit/divdc3_test.c
compiler-rt/test/builtins/Unit/divsc3_test.c
compiler-rt/test/builtins/Unit/divtc3_test.c
compiler-rt/test/builtins/Unit/divxc3_test.c
compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
compiler-rt/test/builtins/Unit/lit.cfg
compiler-rt/test/builtins/Unit/lit.site.cfg.in
compiler-rt/test/builtins/Unit/muldc3_test.c
compiler-rt/test/builtins/Unit/mulsc3_test.c
compiler-rt/test/builtins/Unit/mulxc3_test.c
compiler-rt/test/builtins/Unit/trampoline_setup_test.c