Skip to content

Commit 9263f54

Browse files
tianxfacebook-github-bot
authored andcommitted
Fix build issues with gcc5.x
Summary: Fixing the following issues when building with gcc5.x: - TSAN: no longer requires to be built with -pie. Based on google/sanitizers#503 - UBSAN: gcc5 introduced a new vptr santizer in UBSAN, which will generate some false alarms about "undefined reference" during linking. Suppressing vptr sanitizer. - Valgrind: Added new suppression rules - ASAN: (suppression added in tools) Reviewed By: gunnarku Differential Revision: D5039367 fbshipit-source-id: 00ab2ca
1 parent 9779883 commit 9263f54

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

Diff for: CMakeLists.txt

+12-2
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,12 @@ IF(WITH_FB_TSAN)
295295
# 2. We need to pass in both flags for the MY_CHECK_* function to succeed.
296296
# 3. Eventually -fPIC will be duplicated on the command-line, but that's OK.
297297
#
298-
MY_SANITIZER_CHECK("-fsanitize=thread -fPIC -pie" WITH_FB_TSAN_OK)
298+
IF (CMAKE_C_COMPILER_ID MATCHES "GNU" AND
299+
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
300+
MY_SANITIZER_CHECK("-fsanitize=thread -fPIC -pie" WITH_FB_TSAN_OK)
301+
ELSE()
302+
MY_SANITIZER_CHECK("-fsanitize=thread -fPIC" WITH_FB_TSAN_OK)
303+
ENDIF()
299304
IF(NOT WITH_FB_TSAN_OK)
300305
MESSAGE(FATAL_ERROR
301306
"Do not know how to enable internal thread sanitizer (TSan).")
@@ -319,7 +324,12 @@ ENDIF()
319324

320325
OPTION(WITH_UBSAN "Enable undefined behavior sanitizer" OFF)
321326
IF(WITH_UBSAN)
322-
MY_SANITIZER_CHECK("-fsanitize=undefined" WITH_UBSAN_OK)
327+
IF (CMAKE_C_COMPILER_ID MATCHES "GNU" AND
328+
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
329+
MY_SANITIZER_CHECK("-fsanitize=undefined" WITH_UBSAN_OK)
330+
ELSE()
331+
MY_SANITIZER_CHECK("-fsanitize=undefined -fno-sanitize=vptr" WITH_UBSAN_OK)
332+
ENDIF()
323333
IF(NOT WITH_UBSAN_OK)
324334
MESSAGE(FATAL_ERROR
325335
"Do not know how to enable undefined behavior sanitizer (UBSan).")

Diff for: mysql-test/valgrind.supp

+21
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,16 @@
314314
fun:_dl_init
315315
}
316316

317+
{
318+
_dl_init/malloc loss record
319+
Memcheck:Leak
320+
match-leak-kinds: reachable
321+
fun:malloc
322+
...
323+
fun:_dl_init
324+
...
325+
}
326+
317327
{
318328
init invalid write8
319329
Memcheck:Addr8
@@ -1100,6 +1110,17 @@
11001110
fun:main
11011111
}
11021112

1113+
{
1114+
TLS data on main thread is not cleaned up properly
1115+
Memcheck:Leak
1116+
match-leak-kinds: reachable
1117+
fun:calloc
1118+
...
1119+
fun:err_get_state
1120+
...
1121+
fun:main
1122+
}
1123+
11031124
{
11041125
TLS data on main thread is not cleaned up properly
11051126
Memcheck:Leak

0 commit comments

Comments
 (0)