Index: cfe/trunk/lib/Driver/ToolChains/NetBSD.h =================================================================== --- cfe/trunk/lib/Driver/ToolChains/NetBSD.h +++ cfe/trunk/lib/Driver/ToolChains/NetBSD.h @@ -76,6 +76,10 @@ SanitizerMask getSupportedSanitizers() const override; + void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args, + Action::OffloadKind DeviceOffloadKind) const override; + protected: Tool *buildAssembler() const override; Tool *buildLinker() const override; Index: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp +++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp @@ -457,3 +457,11 @@ } return Res; } + +void NetBSD::addClangTargetOptions(const ArgList &, + ArgStringList &CC1Args, + Action::OffloadKind) const { + const SanitizerArgs &SanArgs = getSanitizerArgs(); + if (SanArgs.hasAnySanitizer()) + CC1Args.push_back("-D_REENTRANT"); +}