Skip to content

Commit f350532

Browse files
authored
[libc] Fix accidental LIBC_NAMESPACE_clock_freq (#69620)
See-also: #69548
1 parent 0af5c06 commit f350532

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

libc/src/time/gpu/time_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE {
1616
// TODO: Once we have another use-case for this we should put it in a common
1717
// device environment struct.
1818
extern "C" [[gnu::visibility("protected")]] uint64_t
19-
[[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq = clock_freq;
19+
[[clang::address_space(4)]] __llvm_libc_clock_freq = clock_freq;
2020
#endif
2121

2222
} // namespace LIBC_NAMESPACE

libc/src/time/gpu/time_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ constexpr uint64_t clock_freq = 0;
3939
// We provide an externally visible symbol such that the runtime can set this to
4040
// the correct value. If it is not set we try to default to the known values.
4141
extern "C" [[gnu::visibility("protected")]] uint64_t
42-
[[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq;
43-
#define GPU_CLOCKS_PER_SEC static_cast<clock_t>(LIBC_NAMESPACE_clock_freq)
42+
[[clang::address_space(4)]] __llvm_libc_clock_freq;
43+
#define GPU_CLOCKS_PER_SEC static_cast<clock_t>(__llvm_libc_clock_freq)
4444

4545
#elif defined(LIBC_TARGET_ARCH_IS_NVPTX)
4646
// NPVTX uses a single 1 GHz fixed frequency clock for all target architectures.

libc/startup/gpu/amdgpu/start.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace LIBC_NAMESPACE {
1919
// real time. However, the frequency of this clock varies between cards and can
2020
// only be obtained via the driver. The loader will set this so we can use it.
2121
extern "C" [[gnu::visibility("protected")]] uint64_t
22-
[[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq = 0;
22+
[[clang::address_space(4)]] __llvm_libc_clock_freq = 0;
2323

2424
extern "C" uintptr_t __init_array_start[];
2525
extern "C" uintptr_t __init_array_end[];

libc/test/UnitTest/LibcTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ static long clock() { return LIBC_NAMESPACE::gpu::fixed_frequency_clock(); }
2323
#else
2424
// The AMDGPU loader needs to initialize this at runtime by querying the driver.
2525
extern "C" [[gnu::visibility("protected")]] uint64_t
26-
[[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq;
27-
#define CLOCKS_PER_SEC LIBC_NAMESPACE_clock_freq
26+
[[clang::address_space(4)]] __llvm_libc_clock_freq;
27+
#define CLOCKS_PER_SEC __llvm_libc_clock_freq
2828
#endif
2929
#else
3030
static long clock() { return 0; }

libc/utils/gpu/loader/amdgpu/Loader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ int load(int argc, char **argv, char **envp, void *image, size_t size,
477477
// If the clock_freq symbol is missing, no work to do.
478478
hsa_executable_symbol_t freq_sym;
479479
if (HSA_STATUS_SUCCESS ==
480-
hsa_executable_get_symbol_by_name(executable, "LIBC_NAMESPACE_clock_freq",
480+
hsa_executable_get_symbol_by_name(executable, "__llvm_libc_clock_freq",
481481
&dev_agent, &freq_sym)) {
482482

483483
void *host_clock_freq;

0 commit comments

Comments
 (0)