Get error from dln_open when USE_SHARED_GC

Before, if dln_open failed to open RUBY_GC_LIBRARY_PATH, it would segfault
because it would try to raise an error, which cannot happen because the
GC has not been initialized yet.

This commit changes dln_open to return the error that occurred so the
caller can handle the error.
This commit is contained in:
Peter Zhu 2024-04-23 14:30:31 -04:00
parent 81433fd0f5
commit b9109b270d
4 changed files with 22 additions and 26 deletions

View file

@ -21,9 +21,9 @@ dln_symbol(void *handle, const char *symbol)
UNREACHABLE_RETURN(NULL);
}
NORETURN(void *dln_open(const char*));
NORETURN(void *dln_open(const char *library, const char **error));
void*
dln_open(const char *library)
dln_open(const char *library, const char **error)
{
rb_loaderror("this executable file can't load extension libraries");