<div dir="ltr"><div dir="ltr">On Fri, 9 Sep 2016 at 11:29, Douglas Katzman via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: dougk<br>
Date: Fri Sep  9 13:20:49 2016<br>
New Revision: 281071<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=281071&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=281071&view=rev</a><br>
Log:<br>
Myriad: nominally "support" ASAN.<br>
<br>
Doesn't work, but needs to be enabled in order to get there.<br>
<br>
Modified:<br>
    cfe/trunk/lib/Driver/ToolChains.cpp<br>
    cfe/trunk/lib/Driver/ToolChains.h<br>
    cfe/trunk/lib/Driver/Tools.cpp<br>
    cfe/trunk/test/Driver/sanitizer-ld.c<br>
<br>
Modified: cfe/trunk/lib/Driver/ToolChains.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=281071&r1=281070&r2=281071&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=281071&r1=281070&r2=281071&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)<br>
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Sep  9 13:20:49 2016<br>
@@ -5042,6 +5042,10 @@ Tool *MyriadToolChain::buildLinker() con<br>
   return new tools::Myriad::Linker(*this);<br>
 }<br>
<br>
+SanitizerMask MyriadToolChain::getSupportedSanitizers() const {<br>
+  return SanitizerKind::Address;<br></blockquote><div><br></div><div>This change disabled the use of UBSan on Myriad; was that intentional? (All other overriders call the base class version to get a list of sanitizers that don't require special platform support, and then add values to the mask that it returns.)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+}<br>
+<br>
 WebAssembly::WebAssembly(const Driver &D, const llvm::Triple &Triple,<br>
                          const llvm::opt::ArgList &Args)<br>
   : ToolChain(D, Triple, Args) {<br>
<br>
Modified: cfe/trunk/lib/Driver/ToolChains.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=281071&r1=281070&r2=281071&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=281071&r1=281070&r2=281071&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Driver/ToolChains.h (original)<br>
+++ cfe/trunk/lib/Driver/ToolChains.h Fri Sep  9 13:20:49 2016<br>
@@ -1147,6 +1147,7 @@ public:<br>
       llvm::opt::ArgStringList &CC1Args) const override;<br>
   Tool *SelectTool(const JobAction &JA) const override;<br>
   unsigned GetDefaultDwarfVersion() const override { return 2; }<br>
+  SanitizerMask getSupportedSanitizers() const override;<br>
<br>
 protected:<br>
   Tool *buildLinker() const override;<br>
<br>
Modified: cfe/trunk/lib/Driver/Tools.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=281071&r1=281070&r2=281071&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=281071&r1=281070&r2=281071&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Driver/Tools.cpp (original)<br>
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Sep  9 13:20:49 2016<br>
@@ -3081,11 +3081,15 @@ static void linkSanitizerRuntimeDeps(con<br>
   // Force linking against the system libraries sanitizers depends on<br>
   // (see PR15823 why this is necessary).<br>
   CmdArgs.push_back("--no-as-needed");<br>
-  CmdArgs.push_back("-lpthread");<br>
-  CmdArgs.push_back("-lrt");<br>
+  // There's no libpthread or librt on RTEMS.<br>
+  if (TC.getTriple().getOS() != llvm::Triple::RTEMS) {<br>
+    CmdArgs.push_back("-lpthread");<br>
+    CmdArgs.push_back("-lrt");<br>
+  }<br>
   CmdArgs.push_back("-lm");<br>
-  // There's no libdl on FreeBSD.<br>
-  if (TC.getTriple().getOS() != llvm::Triple::FreeBSD)<br>
+  // There's no libdl on FreeBSD or RTEMS.<br>
+  if (TC.getTriple().getOS() != llvm::Triple::FreeBSD &&<br>
+      TC.getTriple().getOS() != llvm::Triple::RTEMS)<br>
     CmdArgs.push_back("-ldl");<br>
 }<br>
<br>
@@ -11055,9 +11059,12 @@ void tools::Myriad::Linker::ConstructJob<br>
<br>
   TC.AddFilePathLibArgs(Args, CmdArgs);<br>
<br>
+  bool NeedsSanitizerDeps = addSanitizerRuntimes(TC, Args, CmdArgs);<br>
   AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);<br>
<br>
   if (UseDefaultLibs) {<br>
+    if (NeedsSanitizerDeps)<br>
+      linkSanitizerRuntimeDeps(TC, CmdArgs);<br>
     if (C.getDriver().CCCIsCXX())<br>
       CmdArgs.push_back("-lstdc++");<br>
     if (T.getOS() == llvm::Triple::RTEMS) {<br>
<br>
Modified: cfe/trunk/test/Driver/sanitizer-ld.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sanitizer-ld.c?rev=281071&r1=281070&r2=281071&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sanitizer-ld.c?rev=281071&r1=281070&r2=281071&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Driver/sanitizer-ld.c (original)<br>
+++ cfe/trunk/test/Driver/sanitizer-ld.c Fri Sep  9 13:20:49 2016<br>
@@ -151,6 +151,15 @@<br>
 // CHECK-ASAN-ANDROID-SHARED: <a href="http://libclang_rt.asan-arm-android.so" rel="noreferrer" target="_blank">libclang_rt.asan-arm-android.so</a>"<br>
 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread"<br>
<br>
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \<br>
+// RUN:     -target sparcel-myriad-rtems-elf -fsanitize=address \<br>
+// RUN:     --sysroot=%S/Inputs/basic_myriad_tree \<br>
+// RUN:   | FileCheck --check-prefix=CHECK-ASAN-MYRIAD %s<br>
+//<br>
+// CHECK-ASAN-MYRIAD: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"<br>
+// CHECK-ASAN-MYRIAD-NOT: "-lc"<br>
+// CHECK-ASAN-MYRIAD: libclang_rt.asan-sparcel.a"<br>
+<br>
 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \<br>
 // RUN:     -target x86_64-unknown-linux -stdlib=platform -lstdc++ \<br>
 // RUN:     -fsanitize=thread \<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div>