test: filter out -fPIE/-pie on Windows

Use some new substitutions to avoid duplicating the tests for just
dropped flags.  -fPIC/-fPIE/-fpic/-fpie do not make sense on Windows as
they can cause ELF-style PIC.  Substitute away the flag on Windows.
This should repair the windows buildbots.

llvm-svn: 290571
This commit is contained in:
Saleem Abdulrasool 2016-12-27 03:16:20 +00:00
parent 62c8b81ea8
commit c1861d86e1
3 changed files with 11 additions and 2 deletions

View File

@ -3,7 +3,7 @@
// RUN: not %run %t 2>&1 | FileCheck %s
// Sanity checking a test in pure C with -pie.
// RUN: %clang_asan -O2 %s -pie -fPIE -o %t
// RUN: %clang_asan -O2 %s %pie %fPIE -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// REQUIRES: stable-runtime

View File

@ -1,4 +1,4 @@
// RUN: %clangxx_asan -O0 -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_asan -O0 -DSHARED_LIB %s %fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_asan -O0 %s -o %t %ld_flags_rpath_exe
// Check that without suppressions, we catch the issue.

View File

@ -229,6 +229,15 @@ config.suffixes = ['.c', '.cc', '.cpp']
if config.host_os == 'Darwin':
config.suffixes.append('.mm')
if config.host_os == 'Windows':
config.substitutions.append(('%fPIC', ''))
config.substitutions.append(('%fPIE', ''))
config.substitutions.append(('%pie', ''))
else:
config.substitutions.append(('%fPIC', '-fPIC'))
config.substitutions.append(('%fPIE', '-fPIE'))
config.substitutions.append(('%pie', '-pie'))
# Only run the tests on supported OSs.
if config.host_os not in ['Linux', 'Darwin', 'FreeBSD', 'Windows']:
config.unsupported = True