Register NetBSD/x86_64 in MemorySanitizer.cpp

Summary:
Reuse the Linux new mapping as it is.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, eugenis, vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D41022

llvm-svn: 320219
This commit is contained in:
Kamil Rytarowski 2017-12-09 00:32:09 +00:00
parent 9ecd493129
commit 3d3f91e832
1 changed files with 22 additions and 0 deletions

View File

@ -320,6 +320,14 @@ static const MemoryMapParams FreeBSD_X86_64_MemoryMapParams = {
0x380000000000, // OriginBase 0x380000000000, // OriginBase
}; };
// x86_64 NetBSD
static const MemoryMapParams NetBSD_X86_64_MemoryMapParams = {
0, // AndMask
0x500000000000, // XorMask
0, // ShadowBase
0x100000000000, // OriginBase
};
static const PlatformMemoryMapParams Linux_X86_MemoryMapParams = { static const PlatformMemoryMapParams Linux_X86_MemoryMapParams = {
&Linux_I386_MemoryMapParams, &Linux_I386_MemoryMapParams,
&Linux_X86_64_MemoryMapParams, &Linux_X86_64_MemoryMapParams,
@ -345,6 +353,11 @@ static const PlatformMemoryMapParams FreeBSD_X86_MemoryMapParams = {
&FreeBSD_X86_64_MemoryMapParams, &FreeBSD_X86_64_MemoryMapParams,
}; };
static const PlatformMemoryMapParams NetBSD_X86_MemoryMapParams = {
nullptr,
&NetBSD_X86_64_MemoryMapParams,
};
namespace { namespace {
/// \brief An instrumentation pass implementing detection of uninitialized /// \brief An instrumentation pass implementing detection of uninitialized
@ -577,6 +590,15 @@ bool MemorySanitizer::doInitialization(Module &M) {
report_fatal_error("unsupported architecture"); report_fatal_error("unsupported architecture");
} }
break; break;
case Triple::NetBSD:
switch (TargetTriple.getArch()) {
case Triple::x86_64:
MapParams = NetBSD_X86_MemoryMapParams.bits64;
break;
default:
report_fatal_error("unsupported architecture");
}
break;
case Triple::Linux: case Triple::Linux:
switch (TargetTriple.getArch()) { switch (TargetTriple.getArch()) {
case Triple::x86_64: case Triple::x86_64: