3
다음 코드를 사용하여 -fsanitize = address이 clang 및 gcc의 컴파일 시간에 지정되었는지 확인합니다. -fsanitize = undefined이 지정되었는지 어떻게 결정합니까?clang 또는 gcc를 사용하여 UBSAN을 컴파일했는지 어떻게 알 수 있습니까?
bool isSanitized = false;
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
isSanitized = true;
#endif
#elif defined(__SANITIZE_ADDRESS__)
isSanitized = true;
#endif
이 항목을 확인하십시오. http://stackoverflow.com/questions/38719560/is-there-a-way-to-store-clang-compile-time-flags-in-the-output-binary – xhamr
That doesn ' ASAN 탐지와 동일한 방식으로 작동합니다. –