File tree 7 files changed +25
-4
lines changed
7 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -363,8 +363,11 @@ append_list_if(COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG -fvisibility=hidden SANIT
363
363
if (NOT COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG)
364
364
append_list_if(COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG -fvisibility-inlines-hidden SANITIZER_COMMON_CFLAGS)
365
365
endif ()
366
- append_list_if(COMPILER_RT_HAS_FNO_LTO_FLAG -fno-lto SANITIZER_COMMON_CFLAGS)
367
-
366
+ if (NOT COMPILER_RT_ENABLE_LTO)
367
+ append_list_if(COMPILER_RT_HAS_FNO_LTO_FLAG -fno-lto SANITIZER_COMMON_CFLAGS)
368
+ append_list_if(COMPILER_RT_HAS_FNO_WPD_FLAG -fno-whole-program -vtables SANITIZER_COMMON_CFLAGS)
369
+ append_list_if(COMPILER_RT_HAS_FNO_VFE_FLAG -fno-virtual-function-elimination SANITIZER_COMMON_CFLAGS)
370
+ endif ()
368
371
# By default do not instrument or use profdata for compiler-rt.
369
372
if (NOT COMPILER_RT_ENABLE_PGO)
370
373
if (LLVM_PROFDATA_FILE AND COMPILER_RT_HAS_FNO_PROFILE_INSTR_USE_FLAG)
Original file line number Diff line number Diff line change @@ -178,8 +178,14 @@ function(add_compiler_rt_runtime name type)
178
178
# Until we support this some other way, build compiler-rt runtime without LTO
179
179
# to allow non-LTO projects to link with it. GPU targets can currently only be
180
180
# distributed as LLVM-IR and ignore this.
181
- if (COMPILER_RT_HAS_FNO_LTO_FLAG AND NOT COMPILER_RT_GPU_BUILD)
181
+ if (COMPILER_RT_HAS_FNO_LTO_FLAG AND NOT COMPILER_RT_GPU_BUILD OR NOT COMPILER_RT_ENABLE_LTO )
182
182
set (NO_LTO_FLAGS "-fno-lto" )
183
+ if (COMPILER_RT_HAS_FNO_WPD_FLAG)
184
+ list (APPEND NO_LTO_FLAGS "-fno-whole-program-vtables" )
185
+ endif ()
186
+ if (COMPILER_RT_HAS_FNO_VFE_FLAG)
187
+ list (APPEND NO_LTO_FLAGS "-fno-virtual-function-elimination" )
188
+ endif ()
183
189
else ()
184
190
set (NO_LTO_FLAGS "" )
185
191
endif ()
Original file line number Diff line number Diff line change @@ -17,7 +17,11 @@ function(check_section_exists section output)
17
17
if (CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_TARGET)
18
18
list (APPEND try_compile_flags "-target ${CMAKE_C_COMPILER_TARGET} " )
19
19
endif ()
20
- append_list_if(COMPILER_RT_HAS_FNO_LTO_FLAG -fno-lto try_compile_flags)
20
+ if (NOT COMPILER_RT_ENABLE_LTO)
21
+ append_list_if(COMPILER_RT_HAS_FNO_LTO_FLAG -fno-lto try_compile_flags)
22
+ append_list_if(COMPILER_RT_HAS_FNO_WPD_FLAG -fno-whole-program -vtables try_compile_flags)
23
+ append_list_if(COMPILER_RT_HAS_FNO_VFE_FLAG -fno-virtual-function-elimination try_compile_flags)
24
+ endif ()
21
25
if (NOT COMPILER_RT_ENABLE_PGO)
22
26
if (LLVM_PROFDATA_FILE AND COMPILER_RT_HAS_FNO_PROFILE_INSTR_USE_FLAG)
23
27
list (APPEND try_compile_flags "-fno-profile-instr-use" )
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ builtin_check_c_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_OMIT_FRAME_P
15
15
builtin_check_c_compiler_flag(-ffreestanding COMPILER_RT_HAS_FFREESTANDING_FLAG)
16
16
builtin_check_c_compiler_flag(-fxray-instrument COMPILER_RT_HAS_XRAY_COMPILER_FLAG)
17
17
builtin_check_c_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
18
+ builtin_check_c_compiler_flag(-fno-whole-program -vtables COMPILER_RT_HAS_FNO_WPD_FLAG)
19
+ builtin_check_c_compiler_flag(-fno-virtual-function-elimination COMPILER_RT_HAS_FNO_VFE_FLAG)
18
20
builtin_check_c_compiler_flag(-fno-profile-generate COMPILER_RT_HAS_FNO_PROFILE_GENERATE_FLAG)
19
21
builtin_check_c_compiler_flag(-fno-profile-instr-generate COMPILER_RT_HAS_FNO_PROFILE_INSTR_GENERATE_FLAG)
20
22
builtin_check_c_compiler_flag(-fno-profile-instr-use COMPILER_RT_HAS_FNO_PROFILE_INSTR_USE_FLAG)
Original file line number Diff line number Diff line change @@ -105,6 +105,8 @@ check_cxx_compiler_flag(-fno-rtti COMPILER_RT_HAS_FNO_RTTI_FLAG)
105
105
check_cxx_compiler_flag("-Werror -fno-function-sections" COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG)
106
106
check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
107
107
check_cxx_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
108
+ check_cxx_compiler_flag(-fno-whole-program -vtables COMPILER_RT_HAS_FNO_WPD_FLAG)
109
+ check_cxx_compiler_flag(-fno-virtual-function-elimination COMPILER_RT_HAS_FNO_VFE_FLAG)
108
110
check_cxx_compiler_flag(-fno-profile-generate COMPILER_RT_HAS_FNO_PROFILE_GENERATE_FLAG)
109
111
check_cxx_compiler_flag(-fno-profile-instr-generate COMPILER_RT_HAS_FNO_PROFILE_INSTR_GENERATE_FLAG)
110
112
check_cxx_compiler_flag(-fno-profile-instr-use COMPILER_RT_HAS_FNO_PROFILE_INSTR_USE_FLAG)
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ builtin_check_c_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG)
8
8
builtin_check_c_compiler_flag(-std=c11 COMPILER_RT_HAS_STD_C11_FLAG)
9
9
builtin_check_c_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC)
10
10
builtin_check_c_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
11
+ builtin_check_c_compiler_flag(-fno-whole-program -vtables COMPILER_RT_HAS_FNO_WPD_FLAG)
12
+ builtin_check_c_compiler_flag(-fno-virtual-function-elimination COMPILER_RT_HAS_FNO_VFE_FLAG)
11
13
builtin_check_c_compiler_flag(-fno-profile-generate COMPILER_RT_HAS_FNO_PROFILE_GENERATE_FLAG)
12
14
builtin_check_c_compiler_flag(-fno-profile-instr-generate COMPILER_RT_HAS_FNO_PROFILE_INSTR_GENERATE_FLAG)
13
15
builtin_check_c_compiler_flag(-fno-profile-instr-use COMPILER_RT_HAS_FNO_PROFILE_INSTR_USE_FLAG)
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ append_list_if(COMPILER_RT_HAS_WNO_PEDANTIC -Wno-pedantic SCUDO_CFLAGS)
23
23
24
24
# FIXME: find cleaner way to agree with GWPAsan flags
25
25
append_list_if(COMPILER_RT_HAS_FNO_LTO_FLAG -fno-lto SCUDO_CFLAGS)
26
+ append_list_if(COMPILER_RT_HAS_FNO_WPD_FLAG -fno-whole-program -vtables SCUDO_CFLAGS)
27
+ append_list_if(COMPILER_RT_HAS_FNO_VFE_FLAG -fno-virtual-function-elimination SCUDO_CFLAGS)
26
28
27
29
if (COMPILER_RT_DEBUG)
28
30
list (APPEND SCUDO_CFLAGS -O0 -DSCUDO_DEBUG=1 -DSCUDO_ENABLE_HOOKS=1)
You can’t perform that action at this time.
0 commit comments