diff --git a/lib/Target/ARM/ARMSubtarget.cpp b/lib/Target/ARM/ARMSubtarget.cpp index e804de5c903..a240d1916f4 100644 --- a/lib/Target/ARM/ARMSubtarget.cpp +++ b/lib/Target/ARM/ARMSubtarget.cpp @@ -237,9 +237,10 @@ void ARMSubtarget::resetSubtargetFeatures(StringRef CPU, StringRef FS) { // Linux targets support unaligned accesses. The same goes for NaCl. // // The above behavior is consistent with GCC. - AllowsUnalignedMem = ( - (hasV7Ops() && (isTargetLinux() || isTargetNaCl())) || - (hasV6Ops() && isTargetMachO())); + AllowsUnalignedMem = + (hasV7Ops() && (isTargetLinux() || isTargetNaCl() || + isTargetNetBSD())) || + (hasV6Ops() && (isTargetMachO() || isTargetNetBSD())); break; case StrictAlign: AllowsUnalignedMem = false; diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h index ef49e6db07f..1d80d1b370b 100644 --- a/lib/Target/ARM/ARMSubtarget.h +++ b/lib/Target/ARM/ARMSubtarget.h @@ -311,6 +311,9 @@ public: bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); } bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); } bool isTargetLinux() const { return TargetTriple.isOSLinux(); } + bool isTargetNetBSD() const { + return TargetTriple.getOS() == Triple::NetBSD; + } bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); } bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); }