Changeset 228134 in webkit


Ignore:
Timestamp:
Feb 5, 2018 3:23:28 PM (6 years ago)
Author:
Michael Catanzaro
Message:

[CMake] Add ENABLE_ADDRESS_SANITIZER to make it easier to build with asan support
https://bugs.webkit.org/show_bug.cgi?id=182400

Reviewed by Konstantin Tokarev.

  • Source/cmake/OptionsGTK.cmake:
  • Source/cmake/WebKitCompilerFlags.cmake:
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r227944 r228134  
     12018-02-05  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        [CMake] Add ENABLE_ADDRESS_SANITIZER to make it easier to build with asan support
     4        https://bugs.webkit.org/show_bug.cgi?id=182400
     5
     6        Reviewed by Konstantin Tokarev.
     7
     8        * Source/cmake/OptionsGTK.cmake:
     9        * Source/cmake/WebKitCompilerFlags.cmake:
     10
    1112018-01-31  Michael Catanzaro  <mcatanzaro@igalia.com>
    212
  • trunk/Source/cmake/OptionsGTK.cmake

    r227788 r228134  
    356356endif ()
    357357
     358# https://bugs.webkit.org/show_bug.cgi?id=182247
     359if (ENABLED_COMPILER_SANITIZERS)
     360    set(ENABLE_INTROSPECTION OFF)
     361endif ()
     362
    358363# Override the cached variables, gtk-doc and gobject-introspection do not really work when cross-building.
    359364if (CMAKE_CROSSCOMPILING)
  • trunk/Source/cmake/WebKitCompilerFlags.cmake

    r226945 r228134  
    156156endif ()
    157157
     158if (COMPILER_IS_GCC_OR_CLANG)
     159    # Careful: this needs to be above where ENABLED_COMPILER_SANITIZERS is set.
     160    # Also, it's not possible to use the normal prepend/append macros for
     161    # -fsanitize=address, because check_cxx_compiler_flag will report it's
     162    # unsupported, because it causes the build to fail if not used when linking.
     163    option(ENABLE_ADDRESS_SANITIZER "Enable address sanitizer" OFF)
     164    if (ENABLE_ADDRESS_SANITIZER)
     165        WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-fno-omit-frame-pointer
     166                                             -fno-optimize-sibling-calls)
     167        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
     168        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
     169        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_THREAD_LIBS_INIT} ${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
     170        set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_THREAD_LIBS_INIT} ${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
     171    endif ()
     172endif ()
    158173
    159174if (NOT MSVC)
Note: See TracChangeset for help on using the changeset viewer.