[Sanitizer]: Introduce a common internal printf function. For now, also use tool-specific wrappers TsanPrintf (its output is controlled by TSan flags) and AsanPrintf (which copies its results to the ASan-private buffer). Supported formats: %[z]{d,u,x}, %s, %p. Re-write all format strings in TSan according to this format (this should have no effect on 64-bit platforms).

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158065 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/tsan/rtl/tsan_platform_linux.cc b/lib/tsan/rtl/tsan_platform_linux.cc
index 9c8240d..91d31e6 100644
--- a/lib/tsan/rtl/tsan_platform_linux.cc
+++ b/lib/tsan/rtl/tsan_platform_linux.cc
@@ -96,7 +96,7 @@
       PROT_NONE,
       MAP_PRIVATE | MAP_ANON | MAP_FIXED | MAP_NORESERVE,
       -1, 0)) {
-    TsanPrintf("FATAL: ThreadSanitizer can not protect [%lx,%lx]\n", beg, end);
+    TsanPrintf("FATAL: ThreadSanitizer can not protect [%zx,%zx]\n", beg, end);
     TsanPrintf("FATAL: Make sure you are not using unlimited stack\n");
     Die();
   }
@@ -120,17 +120,17 @@
   }
   ProtectRange(kClosedLowBeg, kClosedLowEnd);
   ProtectRange(kClosedMidBeg, kClosedMidEnd);
-  DPrintf("kClosedLow   %lx-%lx (%luGB)\n",
+  DPrintf("kClosedLow   %zx-%zx (%zuGB)\n",
       kClosedLowBeg, kClosedLowEnd, (kClosedLowEnd - kClosedLowBeg) >> 30);
-  DPrintf("kLinuxShadow %lx-%lx (%luGB)\n",
+  DPrintf("kLinuxShadow %zx-%zx (%zuGB)\n",
       kLinuxShadowBeg, kLinuxShadowEnd,
       (kLinuxShadowEnd - kLinuxShadowBeg) >> 30);
-  DPrintf("kClosedMid   %lx-%lx (%luGB)\n",
+  DPrintf("kClosedMid   %zx-%zx (%zuGB)\n",
       kClosedMidBeg, kClosedMidEnd, (kClosedMidEnd - kClosedMidBeg) >> 30);
-  DPrintf("kLinuxAppMem %lx-%lx (%luGB)\n",
+  DPrintf("kLinuxAppMem %zx-%zx (%zuGB)\n",
       kLinuxAppMemBeg, kLinuxAppMemEnd,
       (kLinuxAppMemEnd - kLinuxAppMemBeg) >> 30);
-  DPrintf("stack        %lx\n", (uptr)&shadow);
+  DPrintf("stack        %zx\n", (uptr)&shadow);
 }
 
 static void CheckPIE() {
@@ -144,8 +144,8 @@
     u64 addr = strtoll(buf, 0, 16);
     if ((u64)addr < kLinuxAppMemBeg) {
       TsanPrintf("FATAL: ThreadSanitizer can not mmap the shadow memory ("
-             "something is mapped at 0x%llx < 0x%lx)\n",
-             addr, kLinuxAppMemBeg);
+             "something is mapped at 0x%zx < 0x%zx)\n",
+             (uptr)addr, kLinuxAppMemBeg);
       TsanPrintf("FATAL: Make sure to compile with -fPIE"
              " and to link with -pie.\n");
       Die();