Skip to content

Commit c557eb7

Browse files
jyu2-gitbader
authored andcommitted
[SYCL] Fix unresolved reference for ExeModuleHandle.
Signed-off-by: Yu <jennifer.yu@intel.com>
1 parent 7cd7024 commit c557eb7

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

sycl/include/CL/sycl/detail/os_util.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#pragma once
1212

1313
#include <stdlib.h>
14+
#include <cstdint>
1415

1516
#ifdef _WIN32
1617
#define SYCL_RT_OS_WINDOWS
@@ -53,7 +54,7 @@ namespace detail {
5354

5455
/// Uniquely identifies an operating system module (executable or a dynamic
5556
/// library)
56-
using OSModuleHandle = void *;
57+
using OSModuleHandle = intptr_t;
5758

5859
/// Groups the OS-dependent services.
5960
class OSUtil {
@@ -63,7 +64,7 @@ class OSUtil {
6364

6465
/// Module handle for the executable module - it is assumed there is always
6566
/// single one at most.
66-
static const OSModuleHandle ExeModuleHandle;
67+
static constexpr OSModuleHandle ExeModuleHandle = -1;
6768

6869
/// Returns the amount of RAM available for the operating system.
6970
static size_t getOSMemSize();

sycl/source/detail/os_util.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ namespace cl {
2929
namespace sycl {
3030
namespace detail {
3131

32-
const OSModuleHandle OSUtil::ExeModuleHandle =
33-
reinterpret_cast<OSModuleHandle>(-1);
34-
3532
#if defined(SYCL_RT_OS_LINUX)
3633

3734
struct ModuleInfo {
@@ -54,7 +51,7 @@ static int callback(struct dl_phdr_info *Info, size_t Size, void *Data) {
5451
// ... it is - belongs to the module then
5552
// dlpi_addr is zero for the executable, replace it
5653
auto H = reinterpret_cast<void *>(Info->dlpi_addr);
57-
MI->Handle = H ? H : OSUtil::ExeModuleHandle;
54+
MI->Handle = H ? H : reinterpret_cast<void *>(OSUtil::ExeModuleHandle);
5855
MI->Name = Info->dlpi_name;
5956
return 1; // non-zero tells to finish iteration via modules
6057
}
@@ -78,7 +75,7 @@ OSModuleHandle OSUtil::getOSModuleHandle(const void *VirtAddr) {
7875
if (!GetModuleHandleExA(Flag, LpModuleAddr, &PhModule)) {
7976
// Expect the caller to check for zero and take
8077
// necessary action
81-
return reinterpret_cast<OSModuleHandle>(0);
78+
return 0;
8279
}
8380
return reinterpret_cast<OSModuleHandle>(PhModule);
8481
}

0 commit comments

Comments
 (0)