Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround upstream FreeBSD issue #272992 #51114

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/dlload.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,13 @@ JL_DLLEXPORT int jl_dlsym(void *handle, const char *symbol, void ** value, int t
// Look for symbols in internal libraries
JL_DLLEXPORT const char *jl_dlfind(const char *f_name)
{
#ifdef _OS_FREEBSD_
// This is a workaround for FreeBSD <= 13.2 which do not have
// https://cgit.freebsd.org/src/commit/?id=21a52f99440c9bec7679f3b0c5c9d888901c3694
// (See https://github.com/JuliaLang/julia/issues/50846)
if (strcmp(f_name, "dl_iterate_phdr") == 0)
Copy link
Member

Choose a reason for hiding this comment

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

This seems reasonable to me as a stopgap solution but I wonder if there's a way we can more directly query whether dl_iterate_phdr resolved to libc does the right thing so that we don't have to perform this check on every call.

Copy link
Member Author

Choose a reason for hiding this comment

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

I expect this check is generally a lot cheaper than the dlsyms below, but thankfully the standard function/library pointer caching for ccall should mean we only do this once per call-site

return JL_EXE_LIBNAME;
#endif
void * dummy;
if (jl_dlsym(jl_libjulia_internal_handle, f_name, &dummy, 0))
return JL_LIBJULIA_INTERNAL_DL_LIBNAME;
Expand Down