summaryrefslogtreecommitdiff
path: root/dln.c
AgeCommit message (Collapse)Author
2024-10-25Avoid dangling pointer on cygwinDaisuke Fujimura (fd0)
Notes: Merged: https://github.com/ruby/ruby/pull/11952
2024-10-08Cast via `uintptr_t` function pointer between object pointerNobuyoshi Nakada
- ISO C forbids conversion of function pointer to object pointer type - ISO C forbids conversion of object pointer to function pointer type
2024-07-10Revert all changes to dln.c, dmydln.c, dln.h for the shared GCPeter Zhu
2024-04-26Allow RUBY_GC_LIBRARY_PATH to be set in minirubyPeter Zhu
miniruby is used by tool/runruby.rb, so we need to ensure we don't rb_bug when RUBY_GC_LIBRARY_PATH is set so we can run tests using the make commands. This commit changes it to warn instead.
2024-04-24Pass string error buffer into dln_openPeter Zhu
On Windows, the error exists on the stack so we should pass an error buffer from the caller.
2024-04-23Get error from dln_open when USE_SHARED_GCPeter Zhu
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.
2024-04-15Initialize external GC LibraryMatt Valentine-House
Co-Authored-By: Peter Zhu <[email protected]>
2024-02-22Refactor to use `struct string_part`Nobuyoshi Nakada
2024-02-22Split `init_funcname`Nobuyoshi Nakada
Extract `build_funcname` that takes the prefix as an argument, and `concat_funcname` that concats the parts.
2024-02-04Do not define ABI version in statically linked objectsNobuyoshi Nakada
It is for dynamically loading, useless for statically linked objects.
2023-12-19[wasm] dln.c: Guard `dladdr` use in symbol incompatibility checkYuta Saito
wasi-libc recently added a family of `dl*` functions[^1], but it still doesn't have `dladdr` unlike other platforms. Guard the use of `dladdr` with `HAVE_DLADDR` to avoid build failure with the head version of wasi-libc. The library name is used only for diagnostic purpose if it's not NULL, so it's safe to skip it. [^1]: https://github.com/WebAssembly/wasi-libc/commit/b85d65528d6e17ae1874c6cc6a6a3ac02e83021a
2023-12-14rb_ext_resolve_symbol: C API to resolve and return externed symbols [Feature ↵Satoshi Tagomori
#20005] This is a C API for extensions to resolve and get function symbols of other extensions. Extensions can check the expected symbol is correctly loaded and accessible, and use it if it is available. Otherwise, extensions can raise their own error to guide users to setup their environments correctly and what's missing.
2023-12-14dln_symbol: make dln_sym accessible Ruby internallySatoshi Tagomori
The symbol resolved by dln_symbol will eventually be passed to extensions. The error handling of dln_sym is also separated into dln_sym_func because the new call resolving symbols will not raise LoadError.
2023-11-21Add EXTERNAL_PREFIX to ruby_abi_versionNobuyoshi Nakada
2023-11-21typedef ABI version typesNobuyoshi Nakada
2023-03-21Update dln.c to fix error output from `dln_open()`drew-wells
`libruby_name` gets trashed by `dlclose(handle)`, so output the "linked to incompatible ... " error before calling `dlclose(handle)`. Notes: Merged: https://github.com/ruby/ruby/pull/7552 Merged-By: nobu <[email protected]>
2022-10-19Fix and improve coroutines for Darwin (macOS) ppc/ppc64. (#5975)Sergey Fedorov
Notes: Merged-By: ioquatix <[email protected]>
2022-10-17Fix possible use of undefined macros on very old macOS [ci skip]Nobuyoshi Nakada
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2022-07-17Show ABI incompatible binary pathNobuyoshi Nakada
2022-06-27[Bug #18879] Fix macOS version detectionsNobuyoshi Nakada
macOS's AvailabilityMacros.h does not contain macros for future versions. If a version macro is not defined, consider only earlier versions to be targeted.
2022-03-01Only define RUBY_DLN_CHECK_ABI when supportedPeter Zhu
2022-03-01ABI checking is not supported on WindowsPeter Zhu
2022-03-01dln.c: suppress unused function 'abi_check_enabled_p' warning for wasiYuta Saito
Notes: Merged: https://github.com/ruby/ruby/pull/5613
2022-02-22[Feature #18249] Implement ABI checkingPeter Zhu
Header file include/ruby/internal/abi.h contains RUBY_ABI_VERSION which is the ABI version. This value should be bumped whenever an ABI incompatible change is introduced. When loading dynamic libraries, Ruby will compare its own `ruby_abi_version` and the `ruby_abi_version` of the loaded library. If these two values don't match it will raise a `LoadError`. This feature can also be turned off by setting the environment variable `RUBY_RUBY_ABI_CHECK=0`. This feature will prevent cases where previously installed native gems fail in unexpected ways due to incompatibility of changes in header files. This will force the developer to recompile their gems to use the same header files as the built Ruby. In Ruby, the ABI version is exposed through `RbConfig::CONFIG["ruby_abi_version"]`. Notes: Merged: https://github.com/ruby/ruby/pull/5474
2022-02-18Remove unused function declaration in dln.cPeter Zhu
getenv is no longer used in dln.c.
2022-02-17Refine the load error messageNobuyoshi Nakada
Show the linked ruby library name when failed to load extension built against different ruby library. Notes: Merged: https://github.com/ruby/ruby/pull/5564
2022-02-17Check running macOS version at runtimeNobuyoshi Nakada
2022-01-20Fix warningsKazuhiro NISHIYAMA
``` compiling ..../ruby/ruby/dln.c ..../ruby/ruby/dln.c:108:1: warning: unused function 'init_funcname_len' [-Wunused-function] init_funcname_len(const char **file) ^ ..../ruby/ruby/dln.c:122:19: warning: unused variable 'funcname_prefix' [-Wunused-const-variable] static const char funcname_prefix[sizeof(FUNCNAME_PREFIX) - 1] = FUNCNAME_PREFIX; ^ 2 warnings generated. ```
2022-01-19Refactor dln_load into dln_open and dln_symPeter Zhu
Refactor dln_load into dln_open and dln_sym to simplify the code for Windows and platforms that have dlopen. Notes: Merged: https://github.com/ruby/ruby/pull/5459
2022-01-18[Feature #18491] Drop support for HP-UXPeter Zhu
IA64 support was dropped in ticket #15894, so we can drop support for HP-UX. Notes: Merged: https://github.com/ruby/ruby/pull/5457
2022-01-14Drop support for OSX 10.3 and earlierPeter Zhu
dlopen was introduced in OSX 10.4, which was released in 2005. OSX 10.3 was EOL in 2007. Notes: Merged: https://github.com/ruby/ruby/pull/5440
2021-12-17dln.c: refine preprocessor conditions by USE_DLN_DLOPEN and _WIN32Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5284
2021-09-10dln.c: add missing dependency卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-05-07Protoized old pre-ANSI K&R style declarations and definitionsNobuyoshi Nakada
2021-03-24Removed dln_a_outNobuyoshi Nakada
a.out format is considered extinct nowadays. Notes: Merged: https://github.com/ruby/ruby/pull/4317 Merged-By: nobu <[email protected]>
2021-03-24Fixed compilation errors when USE_DLN_A_OUTNobuyoshi Nakada
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <[email protected]>
2020-02-07more on NULL versus functions.卜部昌平
Function pointers are not void*. See also ce4ea956d24eab5089a143bba38126f2b11b55b6 8427fca49bd85205f5a8766292dd893f003c0e48
2019-12-26decouple internal.h headers卜部昌平
Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies). Notes: Merged: https://github.com/ruby/ruby/pull/2711
2019-06-19Remove IA64 support.Samuel Williams
2018-07-30reduce copy & pasteshyouhei
We see several occurrence of "diagnostic push/pop" so why not make them macros. Tested on GCC8 / Clang 6. Note that ruby.h is intentionally left untouched because we don't want to introduce new public macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09constifiednobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-03dln.c: dln_incompatible_library_pnobu
* dln.c (dln_incompatible_library_p): renamed as the error message with dln prefix, since it is not bound to xmalloc restrictively. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-03dln.c: xmalloc_mismatch_p with dlopennobu
* dln.c (xmalloc_mismatch_p): define only when using dlopen, otherwise dlsym is not available too, and should be used then. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02include missing headershyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02comparing function pointer versus void* is a GCCismshyouhei
However dlsym() requires such feature so this function is non- portable by nature. Cannot but suppress warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-26get rid of strcpynobu
* addr2line.c (follow_debuglink): insert global_debug_dir by using memmove instead of copying to temporary buffer. * dln.c (dln_load): use memcpy with the known length instead of strcpy. * gc.c (rb_gc_unprotect_logging): use strdup instead of malloc and strcpy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e