Merge pull request #25746 from savuor:rv/hwasan_flag_release

Android SDK build script: HWAsan flags added for release mode #25746

A quick fix for #25718

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Rostislav Vasilikhin 2024-06-18 17:15:41 +02:00 committed by GitHub
parent e3884a9ea8
commit 766f3f5fc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -267,10 +267,14 @@ class Builder:
cmake_vars['WITH_ANDROID_MEDIANDK'] = "OFF"
if self.hwasan and "arm64" in abi.name:
cmake_vars['OPENCV_ENABLE_MEMORY_SANITIZER'] = "ON"
hwasan_flags = "-fno-omit-frame-pointer -fsanitize=hwaddress"
cmake_vars['CMAKE_CXX_FLAGS_DEBUG'] = hwasan_flags
cmake_vars['CMAKE_C_FLAGS_DEBUG'] = hwasan_flags
cmake_vars['CMAKE_LINKER_FLAGS_DEBUG'] = hwasan_flags
for s in ['OPENCV_EXTRA_C_FLAGS', 'OPENCV_EXTRA_CXX_FLAGS', 'OPENCV_EXTRA_EXE_LINKER_FLAGS',
'OPENCV_EXTRA_SHARED_LINKER_FLAGS', 'OPENCV_EXTRA_MODULE_LINKER_FLAGS']:
if s in cmake_vars.keys():
cmake_vars[s] = cmake_vars[s] + ' ' + hwasan_flags
else:
cmake_vars[s] = hwasan_flags
cmake_vars.update(abi.cmake_vars)