diff options
author | Konstantin Baladurin <k.baladurin@partner.samsung.com> | 2017-12-06 09:18:22 +0300 |
---|---|---|
committer | Konstantin Baladurin <k.baladurin@partner.samsung.com> | 2017-12-08 11:14:53 +0300 |
commit | 15df655ca41ee7e06d9e0ab7e35d0ca708a07c93 (patch) | |
tree | e20765c0004652562a9d3d3572de9d9ef3dc2cbd | |
parent | b9e2f8612cc34f8b34290ebb7e3c628664b8026f (diff) | |
download | launcher-15df655ca41ee7e06d9e0ab7e35d0ca708a07c93.tar.gz launcher-15df655ca41ee7e06d9e0ab7e35d0ca708a07c93.tar.bz2 launcher-15df655ca41ee7e06d9e0ab7e35d0ca708a07c93.zip |
Add option to enable clang Asan build.
Now we can add '--define "asan_enabled 1"' option for gbs to enable
Asan build.
Change-Id: Iac347386c26e3a72aa1275c312550df809aff003
-rw-r--r-- | NativeLauncher/CMakeLists.txt | 15 | ||||
-rw-r--r-- | packaging/dotnet-launcher.spec | 21 |
2 files changed, 32 insertions, 4 deletions
diff --git a/NativeLauncher/CMakeLists.txt b/NativeLauncher/CMakeLists.txt index 6d78c6f..166e542 100644 --- a/NativeLauncher/CMakeLists.txt +++ b/NativeLauncher/CMakeLists.txt @@ -52,14 +52,21 @@ IF(NOT_USE_FUNCTION) ENDIF(NOT_USE_FUNCTION) -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pthread -std=c++11 -Wl,--no-as-needed -ggdb") -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wl,-zdefs" ) +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pthread -std=c++11 -ggdb") #SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") #SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIE") -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fdata-sections -ffunction-sections -Wl,--gc-sections") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fdata-sections -ffunction-sections") SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -D_FILE_OFFSET_BITS=64") #SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DLAUNCHING_TIME_MEASURE") +IF(ASAN_ENABLED) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fno-omit-frame-pointer -fsanitize=address") +ELSE(ASAN_ENABLED) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wl,-zdefs") + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wl,--no-as-needed") + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wl,--gc-sections") +ENDIF(ASAN_ENABLED) + SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") SET(CMAKE_CXX_FLAGS_DEBUG "-O2 -g") SET(CMAKE_CXX_FLAGS_RELEASE "-O2") @@ -129,4 +136,4 @@ IF(NOT DEFINED NO_TIZEN) INSTALL(FILES dotnet.loader DESTINATION ${LOADERDIR}) INSTALL(FILES dotnet.launcher DESTINATION ${LOADERDIR}) INSTALL(FILES dotnet.debugger DESTINATION ${LOADERDIR}) -ENDIF(NOT DEFINED NO_TIZEN) +ENDIF(NOT DEFINED NO_TIZEN)
\ No newline at end of file diff --git a/packaging/dotnet-launcher.spec b/packaging/dotnet-launcher.spec index 369d243..66bb45d 100644 --- a/packaging/dotnet-launcher.spec +++ b/packaging/dotnet-launcher.spec @@ -20,6 +20,11 @@ BuildRequires: pkgconfig(glib-2.0) BuildRequires: aul-devel BuildRequires: dotnet-build-tools +%if 0%{?asan_enabled} +BuildRequires: clang >= 3.8 +BuildRequires: compiler-rt +%endif + Requires: aul Requires: launchpad @@ -52,8 +57,24 @@ Launchpad plugin for launching dotnet apps %endif %build + +%if 0%{?asan_enabled} +%define _dotnet_build_conf Debug +export CFLAGS=" --target=%{_host} " +export CXXFLAGS=" --target=%{_host} " +%ifarch %{ix86} +export CFLAGS=$(echo $CFLAGS | sed -e 's/--target=i686/--target=i586/') +export CXXFLAGS=$(echo $CXXFLAGS | sed -e 's/--target=i686/--target=i586/') +%endif +%endif + cmake \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ +%if 0%{?asan_enabled} + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DASAN_ENABLED=TRUE \ +%endif -DPACKAGE_NAME=%{name} \ -DLIBDIR=%{_libdir} \ -DBINDIR=%{_bindir} \ |