Title: [233157] trunk/Source/WTF
- Revision
- 233157
- Author
- ab...@igalia.com
- Date
- 2018-06-25 10:58:55 -0700 (Mon, 25 Jun 2018)
Log Message
Fix ASAN_ENABLED in GCC
https://bugs.webkit.org/show_bug.cgi?id=186957
Reviewed by Michael Catanzaro.
ASAN_ENABLED used to rely on Clang-specific features for detection.
This patch enables ASAN_ENABLED to work on GCC too.
It also fixes compilation errors and warnings that were triggered when
compiling code guarded by ASAN_ENABLED in gcc.
* wtf/Compiler.h:
* wtf/Vector.h:
(WTF::VectorBuffer::endOfBuffer):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (233156 => 233157)
--- trunk/Source/WTF/ChangeLog 2018-06-25 17:42:03 UTC (rev 233156)
+++ trunk/Source/WTF/ChangeLog 2018-06-25 17:58:55 UTC (rev 233157)
@@ -1,3 +1,20 @@
+2018-06-25 Alicia Boya GarcĂa <ab...@igalia.com>
+
+ Fix ASAN_ENABLED in GCC
+ https://bugs.webkit.org/show_bug.cgi?id=186957
+
+ Reviewed by Michael Catanzaro.
+
+ ASAN_ENABLED used to rely on Clang-specific features for detection.
+ This patch enables ASAN_ENABLED to work on GCC too.
+
+ It also fixes compilation errors and warnings that were triggered when
+ compiling code guarded by ASAN_ENABLED in gcc.
+
+ * wtf/Compiler.h:
+ * wtf/Vector.h:
+ (WTF::VectorBuffer::endOfBuffer):
+
2018-06-22 Darin Adler <da...@apple.com>
[Cocoa] Convert the small bit of Objective-C++ code in WTF to ARC
Modified: trunk/Source/WTF/wtf/Compiler.h (233156 => 233157)
--- trunk/Source/WTF/wtf/Compiler.h 2018-06-25 17:42:03 UTC (rev 233156)
+++ trunk/Source/WTF/wtf/Compiler.h 2018-06-25 17:58:55 UTC (rev 233157)
@@ -145,7 +145,11 @@
/* ASAN_ENABLED and SUPPRESS_ASAN */
+#ifdef __SANITIZE_ADDRESS__
+#define ASAN_ENABLED 1
+#else
#define ASAN_ENABLED COMPILER_HAS_CLANG_FEATURE(address_sanitizer)
+#endif
#if ASAN_ENABLED
#define SUPPRESS_ASAN __attribute__((no_sanitize_address))
@@ -157,7 +161,9 @@
/* ALWAYS_INLINE */
-#if !defined(ALWAYS_INLINE) && COMPILER(GCC_OR_CLANG) && defined(NDEBUG) && !COMPILER(MINGW)
+/* In GCC functions marked with no_sanitize_address cannot call functions that are marked with always_inline and not marked with no_sanitize_address.
+ * Therefore we need to give up on the enforcement of ALWAYS_INLINE when bulding with ASAN. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 */
+#if !defined(ALWAYS_INLINE) && COMPILER(GCC_OR_CLANG) && defined(NDEBUG) && !COMPILER(MINGW) && !(COMPILER(GCC) && ASAN_ENABLED)
#define ALWAYS_INLINE inline __attribute__((__always_inline__))
#endif
Modified: trunk/Source/WTF/wtf/Vector.h (233156 => 233157)
--- trunk/Source/WTF/wtf/Vector.h 2018-06-25 17:42:03 UTC (rev 233156)
+++ trunk/Source/WTF/wtf/Vector.h 2018-06-25 17:58:55 UTC (rev 233157)
@@ -528,7 +528,15 @@
void* endOfBuffer()
{
ASSERT(buffer());
+
+#if COMPILER(GCC)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Winvalid-offsetof"
+#endif
static_assert((offsetof(VectorBuffer, m_inlineBuffer) + sizeof(m_inlineBuffer)) % 8 == 0, "Inline buffer end needs to be on 8 byte boundary for ASan annotations to work.");
+#if COMPILER(GCC)
+#pragma GCC diagnostic pop
+#endif
if (buffer() == inlineBuffer())
return reinterpret_cast<char*>(m_inlineBuffer) + sizeof(m_inlineBuffer);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes