Skip to content

Commit 858863e

Browse files
committed
address comments
1 parent 725376b commit 858863e

File tree

4 files changed

+18
-38
lines changed

4 files changed

+18
-38
lines changed

compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,6 @@ if (WIN32)
120120
set(ALL_ORC_SUPPORTED_ARCH ${X86_64})
121121
endif()
122122

123-
if (UNIX)
123+
if (OS_NAME MATCHES "Linux")
124124
set(ALL_PFP_SUPPORTED_ARCH ${X86_64} ${ARM64})
125125
endif()

compiler-rt/test/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS)
106106
# ShadowCallStack does not yet provide a runtime with compiler-rt, the tests
107107
# include their own minimal runtime
108108
add_subdirectory(shadowcallstack)
109-
# PointerFieldProtection does not yet provide a runtime with compiler-rt, the tests
110-
# include their own minimal runtime
111109
add_subdirectory(pfp)
112110
endif()
113111

compiler-rt/test/pfp/CMakeLists.txt

+6-27
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,19 @@
11
set(PFP_TESTSUITES)
2-
set(PFP_TEST_DEPS
3-
${SANITIZER_COMMON_LIT_TEST_DEPS})
2+
set(PFP_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} unwind lld compiler-rt)
3+
set(PFP_TEST_USE_LLD True)
44

5-
6-
macro(add_pfp_testsuite arch lld thinlto compilerrt libunwind)
5+
macro(add_pfp_testsuite arch thinlto)
76
set(PFP_TEST_TARGET_ARCH ${arch})
87
get_test_cc_for_arch(${arch} PFP_TEST_TARGET_CC PFP_TEST_TARGET_CFLAGS)
98

109
string(TOUPPER ${arch} CONFIG_NAME)
1110

1211
if (${thinlto})
12+
set(PFP_TEST_USE_THINLTO ${thinlto})
1313
set(CONFIG_NAME "thinlto-${CONFIG_NAME}")
1414
list(APPEND PFP_TEST_DEPS LTO)
15-
endif()
16-
if (${libunwind})
17-
set(CONFIG_NAME "libunwind-${CONFIG_NAME}")
18-
list(APPEND PFP_TEST_DEPS unwind)
19-
endif()
20-
if (${lld})
21-
set(CONFIG_NAME "lld-${CONFIG_NAME}")
22-
if (TARGET lld)
23-
list(APPEND PFP_TEST_DEPS lld)
24-
endif()
25-
endif()
26-
if (${compilerrt})
27-
set(CONFIG_NAME "compiler-rt-${CONFIG_NAME}")
28-
list(APPEND PFP_TEST_DEPS compiler-rt)
2915
endif()
3016
set(PFP_TEST_USE_THINLTO ${thinlto})
31-
set(PFP_TEST_USE_LLD ${lld})
3217

3318
configure_lit_site_cfg(
3419
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
@@ -38,17 +23,11 @@ endmacro()
3823

3924
set(PFP_TEST_ARCH ${PFP_SUPPORTED_ARCH})
4025

41-
4226
foreach(arch ${PFP_TEST_ARCH})
43-
if (arch STREQUAL ${X86_64})
44-
add_pfp_testsuite(${arch} False False False False)
45-
endif()
46-
if (arch STREQUAL ${ARM64})
47-
add_pfp_testsuite(${arch} True True True True)
48-
endif()
27+
add_pfp_testsuite(${arch} False)
28+
add_pfp_testsuite(${arch} True)
4929
endforeach()
5030

51-
message(STATUS "PFP tests. " "Arch: ${PFP_TEST_ARCH} Deps: ${PFP_TEST_DEPS}")
5231
add_lit_testsuite(check-pfp "Running the PointerFieldProtection tests"
5332
${PFP_TESTSUITES}
5433
DEPENDS ${PFP_TEST_DEPS})

compiler-rt/test/pfp/lit.cfg.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
# Default test suffixes.
1212
config.suffixes = [".c", ".cpp"]
1313

14-
if config.host_os not in ["Linux"]:
15-
config.unsupported = True
16-
1714
# Setup source root.
1815
config.test_source_root = os.path.dirname(__file__)
1916
# Setup default compiler flags used with -fsanitize=memory option.
@@ -25,13 +22,19 @@
2522

2623

2724
clang_pfp_cxxflags = config.cxx_mode_flags + clang_pfp_tagged_common_cflags
28-
if config.target_arch == 'aarch64':
29-
clang_pfp_cxxflags = clang_pfp_cxxflags + ["-fuse-ld=lld --rtlib=compiler-rt --unwindlib=libunwind -static-libgcc"]
25+
clang_pfp_cxxflags = clang_pfp_cxxflags + ["-fuse-ld=lld --rtlib=compiler-rt --unwindlib=libunwind -static-libgcc"]
3026

3127

32-
def build_invocation(compile_flags):
33-
return " " + " ".join([config.clang] + compile_flags) + " "
28+
def build_invocation(compile_flags, with_lto=False):
29+
lto_flags = []
30+
if with_lto and config.lto_supported:
31+
lto_flags += config.lto_flags
32+
33+
return " " + " ".join([config.clang] + lto_flags + compile_flags) + " "
3434

3535

3636
config.substitutions.append(("%clangxx ", build_invocation(clang_cxxflags)))
37-
config.substitutions.append(("%clangxx_pfp ", build_invocation(clang_pfp_cxxflags)))
37+
if config.target_arch == 'aarch64':
38+
config.substitutions.append(("%clangxx_pfp ", build_invocation(clang_pfp_cxxflags, True)))
39+
else:
40+
config.substitutions.append(("%clangxx_pfp ", build_invocation(clang_pfp_cxxflags)))

0 commit comments

Comments
 (0)