Reland "[PGO] Make emitted symbols hidden"

This was reverted because it was breaking when targeting Darwin which
tried to export these symbols which are now hidden. It should be safe
to just stop attempting to export these symbols in the clang driver,
though Apple folks will need to change their TAPI allow list described
in the commit where these symbols were originally exported
https://github.com/llvm/llvm-project/commit/f5380185623be243ba0f1b18d4bd594ac5cc7163

Then reverted again because it broke tests on MacOS, they should be
fixed now.

Bug: https://github.com/llvm/llvm-project/issues/58265

Differential Revision: https://reviews.llvm.org/D135340

GitOrigin-RevId: 443e2a10f69caeedb9fa621366b16fe0d4358279
diff --git a/lib/profile/InstrProfilingNameVar.c b/lib/profile/InstrProfilingNameVar.c
index 2d67a55..4072728 100644
--- a/lib/profile/InstrProfilingNameVar.c
+++ b/lib/profile/InstrProfilingNameVar.c
@@ -14,4 +14,4 @@
  * user has not specified one. Set this up by moving the runtime's copy of this
  * symbol to an object file within the archive.
  */
-COMPILER_RT_WEAK char INSTR_PROF_PROFILE_NAME_VAR[1] = {0};
+COMPILER_RT_WEAK COMPILER_RT_VISIBILITY char INSTR_PROF_PROFILE_NAME_VAR[1] = {0};
diff --git a/lib/profile/InstrProfilingVersionVar.c b/lib/profile/InstrProfilingVersionVar.c
index e49d171..21400bf 100644
--- a/lib/profile/InstrProfilingVersionVar.c
+++ b/lib/profile/InstrProfilingVersionVar.c
@@ -13,14 +13,6 @@
  * The runtime should only provide its own definition of this symbol when the
  * user has not specified one. Set this up by moving the runtime's copy of this
  * symbol to an object file within the archive.
- *
- * Hide this symbol everywhere except Apple platforms, where its presence is
- * checked by the TAPI tool.
  */
-#if !defined(__APPLE__)
-#define VERSION_VAR_VISIBILITY COMPILER_RT_VISIBILITY
-#else
-#define VERSION_VAR_VISIBILITY
-#endif
-VERSION_VAR_VISIBILITY COMPILER_RT_WEAK uint64_t INSTR_PROF_RAW_VERSION_VAR =
+COMPILER_RT_VISIBILITY COMPILER_RT_WEAK uint64_t INSTR_PROF_RAW_VERSION_VAR =
     INSTR_PROF_RAW_VERSION;
diff --git a/test/profile/instrprof-darwin-dead-strip.c b/test/profile/instrprof-darwin-dead-strip.c
index 62f6660..7918293 100644
--- a/test/profile/instrprof-darwin-dead-strip.c
+++ b/test/profile/instrprof-darwin-dead-strip.c
@@ -27,7 +27,7 @@
 
 // RUN: %clang_profgen -fcoverage-mapping -Wl,-dead_strip -dynamiclib -o %t.nocode.dylib %s
 // RUN: nm -jgU %t.nocode.dylib > %t.nocode.syms
-// RUN: nm -jgU %t | grep -vE "main|foo|mh_execute_header" > %t.code.syms
+// RUN: nm -jgU %t | sed -e '/_\{1,\}main/d' -e '/_\{1,\}mh_execute_header/d' > %t.code.syms
 // RUN: diff %t.nocode.syms %t.code.syms
 
 #ifdef CODE