Skip to content

Commit

Permalink
added Clang UBSan support
Browse files Browse the repository at this point in the history
 - allow to enable UBSan with the CONFIG+=ubsan config with qmake
 - added UBSan.supp config to suppress Qt's errors, can be enabled using
   the UBSAN_OPTIONS=suppressions=<path>/UBSan.supp env. variable
  • Loading branch information
silverqx committed May 28, 2022
1 parent 5f33a1f commit 6646909
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions qmake/unixconf.pri
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,24 @@ QMAKE_CXXFLAGS_WARN_ON *= \

# Clang 12 still doesn't support -Wstrict-null-sentinel
!clang: QMAKE_CXXFLAGS_WARN_ON *= -Wstrict-null-sentinel

# Allow to enable UBSan with Clang
clang:ubsan: {
QMAKE_CXXFLAGS += -O1

QMAKE_CXXFLAGS *= \
-fsanitize=undefined \
-fsanitize=nullability \
-fsanitize=float-divide-by-zero \
-fsanitize=unsigned-integer-overflow \
-fsanitize=implicit-conversion \
-fsanitize=local-bounds \

QMAKE_LFLAGS *= \
-fsanitize=undefined \
-fsanitize=nullability \
-fsanitize=float-divide-by-zero \
-fsanitize=unsigned-integer-overflow \
-fsanitize=implicit-conversion \
-fsanitize=local-bounds
}
2 changes: 2 additions & 0 deletions tools/configs/UBSan.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
implicit-integer-sign-change:qarraydata.h
unsigned-integer-overflow:qhashfunctions.h

0 comments on commit 6646909

Please sign in to comment.