Author: Petr Hosek
Date: 2020-06-04T15:44:10-07:00
New Revision: e1ab90001a0bac1d1bebe4116ce0e89567138283

URL: 
https://github.com/llvm/llvm-project/commit/e1ab90001a0bac1d1bebe4116ce0e89567138283
DIFF: 
https://github.com/llvm/llvm-project/commit/e1ab90001a0bac1d1bebe4116ce0e89567138283.diff

LOG: Revert "[Fuchsia] Rely on linker switch rather than dead code ref for 
profile runtime"

This reverts commit d51054217403b47f452619e11318bd214749a845 since
it broke several bots.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Fuchsia.cpp
    clang/lib/Driver/ToolChains/Fuchsia.h
    clang/test/Driver/fuchsia.c
    llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
    llvm/test/Instrumentation/InstrProfiling/linkage.ll

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp 
b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 5ac10e37176c..8f485802887f 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -15,7 +15,6 @@
 #include "clang/Driver/Options.h"
 #include "clang/Driver/SanitizerArgs.h"
 #include "llvm/Option/ArgList.h"
-#include "llvm/ProfileData/InstrProf.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/VirtualFileSystem.h"
@@ -366,13 +365,3 @@ SanitizerMask Fuchsia::getDefaultSanitizers() const {
   }
   return Res;
 }
-
-void Fuchsia::addProfileRTLibs(const llvm::opt::ArgList &Args,
-                               llvm::opt::ArgStringList &CmdArgs) const {
-  // Add linker option -u__llvm_profile_runtime to cause runtime
-  // initialization module to be linked in.
-  if (needsProfileRT(Args))
-    CmdArgs.push_back(Args.MakeArgString(
-        Twine("-u", llvm::getInstrProfRuntimeHookVarName())));
-  ToolChain::addProfileRTLibs(Args, CmdArgs);
-}

diff  --git a/clang/lib/Driver/ToolChains/Fuchsia.h 
b/clang/lib/Driver/ToolChains/Fuchsia.h
index 3159a54bda06..fee0e018f3ce 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.h
+++ b/clang/lib/Driver/ToolChains/Fuchsia.h
@@ -69,9 +69,6 @@ class LLVM_LIBRARY_VISIBILITY Fuchsia : public ToolChain {
   SanitizerMask getSupportedSanitizers() const override;
   SanitizerMask getDefaultSanitizers() const override;
 
-  void addProfileRTLibs(const llvm::opt::ArgList &Args,
-                        llvm::opt::ArgStringList &CmdArgs) const override;
-
   RuntimeLibType
   GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
   CXXStdlibType

diff  --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c
index acc2d3ad75b0..359a2797da21 100644
--- a/clang/test/Driver/fuchsia.c
+++ b/clang/test/Driver/fuchsia.c
@@ -242,21 +242,3 @@
 // RUN:     -gsplit-dwarf -c %s 2>&1 \
 // RUN:     | FileCheck %s -check-prefix=CHECK-SPLIT-DWARF
 // CHECK-SPLIT-DWARF: "-split-dwarf-output" "fuchsia.dwo"
-
-// RUN: %clang %s -### --target=aarch64-fuchsia \
-// RUN:     -fprofile-instr-generate -fcoverage-mapping \
-// RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
-// RUN:     -fuse-ld=lld 2>&1 \
-// RUN:     | FileCheck %s -check-prefix=CHECK-PROFRT-AARCH64
-// CHECK-PROFRT-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
-// CHECK-PROFRT-AARCH64: "-u__llvm_profile_runtime"
-// CHECK-PROFRT-AARCH64: 
"[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.profile.a"
-
-// RUN: %clang %s -### --target=x86_64-fuchsia \
-// RUN:     -fprofile-instr-generate -fcoverage-mapping \
-// RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
-// RUN:     -fuse-ld=lld 2>&1 \
-// RUN:     | FileCheck %s -check-prefix=CHECK-PROFRT-X86_64
-// CHECK-PROFRT-X86_64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
-// CHECK-PROFRT-X86_64: "-u__llvm_profile_runtime"
-// CHECK-PROFRT-X86_64: 
"[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.profile.a"

diff  --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp 
b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index ceceafa86030..7e6903e71144 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -1034,9 +1034,9 @@ void InstrProfiling::emitRegistration() {
 }
 
 bool InstrProfiling::emitRuntimeHook() {
-  // We expect the linker to be invoked with -u<hook_var> flag for Linux or
-  // Fuchsia, in which case there is no need to emit the user function.
-  if (TT.isOSLinux() || TT.isOSFuchsia())
+  // We expect the linker to be invoked with -u<hook_var> flag for linux,
+  // for which case there is no need to emit the user function.
+  if (TT.isOSLinux())
     return false;
 
   // If the module's provided its own runtime, we don't need to do anything.

diff  --git a/llvm/test/Instrumentation/InstrProfiling/linkage.ll 
b/llvm/test/Instrumentation/InstrProfiling/linkage.ll
index be3af8e51a5f..8a4dee2f70c4 100644
--- a/llvm/test/Instrumentation/InstrProfiling/linkage.ll
+++ b/llvm/test/Instrumentation/InstrProfiling/linkage.ll
@@ -2,11 +2,9 @@
 
 ; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -instrprof -S | FileCheck 
%s --check-prefixes=POSIX,MACHO
 ; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck %s 
--check-prefixes=POSIX,LINUX
-; RUN: opt < %s -mtriple=x86_64-unknown-fuchsia -instrprof -S | FileCheck %s 
--check-prefixes=POSIX,LINUX
 ; RUN: opt < %s  -mtriple=x86_64-pc-win32-coff -instrprof -S | FileCheck %s 
--check-prefixes=COFF
 ; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -passes=instrprof -S | 
FileCheck %s --check-prefixes=POSIX,MACHO
 ; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=instrprof -S | FileCheck 
%s --check-prefixes=POSIX,LINUX
-; RUN: opt < %s -mtriple=x86_64-unknown-fuchsia -passes=instrprof -S | 
FileCheck %s --check-prefixes=POSIX,LINUX
 ; RUN: opt < %s  -mtriple=x86_64-pc-win32-coff -passes=instrprof -S | 
FileCheck %s --check-prefixes=COFF
 
 ; MACHO: @__llvm_profile_runtime = external global i32


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to