Skip to content

Commit

Permalink
ASAN builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Filippo Cremonese committed Feb 5, 2021
1 parent ed1ca2e commit 14e2c74
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 34 deletions.
1 change: 1 addition & 0 deletions .orchestra/config/components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ environment:
- "-C_INCLUDE_PATH": ""
- "-CPLUS_INCLUDE_PATH": ""
- "-OBJC_INCLUDE_PATH": ""
- ASAN_OPTIONS: detect_leaks=0

paths: #@ datavalue("paths", default={})
remote_base_urls: #@ datavalue("remote_base_urls")
Expand Down
7 changes: 4 additions & 3 deletions .orchestra/config/components/llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ builds:
#@ build_type = f_options["cmake_build_type"]
#@ cflags = f_options["extra_compiler_flags"]
#@ ndebug = f_options["ndebug"]
#@ asan = f_options["asan"]
(@= flavor @):
test: true
configure: #@ configure_llvm(cmake_build_type=build_type, cflags=cflags, additional_cmake_options=cmake_opts(), source_dir="$SOURCE_DIR")
configure: #@ configure_llvm(cmake_build_type=build_type, cflags=cflags, additional_cmake_options=cmake_opts(), source_dir="$SOURCE_DIR", use_asan=asan)
install: |
cd "$BUILD_DIR"
(@= ninja @) install
Expand All @@ -49,8 +50,8 @@ builds:
dependencies:
- host-libcxx
- libunwind
#@ if/end ndebug == False:
ndebug: false
ndebug: #@ ndebug
asan: #@ asan
#@ end
#@ end

Expand Down
5 changes: 4 additions & 1 deletion .orchestra/config/components/llvm_common.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#@yaml/text-templated-strings
---
#@ def _configure_llvm(cmake_build_type=mandatory, cflags=mandatory, additional_cmake_options=mandatory, source_dir="$SOURCE_DIR"):
#@ def _configure_llvm(cmake_build_type=mandatory, cflags=mandatory, additional_cmake_options=mandatory, source_dir="$SOURCE_DIR", use_asan=False):
- |
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR";
Expand All @@ -25,6 +25,9 @@
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF \
-DLLVM_ENABLE_Z3_SOLVER=OFF \
-DLLVM_INCLUDE_GO_TESTS=OFF \
(@ if use_asan: -@)
-DLLVM_USE_SANITIZER=Address \
(@ end -@)
(@= expand_args(additional_cmake_options) @) \
-Wno-dev
#@ end
Expand Down
5 changes: 3 additions & 2 deletions .orchestra/config/components/qemu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ builds:
#@ build_type = f_options["cmake_build_type"]
#@ cflags = f_options["extra_compiler_flags"]
#@ ndebug = f_options["ndebug"]
#@ asan = f_options["asan"]
(@= flavor @):
configure: |
mkdir -p "$BUILD_DIR"
Expand Down Expand Up @@ -47,8 +48,8 @@ builds:
dependencies:
- zlib
- glib
#@ if/end ndebug == False:
ndebug: false
ndebug: #@ ndebug
asan: #@ asan
#@ end
#@ end

Expand Down
2 changes: 1 addition & 1 deletion .orchestra/config/components/revng_distributable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ install: |
cat >> environment <<EOF
$(orchestra environment |
grep -E "^export (PATH|LIBGL_DRIVERS_PATH|PKG_CONFIG_PATH|QML2_IMPORT_PATH|QT_PLUGIN_PATH|PYTHONPATH|LIBRARY_PATH)")
grep -E "^export (PATH|LIBGL_DRIVERS_PATH|PKG_CONFIG_PATH|QML2_IMPORT_PATH|QT_PLUGIN_PATH|PYTHONPATH|LIBRARY_PATH|ASAN_OPTIONS)")
unset ORCHESTRA_DOTDIR
unset ORCHESTRA_ROOT
EOF
Expand Down
14 changes: 7 additions & 7 deletions .orchestra/config/components/revng_qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ build_dependencies:
- host-cxx-toolchain
- glibc
- qemu
- toolchain/x86-64/gcc
- toolchain/i386/gcc
- toolchain/arm/gcc
- toolchain/aarch64/gcc
- toolchain/s390x/gcc
- toolchain/mips/gcc
- toolchain/mipsel/gcc
- toolchain/x86-64/gcc@stage2
- toolchain/i386/gcc@stage2
- toolchain/arm/gcc@stage2
- toolchain/aarch64/gcc@stage2
- toolchain/s390x/gcc@stage2
- toolchain/mips/gcc@stage2
- toolchain/mipsel/gcc@stage2
#@ end

#@overlay/match by=overlay.all, expects=1
Expand Down
5 changes: 3 additions & 2 deletions .orchestra/config/components/ui/qt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ builds:
#@ for flavor, opts in qt_optimization_flavors.items():
#@ extra_qmake_options = opts["extra_qmake_options"]
#@ ndebug = opts["ndebug"]
#@ asan = opts["asan"]
(@= flavor @):
configure: |
extract.sh --into "$SOURCE_DIR" https://download.qt.io/official_releases/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz
Expand Down Expand Up @@ -151,8 +152,8 @@ builds:
build_dependencies:
- host-cxx-toolchain
- glibc
#@ if/end ndebug == False:
ndebug: false
ndebug: #@ ndebug
asan: #@ asan
#@ end

#@ end
Expand Down
6 changes: 4 additions & 2 deletions .orchestra/config/components/ui/qt_creator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ default_build: optimized
builds:
#@ for flavor, opts in qmake_optimization_flavors.items():
#@ extra_qmake_args = opts["extra_qmake_args"]
#@ ndebug = opts["ndebug"]
#@ asan = opts["asan"]
(@= flavor @):
configure: #@ configure_base(extra_qmake_args=extra_qmake_args)
install: |
Expand All @@ -58,8 +60,8 @@ builds:
build_dependencies:
- host-c-toolchain
- glibc
#@ if/end opts["ndebug"] == False:
ndebug: false
ndebug: #@ ndebug
asan: #@ asan
#@ end
#@ end

