This is an archive of the discontinued LLVM Phabricator instance.

Enable LLVM asan support for NetBSD/amd64
ClosedPublic

Authored by krytarowski on Jul 3 2017, 11:06 AM.

Details

Summary

Enable LLVM asan sanitizer for NetBSD/amd64.

Don't generate -ldl for dlopen(3)-like functions on NetBSD.
These features are available in libc on NetBSD.

Sponsored by <The NetBSD Foundation>

Diff Detail

Repository
rL LLVM

Event Timeline

krytarowski created this revision.Jul 3 2017, 11:06 AM
$ cat /tmp/test.cpp                                                                                                                                                                  
#include <stdio.h>

int
main(int argc, char **argv)
{
        int *array = new int[100];
        delete [] array;
        return array[argc];
}
$ /usr/pkg/bin/clang++ -fsanitize=address test.cpp -g
$ ./a.out                                             
ASAN:DEADLYSIGNAL
=================================================================
==13051==ERROR: AddressSanitizer: SEGV on unknown address 0x1c2800000008 (pc 0x00000047db6a bp 0x7f7fff366770 sp 0x7f7fff366740 T0)
==13051==The signal is caused by a READ memory access.
    #0 0x47db69 in main /tmp/test.cpp:8:9
    #1 0x4095ea in ___start (/tmp/a.out+0x4095ea)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /tmp/test.cpp:8:9 in main
==13051==ABORTING
dim accepted this revision.Jul 3 2017, 1:21 PM

LGTM

This revision is now accepted and ready to land.Jul 3 2017, 1:21 PM
krytarowski closed this revision.Jul 4 2017, 12:56 PM