Index: lib/Transforms/Instrumentation/AddressSanitizer.cpp =================================================================== RCS file: /cvsroot/src/external/apache2/llvm/dist/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 AddressSanitizer.cpp --- lib/Transforms/Instrumentation/AddressSanitizer.cpp 8 Nov 2019 14:28:38 -0000 1.1.1.1 +++ lib/Transforms/Instrumentation/AddressSanitizer.cpp 22 Mar 2020 00:30:26 -0000 @@ -1859,6 +1859,15 @@ return false; } + // Do not instrument NetBSD and NetBSD-derived (such as rumpkernel) code + // sections dedicated for the __link_set API that expects consecutive + // array elements + if (Section.startswith("link_set")) { + LLVM_DEBUG(dbgs() << "Ignoring global in sorted section " + << "(starts with 'link_set'): " << *G << "\n"); + return false; + } + // On COFF, if the section name contains '$', it is highly likely that the // user is using section sorting to create an array of globals similar to // the way initialization callbacks are registered in .init_array and