Expand Down
5 changes: 3 additions & 2 deletions .orchestra/config/lib/cmake.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@
#@ if/end build_dependencies:
build_dependencies: #@ build_dependencies

#@ if/end opts["ndebug"] == False:
ndebug: false
ndebug: #@ opts["ndebug"]

asan: #@ opts["asan"]

#@ if/end test:
test: #@ test
Expand Down
63 changes: 49 additions & 14 deletions .orchestra/config/lib/optimization_flavors.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ optimized(@= asan_s @):
cmake_build_type: Debug
extra_compiler_flags: -ggdb3 -O2 -fno-omit-frame-pointer (@= asan @)
ndebug: false
asan: #@ use_asan
debug(@= asan_s @):
cmake_build_type: Debug
extra_compiler_flags: -ggdb3 -O0 (@= asan @)
ndebug: false
asan: #@ use_asan
release(@= asan_s @):
cmake_build_type: Release
extra_compiler_flags: -ggdb3 -O2 (@= asan @)
ndebug: true
asan: #@ use_asan
#@ end

---
Expand All @@ -53,17 +56,19 @@ optimized(@= asan_s @):
cmake_build_type: Debug
extra_compiler_flags: -ggdb3 -O2 -fno-omit-frame-pointer (@= asan @)
ndebug: false
asan: #@ use_asan
debug(@= asan_s @):
cmake_build_type: Debug
extra_compiler_flags: -ggdb3 -O0 (@= asan @)
ndebug: false
asan: #@ use_asan
release(@= asan_s @):
cmake_build_type: Release
extra_compiler_flags: -ggdb3 -O2 (@= asan @)
ndebug: true
asan: #@ use_asan
#@ end

#@yaml/text-templated-strings
---
#@ def _typical_cmake_flavors(use_asan):
_: #@ template.replace(__typical_cmake_flavors(False))
Expand All @@ -76,44 +81,74 @@ _: #@ template.replace(__typical_cmake_flavors(True))
#@ return dict(_typical_cmake_flavors(use_asan))
#@ end

#@yaml/text-templated-strings
---
#@ def _qt_optimization_flavors():
debug:
extra_qmake_options: -debug QMAKE_CXXFLAGS+="-fno-omit-frame-pointer"
#@ def __qt_optimization_flavors(use_asan):
#@ asan="-sanitize address" if use_asan else ""
#@ asan_s="-asan" if use_asan else ""
debug(@= asan_s @):
extra_qmake_options: -debug QMAKE_CXXFLAGS+="-fno-omit-frame-pointer" (@= asan @)
ndebug: false
optimized:
extra_qmake_options: -debug QMAKE_CXXFLAGS+="-O2 -fno-omit-frame-pointer"
asan: #@ use_asan
optimized(@= asan_s @):
extra_qmake_options: -debug QMAKE_CXXFLAGS+="-O2 -fno-omit-frame-pointer" (@= asan @)
ndebug: false
release:
extra_qmake_options: -release
asan: #@ use_asan
release(@= asan_s @):
extra_qmake_options: -release (@= asan @)
ndebug: true
asan: #@ use_asan
#@ end

---
#@ def _qt_optimization_flavors(use_asan):
_: #@ template.replace(__qt_optimization_flavors(False))
#@ if/end use_asan:
_: #@ template.replace(__qt_optimization_flavors(True))
#@ end

#@ qt_optimization_flavors = dict(_qt_optimization_flavors())
#@ qt_optimization_flavors = dict(_qt_optimization_flavors(True))

#@yaml/text-templated-strings
---
#@ def _qmake_optimization_flavors():
debug:
#@ def __qmake_optimization_flavors(use_asan):
#@ asan_s="-asan" if use_asan else ""
debug(@= asan_s @):
extra_qmake_args:
- CONFIG+=debug
- CONFIG-=release
#@ if/end use_asan:
- CONFIG+="sanitizer sanitize_address"
- QMAKE_CXXFLAGS_DEBUG+="-ggdb3 -O0 -fno-omit-frame-pointer"
- QMAKE_LFLAGS+="-ggdb3 -O0"
ndebug: false
optimized:
asan: #@ use_asan
optimized(@= asan_s @):
extra_qmake_args:
- CONFIG+=debug
- CONFIG-=release
#@ if/end use_asan:
- CONFIG+="sanitizer sanitize_address"
- QMAKE_CXXFLAGS_DEBUG+="-ggdb3 -O2 -fno-omit-frame-pointer"
- QMAKE_LFLAGS+="-ggdb3 -O2"
ndebug: false
release:
asan: #@ use_asan
release(@= asan_s @):
extra_qmake_args:
- CONFIG+=release
#@ if/end use_asan:
- CONFIG+="sanitizer sanitize_address"
- QMAKE_CXXFLAGS_RELEASE+="-ggdb3 -O2"
- QMAKE_LFLAGS+="-ggdb3 -O2"
ndebug: true
asan: #@ use_asan
#@ end

---
#@ def _qmake_optimization_flavors(use_asan):
_: #@ template.replace(__qmake_optimization_flavors(False))
#@ if/end use_asan:
_: #@ template.replace(__qmake_optimization_flavors(True))
#@ end

#@ qmake_optimization_flavors = dict(_qmake_optimization_flavors())
#@ qmake_optimization_flavors = dict(_qmake_optimization_flavors(True))

0 comments on commit 14e2c74

Please sign in to comment.