[m-rev.] diff (bdwgc): Disable AddressSanitizer instrumentation on some functions.

Peter Wang novalazy at gmail.com
Tue Oct 11 16:17:22 AEDT 2016


This will be needed if we add the --enable-sanitizers option.
---

mark.c:
    Disable AddressSanitizer instrumentation on two marking
    functions. This is enough for Mercury programs built with
    AddressSanitizer in hlc.gc grade to run.

    This change is specific to gcc. clang will require a different
    preprocessor condition and possibly a different attribute.
---
 mark.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mark.c b/mark.c
index 0c61add..259de9d 100644
--- a/mark.c
+++ b/mark.c
@@ -596,6 +596,10 @@ GC_INNER mse * GC_signal_mark_stack_overflow(mse *msp)
  * encoding, we optionally maintain a cache for the block address to
  * header mapping, we prefetch when an object is "grayed", etc.
  */
+/* Mercury-specific: */
+#ifdef __SANITIZE_ADDRESS__
+__attribute__((no_sanitize_address))
+#endif
 GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
                             mse *mark_stack_limit)
 {
@@ -1518,6 +1522,10 @@ void GC_print_trace(word gc_no)
  * and scans the entire region immediately, in case the contents
  * change.
  */
+/* Mercury-specific: */
+#ifdef __SANITIZE_ADDRESS__
+__attribute__((no_sanitize_address))
+#endif
 GC_API void GC_CALL GC_push_all_eager(char *bottom, char *top)
 {
     word * b = (word *)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1));
-- 
2.9.0



More information about the reviews mailing list