]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: version: report the presence of the compiler's address sanitizer
authorWilly Tarreau <w@1wt.eu>
Tue, 16 Jun 2020 17:14:19 +0000 (19:14 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 16 Jun 2020 17:14:19 +0000 (19:14 +0200)
Since we've seen clang emit bad code when the address sanitizer is enabled
at -O2, better clearly report it in the version output. It is detected both
for clang and gcc (both tested with and without).

src/version.c

index 135ff8d06005b99e0dcb8a29d4b523bc7d702fec..bf67efa763f2dbd9ff3d163f374c5db29fd9c29b 100644 (file)
@@ -14,8 +14,14 @@ char haproxy_version[]      = HAPROXY_VERSION;
 char haproxy_date[]         = HAPROXY_DATE;
 char stats_version_string[] = STATS_VERSION_STRING;
 
+#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
+#define SANITIZE_STRING " with address sanitizer"
+#else
+#define SANITIZE_STRING ""
+#endif
+
 #if defined(__clang_version__)
-REGISTER_BUILD_OPTS("Built with clang compiler version " __clang_version__);
+REGISTER_BUILD_OPTS("Built with clang compiler version " __clang_version__ "" SANITIZE_STRING);
 #elif defined(__VERSION__)
-REGISTER_BUILD_OPTS("Built with gcc compiler version " __VERSION__);
+REGISTER_BUILD_OPTS("Built with gcc compiler version " __VERSION__ "" SANITIZE_STRING);
 #endif