Skip to content

Commit 6c1c11b

Browse files
Do no consider warnings fatal in CPU Jitter for LTO build (#2769)
At the moment, CPU Jitter source code needs to disable all optimizations. This means we can't inherit FORTITY_SOURCE and we therefore undefine the flag through U_FORTIFY_SOURCE. If one were to use annobin as a plugin and, simultaneously use LTO, annobin will emit a warning if FORTIFY_SOURCE is undefined. This is fatal if all warnings are treated as errors. The correct signal to use for below is annobin. But since we know that annobin is not necessarily being enabled through -fplugin, match with LTO and disable turning warnings into errors. This is also kinda fragile; LTO could be defined through other means similar to annobin. But it's what we have to work with atm.
1 parent 2900818 commit 6c1c11b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

third_party/jitterentropy/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ else()
3232
# https://gcc.gnu.org/wiki/NewWconversion.
3333
set(JITTER_COMPILE_FLAGS "${JITTER_COMPILE_FLAGS} -Wconversion")
3434
endif()
35+
36+
# See t/P319995887.
37+
# At the moment, CPU Jitter source code needs to disable all optimizations.
38+
# This means we can't inherit FORTITY_SOURCE and we therefore undefine
39+
# the flag through U_FORTIFY_SOURCE. If one were to use annobin as a plugin
40+
# and, simultaneously use LTO, annobin will emit a warning if FORTIFY_SOURCE
41+
# is undefined. This is fatal if all warnings are treated as errors.
42+
#
43+
# The correct signal to use for below is annobin. But since we know that
44+
# annobin is not necessarily being enabled through -fplugin, match with LTO
45+
# and disable turning warnings into errors. This is also kinda fragile; LTO
46+
# could be defined through other means similar to annobin. But it's what we
47+
# have to work with atm.
48+
if ("lto" MATCHES "${CMAKE_CFLAGS}")
49+
set(JITTER_COMPILE_FLAGS "${JITTER_COMPILE_FLAGS} -Wno-error")
50+
endif()
3551
endif()
3652

3753
if(BORINGSSL_PREFIX)

0 commit comments

Comments
 (0)