From 80d5185bd4288c12e9d5aa0fe2e00f2f4e6397d7 Mon Sep 17 00:00:00 2001 From: Ethan Luis McDonough Date: Tue, 25 Mar 2025 23:28:01 -0500 Subject: [PATCH] [PGO][Offload] Don't define GPU entrypoint on Darwin (#132966) This PR partially reverts 83e180c and instead opts to not define the GPU entry point on Darwin platforms. Marking `__llvm_write_custom_profile` as used was causing issues on embedded platforms. --- clang/lib/Driver/ToolChains/Darwin.cpp | 14 +++++--------- compiler-rt/lib/profile/InstrProfilingFile.c | 2 ++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index e67997314da3..4c8872273059 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 19467429cf4c..47ec4158551c 100644 --- a/compiler-rt/lib/profile/InstrProfilingFile.c +++ b/compiler-rt/lib/profile/InstrProfilingFile.c @@ -1273,6 +1273,7 @@ COMPILER_RT_VISIBILITY int __llvm_profile_set_file_object(FILE *File, return 0; } +#ifndef __APPLE__ int __llvm_write_custom_profile(const char *Target, const __llvm_profile_data *DataBegin, const __llvm_profile_data *DataEnd, @@ -1381,5 +1382,6 @@ int __llvm_write_custom_profile(const char *Target, return ReturnValue; } +#endif #endif