Skip to content

Commit 553c179

Browse files
committed
address comments
1 parent 725376b commit 553c179

File tree

3 files changed

+16
-29
lines changed

3 files changed

+16
-29
lines changed

compiler-rt/test/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
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

Lines changed: 5 additions & 22 deletions
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)
43

54

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,15 @@ endmacro()
3823

3924
set(PFP_TEST_ARCH ${PFP_SUPPORTED_ARCH})
4025

41-
4226
foreach(arch ${PFP_TEST_ARCH})
4327
if (arch STREQUAL ${X86_64})
44-
add_pfp_testsuite(${arch} False False False False)
28+
add_pfp_testsuite(${arch} False)
4529
endif()
4630
if (arch STREQUAL ${ARM64})
47-
add_pfp_testsuite(${arch} True True True True)
31+
add_pfp_testsuite(${arch} True)
4832
endif()
4933
endforeach()
5034

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

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,19 @@
2525

2626

2727
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"]
28+
clang_pfp_cxxflags = clang_pfp_cxxflags + ["-fuse-ld=lld --rtlib=compiler-rt --unwindlib=libunwind -static-libgcc"]
29+
3030

31+
def build_invocation(compile_flags, with_lto=False):
32+
lto_flags = []
33+
if with_lto and config.lto_supported:
34+
lto_flags += config.lto_flags
3135

32-
def build_invocation(compile_flags):
33-
return " " + " ".join([config.clang] + compile_flags) + " "
36+
return " " + " ".join([config.clang] + lto_flags + compile_flags) + " "
3437

3538

3639
config.substitutions.append(("%clangxx ", build_invocation(clang_cxxflags)))
37-
config.substitutions.append(("%clangxx_pfp ", build_invocation(clang_pfp_cxxflags)))
40+
if config.target_arch == 'aarch64':
41+
config.substitutions.append(("%clangxx_pfp ", build_invocation(clang_pfp_cxxflags, True)))
42+
else:
43+
config.substitutions.append(("%clangxx_pfp ", build_invocation(clang_pfp_cxxflags)))

0 commit comments

Comments
 (0)