diff options
| author | 2017-07-28 15:31:54 +0000 | |
|---|---|---|
| committer | 2017-07-28 15:31:54 +0000 | |
| commit | 66aa449dcfbd63a00768d8f84ddd1f1d32b30882 (patch) | |
| tree | 5aab304cde62f51bc19ae001ec466747485f2fc4 /gnu/llvm/tools/clang/lib/Driver/Tools.cpp | |
| parent | sync (diff) | |
| download | wireguard-openbsd-66aa449dcfbd63a00768d8f84ddd1f1d32b30882.tar.xz wireguard-openbsd-66aa449dcfbd63a00768d8f84ddd1f1d32b30882.zip | |
On OpenBSD disable the malloc/calloc/realloc/free/str*dup builtins, since
they can perform strange transforms and optimizations. Some of those could
gain a slight advantage, but would avoid the variety of important runtime
checks our malloc(3) code does. In essence, the transforms performed are
considered "anti-mitigation".
ok kettenis robert, discussions with others
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Driver/Tools.cpp')
| -rw-r--r-- | gnu/llvm/tools/clang/lib/Driver/Tools.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gnu/llvm/tools/clang/lib/Driver/Tools.cpp b/gnu/llvm/tools/clang/lib/Driver/Tools.cpp index f6926813643..a38c204223a 100644 --- a/gnu/llvm/tools/clang/lib/Driver/Tools.cpp +++ b/gnu/llvm/tools/clang/lib/Driver/Tools.cpp @@ -6368,6 +6368,18 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } #endif + // Disable some builtins on OpenBSD because they are just not + // right... + if (getToolChain().getTriple().isOSOpenBSD()) { + CmdArgs.push_back("-fno-builtin-malloc"); + CmdArgs.push_back("-fno-builtin-calloc"); + CmdArgs.push_back("-fno-builtin-realloc"); + CmdArgs.push_back("-fno-builtin-valloc"); + CmdArgs.push_back("-fno-builtin-free"); + CmdArgs.push_back("-fno-builtin-strdup"); + CmdArgs.push_back("-fno-builtin-strndup"); + } + // Enable rewrite includes if the user's asked for it or if we're generating // diagnostics. // TODO: Once -module-dependency-dir works with -frewrite-includes it'd be |
