This is an archive of the discontinued LLVM Phabricator instance.

Port msan_test.cc to NetBSD
ClosedPublic

Authored by krytarowski on May 10 2018, 12:11 PM.

Details

Summary

The changes allows building this file on NetBSD, mostly by
disabling the unsupported functions and adding OS-specific
system includes.

Sponsored by <The NetBSD Foundation>

Diff Detail

Repository
rL LLVM

Event Timeline

krytarowski created this revision.May 10 2018, 12:11 PM
vitalybuka accepted this revision.May 17 2018, 1:49 PM
vitalybuka added inline comments.
lib/msan/tests/msan_test.cc
3081

Could please make it:

#if defined(__FreeBSD__) 
// entire function
#elif defined(__NetBSD__)
// entire function
#elif defined(__GLIBC__)
// entire function
#else
# error "TODO: port this"
#endif
This revision is now accepted and ready to land.May 17 2018, 1:49 PM
krytarowski added inline comments.May 17 2018, 2:35 PM
lib/msan/tests/msan_test.cc
3081

There is an informal tradition to reuse the same code in FreeBSD and NetBSD, ifdefing only the MIB part.

krytarowski added inline comments.May 18 2018, 6:12 PM
lib/msan/tests/msan_test.cc
3081

For example here:

lib/sanitizer_common/sanitizer_linux.cc-#if SANITIZER_FREEBSD || SANITIZER_NETBSD
lib/sanitizer_common/sanitizer_linux.cc-#if SANITIZER_FREEBSD
lib/sanitizer_common/sanitizer_linux.cc:  const int Mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
lib/sanitizer_common/sanitizer_linux.cc-#else
lib/sanitizer_common/sanitizer_linux.cc:  const int Mib[4] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME};
lib/sanitizer_common/sanitizer_linux.cc-#endif

I will commit it as is, and on request change it to separated functions.

This revision was automatically updated to reflect the committed changes.