Browse files

[Driver] [NetBSD] Add -D_REENTRANT when using sanitizers

NetBSD intends to support only reentrant interfaces in interceptors.
When -lpthread is used without _REENTRANT defined, things are
not guaranteed to work.

This is especially important for <stdio.h> and sanitization of
interfaces around FILE.  Some APIs have alternative modes depending
on the _REENTRANT definition, and NetBSD intends to support sanitization
of the _REENTRANT ones.

Differential Revision:

git-svn-id: 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information...
mgorny committed Dec 19, 2018
1 parent 5b01cba commit c00ce7cec04125051b37d5ee9b9b91090e15da31
Showing with 12 additions and 0 deletions.
  1. +8 −0 lib/Driver/ToolChains/NetBSD.cpp
  2. +4 −0 lib/Driver/ToolChains/NetBSD.h
@@ -457,3 +457,11 @@ SanitizerMask NetBSD::getSupportedSanitizers() const {
return Res;

void NetBSD::addClangTargetOptions(const ArgList &,
ArgStringList &CC1Args,
Action::OffloadKind) const {
const SanitizerArgs &SanArgs = getSanitizerArgs();
if (SanArgs.hasAnySanitizer())
@@ -76,6 +76,10 @@ class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF {

SanitizerMask getSupportedSanitizers() const override;

void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
Action::OffloadKind DeviceOffloadKind) const override;

Tool *buildAssembler() const override;
Tool *buildLinker() const override;

0 comments on commit c00ce7c

Please sign in to comment.