You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cpu: disable IFUNC on GCC 4.8 if --coverage is used.
The offending flag is -fprofile-arcs and it's failing only on Ubuntu
20.04 with GCC 4.8, not with GCC 5 and not with GCC 4.8 on Arch. I
couldn't find any even vaguely related bugreport, so I suspect this has
something to with binutils or something else on that system. But since
GCC 5 works there, I don't see that much of a problem.
Unfortunately I also couldn't find any way to detect if such flag is
present, the predefined variables are exactly the same in both cases.
Which means this won't be able to detect if Corrade is built without
--coverage and then used in code that has --coverage enabled. But as I'm
probably the only person using --converage on GCC 4.8 (on the CI), I
don't think that's a problem either.
int foo() __attribute__((ifunc(\"fooDispatcher\")));
207
207
int main() { return foo() - 42; }\
208
208
" _CORRADE_CPU_CAN_USE_IFUNC)
209
+
# In cases where ifunc is known to be broken, disable it by default --
210
+
# users can still force it to be enabled, but the initial state should not
211
+
# cause crashes or other strange behavior.
212
+
if(_CORRADE_CPU_CAN_USE_IFUNC)
213
+
set(_CORRADE_CPU_USE_IFUNC_DEFAULT ON)
214
+
# On GCC 4.8, if --coverage or -fprofile-arcs is enabled, the ifunc
215
+
# dispatchers cause a segfault. On Ubuntu 20.04 at least. Not the case
216
+
# with GCC 5 there, not the case with GCC 4.8 on Arch. Can't find any
217
+
# upstream bug report or commit that would be related to this.
218
+
if(CMAKE_CXX_COMPILER_ID AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS"4.9"ANDCMAKE_CXX_FLAGSMATCHES"(--coverage|-fprofile-arcs)")
219
+
if(NOTDEFINED CORRADE_CPU_USE_IFUNC)
220
+
message(WARNING "Disabling CORRADE_CPU_USE_IFUNC by default as it may crash when used together with --coverage on GCC 4.8.")
221
+
endif()
222
+
set(_CORRADE_CPU_USE_IFUNC_DEFAULT OFF)
223
+
endif()
224
+
else()
225
+
set(_CORRADE_CPU_USE_IFUNC_DEFAULT OFF)
226
+
endif()
209
227
else()
210
228
set(_CORRADE_CPU_CAN_USE_IFUNC OFF)
229
+
set(_CORRADE_CPU_USE_IFUNC_DEFAULT OFF)
211
230
endif()
212
-
cmake_dependent_option(CORRADE_CPU_USE_IFUNC "Allow using GNU IFUNC for runtime CPU dispatch"ON"_CORRADE_CPU_CAN_USE_IFUNC"OFF)
231
+
cmake_dependent_option(CORRADE_CPU_USE_IFUNC "Allow using GNU IFUNC for runtime CPU dispatch"${_CORRADE_CPU_USE_IFUNC_DEFAULT}"_CORRADE_CPU_CAN_USE_IFUNC"OFF)
213
232
214
233
# Backwards compatibility for unprefixed CMake options. If the user isn't
215
234
# explicitly using prefixed options in the first run already, accept the
0 commit comments