Skip to content

Commit

Permalink
Fix Base.libllvm_path and jl_get_libllvm don't support non-ASCII char…
Browse files Browse the repository at this point in the history
…acters in path on Windows (#45126) (#45127)

* Fix jl_get_libllvm_impl to support non-ASCII characters

* Fix jl_get_libllvm_impl to support non-ASCII characters, fix whitespace

* Fix jl_get_libllvm_impl to support non-ASCII characters, fix null and buffer
  • Loading branch information
wesjenkins committed Feb 14, 2023
1 parent ff6a3cf commit 6976bac
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8960,11 +8960,15 @@ extern "C" JL_DLLEXPORT jl_value_t *jl_get_libllvm_impl(void) JL_NOTSAFEPOINT
HMODULE mod;
if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCSTR)&llvm::DebugFlag, &mod))
return jl_nothing;

char path[MAX_PATH];
if (!GetModuleFileNameA(mod, path, sizeof(path)))
wchar_t path16[MAX_PATH];
DWORD n16 = GetModuleFileNameW(mod, path16, MAX_PATH);
if (n16 <= 0)
return jl_nothing;
path16[n16++] = 0;
char path8[MAX_PATH * 3];
if (!WideCharToMultiByte(CP_UTF8, 0, path16, n16, path8, MAX_PATH * 3, NULL, NULL))
return jl_nothing;
return (jl_value_t*) jl_symbol(path);
return (jl_value_t*) jl_symbol(path8);
#else
Dl_info dli;
if (!dladdr((void*)LLVMContextCreate, &dli))
Expand Down

2 comments on commit 6976bac

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected.
A full report can be found here.

Please sign in to comment.