pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

clang-netbsd: Enable sanitizers on NetBSD/amd64



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Tue Jun 20 00:34:15 2017 +0200
Changeset:	e8f2480c9b9a11c5142c2da822af5a6408432934

Modified Files:
	clang-netbsd/distinfo
Added Files:
	clang-netbsd/patches/patch-lib_Driver_ToolChains_NetBSD.cpp
	clang-netbsd/patches/patch-lib_Driver_ToolChains_NetBSD.h

Log Message:
clang-netbsd: Enable sanitizers on NetBSD/amd64

Not tested.

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=e8f2480c9b9a11c5142c2da822af5a6408432934

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 clang-netbsd/distinfo                              |  2 +
 .../patches/patch-lib_Driver_ToolChains_NetBSD.cpp | 46 ++++++++++++++++++++++
 .../patches/patch-lib_Driver_ToolChains_NetBSD.h   | 12 ++++++
 3 files changed, 60 insertions(+)

diffs:
diff --git a/clang-netbsd/distinfo b/clang-netbsd/distinfo
index 3173a57f02..c88dcdc222 100644
--- a/clang-netbsd/distinfo
+++ b/clang-netbsd/distinfo
@@ -13,6 +13,8 @@ SHA1 (llvm-3.6.2.src.tar.xz) = 7a00257eb2bc9431e4c77c3a36b033072c54bc7e
 RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
 SHA1 (patch-lib_Basic_Targets.cpp) = 7b2e13a71f2b09c3f7336f21371637d3e39e4043
+SHA1 (patch-lib_Driver_ToolChains_NetBSD.cpp) = 7a45ff6e566467a30d4f0d48683141b9485eaa0e
+SHA1 (patch-lib_Driver_ToolChains_NetBSD.h) = 965f5c1a64461bbd3ea446148796e2dbddc2c9ca
 SHA1 (patch-test_Sema_128bitfloat.cpp) = cc11582dd9495b603a22ef73609ab04f65324da2
 SHA1 (patch-tools_clang-format_CMakeLists.txt) = f119d2a94cbfb8c00a285d1aa7789ed26f8309cf
 SHA1 (patch-unittests_ASTMatchers_Dynamic_RegistryTest.cpp) = 27a198a0efe237497f97e1903df5e8303e02745d
diff --git a/clang-netbsd/patches/patch-lib_Driver_ToolChains_NetBSD.cpp b/clang-netbsd/patches/patch-lib_Driver_ToolChains_NetBSD.cpp
new file mode 100644
index 0000000000..d93cea1178
--- /dev/null
+++ b/clang-netbsd/patches/patch-lib_Driver_ToolChains_NetBSD.cpp
@@ -0,0 +1,46 @@
+$NetBSD$
+
+--- lib/Driver/ToolChains/NetBSD.cpp.orig	2017-06-19 16:00:32.334614385 +0000
++++ lib/Driver/ToolChains/NetBSD.cpp
+@@ -15,6 +15,7 @@
+ #include "clang/Driver/Compilation.h"
+ #include "clang/Driver/Driver.h"
+ #include "clang/Driver/Options.h"
++#include "clang/Driver/SanitizerArgs.h"
+ #include "llvm/Option/ArgList.h"
+ 
+ using namespace clang::driver;
+@@ -246,6 +247,7 @@ void netbsd::Linker::ConstructJob(Compil
+   Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
+   Args.AddAllArgs(CmdArgs, options::OPT_r);
+ 
++  bool NeedsSanitizerDeps = addSanitizerRuntimes(getToolChain(), Args, CmdArgs);
+   AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
+ 
+   unsigned Major, Minor, Micro;
+@@ -279,6 +281,8 @@ void netbsd::Linker::ConstructJob(Compil
+       getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
+       CmdArgs.push_back("-lm");
+     }
++    if (NeedsSanitizerDeps)
++      linkSanitizerRuntimeDeps(getToolChain(), CmdArgs);
+     if (Args.hasArg(options::OPT_pthread))
+       CmdArgs.push_back("-lpthread");
+     CmdArgs.push_back("-lc");
+@@ -410,3 +414,16 @@ void NetBSD::addLibStdCxxIncludePaths(co
+   addLibStdCXXIncludePaths(getDriver().SysRoot, "/usr/include/g++", "", "", "",
+                            "", DriverArgs, CC1Args);
+ }
++
++SanitizerMask NetBSD::getSupportedSanitizers() const {
++  const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
++  SanitizerMask Res = ToolChain::getSupportedSanitizers();
++  if (IsX86_64) {
++    Res |= SanitizerKind::Address;
++    Res |= SanitizerKind::Vptr;
++    Res |= SanitizerKind::Leak;
++    Res |= SanitizerKind::Thread;
++    Res |= SanitizerKind::SafeStack;
++  }
++  return Res;
++}
diff --git a/clang-netbsd/patches/patch-lib_Driver_ToolChains_NetBSD.h b/clang-netbsd/patches/patch-lib_Driver_ToolChains_NetBSD.h
new file mode 100644
index 0000000000..3083e99916
--- /dev/null
+++ b/clang-netbsd/patches/patch-lib_Driver_ToolChains_NetBSD.h
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- lib/Driver/ToolChains/NetBSD.h.orig	2017-03-18 00:58:03.000000000 +0000
++++ lib/Driver/ToolChains/NetBSD.h
+@@ -66,6 +66,7 @@ public:
+       llvm::opt::ArgStringList &CC1Args) const override;
+ 
+   bool IsUnwindTablesDefault() const override { return true; }
++  SanitizerMask getSupportedSanitizers() const override;
+ 
+ protected:
+   Tool *buildAssembler() const override;


Home | Main Index | Thread Index | Old Index