Skip to content

Commit e418000

Browse files
[PGO][Offload] Hide GPU entrypoint on Darwin
1 parent 6477945 commit e418000

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

clang/lib/Driver/ToolChains/Darwin.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,15 +1481,11 @@ void Darwin::addProfileRTLibs(const ArgList &Args,
14811481
// If we have a symbol export directive and we're linking in the profile
14821482
// runtime, automatically export symbols necessary to implement some of the
14831483
// runtime's functionality.
1484-
if (hasExportSymbolDirective(Args)) {
1485-
if (ForGCOV) {
1486-
addExportedSymbol(CmdArgs, "___gcov_dump");
1487-
addExportedSymbol(CmdArgs, "___gcov_reset");
1488-
addExportedSymbol(CmdArgs, "_writeout_fn_list");
1489-
addExportedSymbol(CmdArgs, "_reset_fn_list");
1490-
} else {
1491-
addExportedSymbol(CmdArgs, "___llvm_write_custom_profile");
1492-
}
1484+
if (hasExportSymbolDirective(Args) && ForGCOV) {
1485+
addExportedSymbol(CmdArgs, "___gcov_dump");
1486+
addExportedSymbol(CmdArgs, "___gcov_reset");
1487+
addExportedSymbol(CmdArgs, "_writeout_fn_list");
1488+
addExportedSymbol(CmdArgs, "_reset_fn_list");
14931489
}
14941490

14951491
// Align __llvm_prf_{cnts,bits,data} sections to the maximum expected page

compiler-rt/lib/profile/InstrProfilingFile.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,13 +1273,11 @@ COMPILER_RT_VISIBILITY int __llvm_profile_set_file_object(FILE *File,
12731273
return 0;
12741274
}
12751275

1276-
int __llvm_write_custom_profile(const char *Target,
1277-
const __llvm_profile_data *DataBegin,
1278-
const __llvm_profile_data *DataEnd,
1279-
const char *CountersBegin,
1280-
const char *CountersEnd, const char *NamesBegin,
1281-
const char *NamesEnd,
1282-
const uint64_t *VersionOverride) {
1276+
COMPILER_RT_GPU_ENTRYPOINT int __llvm_write_custom_profile(
1277+
const char *Target, const __llvm_profile_data *DataBegin,
1278+
const __llvm_profile_data *DataEnd, const char *CountersBegin,
1279+
const char *CountersEnd, const char *NamesBegin, const char *NamesEnd,
1280+
const uint64_t *VersionOverride) {
12831281
int ReturnValue = 0, FilenameLength, TargetLength;
12841282
char *FilenameBuf, *TargetFilename;
12851283
const char *Filename;

compiler-rt/lib/profile/InstrProfilingPort.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343

4444
#if defined(__APPLE__)
4545
#define COMPILER_RT_SEG "__DATA,"
46+
#define COMPILER_RT_GPU_ENTRYPOINT COMPILER_RT_VISIBILITY
4647
#else
4748
#define COMPILER_RT_SEG ""
49+
#define COMPILER_RT_GPU_ENTRYPOINT
4850
#endif
4951

5052
#ifdef _MSC_VER

0 commit comments

Comments
 (0)