https://github.com/EthanLuisMcDonough created https://github.com/llvm/llvm-project/pull/132966
This PR partially reverts 83e180c and instead opts to hide the GPU entry point on Darwin platforms. Marking `__llvm_write_custom_profile` as used was causing issues on embedded platforms. >From e418000ddb31f6df2aa96061bea6fcc56d7b09a9 Mon Sep 17 00:00:00 2001 From: Ethan Luis McDonough <ethanluismcdono...@gmail.com> Date: Tue, 25 Mar 2025 12:41:59 -0500 Subject: [PATCH] [PGO][Offload] Hide GPU entrypoint on Darwin --- clang/lib/Driver/ToolChains/Darwin.cpp | 14 +++++--------- compiler-rt/lib/profile/InstrProfilingFile.c | 12 +++++------- compiler-rt/lib/profile/InstrProfilingPort.h | 2 ++ 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index e67997314da36..4c88722730598 100644 --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -1481,15 +1481,11 @@ void Darwin::addProfileRTLibs(const ArgList &Args, // If we have a symbol export directive and we're linking in the profile // runtime, automatically export symbols necessary to implement some of the // runtime's functionality. - if (hasExportSymbolDirective(Args)) { - if (ForGCOV) { - addExportedSymbol(CmdArgs, "___gcov_dump"); - addExportedSymbol(CmdArgs, "___gcov_reset"); - addExportedSymbol(CmdArgs, "_writeout_fn_list"); - addExportedSymbol(CmdArgs, "_reset_fn_list"); - } else { - addExportedSymbol(CmdArgs, "___llvm_write_custom_profile"); - } + if (hasExportSymbolDirective(Args) && ForGCOV) { + addExportedSymbol(CmdArgs, "___gcov_dump"); + addExportedSymbol(CmdArgs, "___gcov_reset"); + addExportedSymbol(CmdArgs, "_writeout_fn_list"); + addExportedSymbol(CmdArgs, "_reset_fn_list"); } // Align __llvm_prf_{cnts,bits,data} sections to the maximum expected page diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c index 19467429cf4c3..9f75ce5ef97d1 100644 --- a/compiler-rt/lib/profile/InstrProfilingFile.c +++ b/compiler-rt/lib/profile/InstrProfilingFile.c @@ -1273,13 +1273,11 @@ COMPILER_RT_VISIBILITY int __llvm_profile_set_file_object(FILE *File, return 0; } -int __llvm_write_custom_profile(const char *Target, - const __llvm_profile_data *DataBegin, - const __llvm_profile_data *DataEnd, - const char *CountersBegin, - const char *CountersEnd, const char *NamesBegin, - const char *NamesEnd, - const uint64_t *VersionOverride) { +COMPILER_RT_GPU_ENTRYPOINT int __llvm_write_custom_profile( + const char *Target, const __llvm_profile_data *DataBegin, + const __llvm_profile_data *DataEnd, const char *CountersBegin, + const char *CountersEnd, const char *NamesBegin, const char *NamesEnd, + const uint64_t *VersionOverride) { int ReturnValue = 0, FilenameLength, TargetLength; char *FilenameBuf, *TargetFilename; const char *Filename; diff --git a/compiler-rt/lib/profile/InstrProfilingPort.h b/compiler-rt/lib/profile/InstrProfilingPort.h index 66d697885eaee..ed56beb6577a3 100644 --- a/compiler-rt/lib/profile/InstrProfilingPort.h +++ b/compiler-rt/lib/profile/InstrProfilingPort.h @@ -43,8 +43,10 @@ #if defined(__APPLE__) #define COMPILER_RT_SEG "__DATA," +#define COMPILER_RT_GPU_ENTRYPOINT COMPILER_RT_VISIBILITY #else #define COMPILER_RT_SEG "" +#define COMPILER_RT_GPU_ENTRYPOINT #endif #ifdef _MSC_VER _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits