Mir

Merge lp:~albaguirre/mir/add-ubsan-build-type into lp:mir

Proposed by Alberto Aguirre
Status: Merged
Approved by: Alexandros Frantzis
Approved revision: no longer in the source branch.
Merged at revision: 3161
Proposed branch: lp:~albaguirre/mir/add-ubsan-build-type
Merge into: lp:mir
Diff against target: 18 lines (+8/-0)
1 file modified
CMakeLists.txt (+8/-0)
To merge this branch: bzr merge lp:~albaguirre/mir/add-ubsan-build-type
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alexandros Frantzis (community) Approve
Alan Griffiths Approve
Review via email: mp+279213@code.launchpad.net

Commit message

Add UBSan build type.

Invoke with -DCMAKE_BUILD_TYPE=ubsanitizer

Description of the change

Add UBSan build type.

Invoke with -DCMAKE_BUILD_TYPE=ubsanitizer

Adds support to create builds with the Undefined Behavior sanitizer (UBSan, -fsanitize=undefined) enabled.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

+ # Skip vptr checks, there seems to be missing RTTI information when linking with UBSan enabled

This is probably something we can fix. Logged as lp:1521930

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

CI network failure.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-10-16 06:12:44 +0000
3+++ CMakeLists.txt 2015-12-02 00:07:27 +0000
4@@ -107,6 +107,14 @@
5 endif()
6 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=thread")
7 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=thread")
8+elseif(cmake_build_type_lower MATCHES "ubsanitizer")
9+ # Skip vptr checks, there seems to be missing RTTI information when linking with UBSan enabled
10+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize=vptr -fno-omit-frame-pointer")
11+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize=vptr -fno-omit-frame-pointer")
12+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=undefined -fno-sanitize=vptr")
13+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=undefined -fno-sanitize=vptr")
14+ # "Symbol already defined" errors occur with pre-compiled headers
15+ SET(MIR_USE_PRECOMPILED_HEADERS OFF CACHE BOOL "Use precompiled headers" FORCE)
16 else()
17 # AddressSanitizer builds fail if we disallow undefined symbols
18 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")

Subscribers

People subscribed via source and target branches