mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Merge pull request #1425 from graphitemaster/more_linux_shared_library_fixes
Fixes for shared library initialization and finalization
This commit is contained in:
+5
-4
@@ -446,8 +446,9 @@ i32 linker_stage(lbGenerator *gen) {
|
|||||||
link_settings = gb_string_appendc(link_settings, "-shared ");
|
link_settings = gb_string_appendc(link_settings, "-shared ");
|
||||||
|
|
||||||
// NOTE(dweiler): _odin_entry_point must be called at initialization
|
// NOTE(dweiler): _odin_entry_point must be called at initialization
|
||||||
// time of the shared object, we can pass -init to the linker by using
|
// time of the shared object, similarly, _odin_exit_point must be called
|
||||||
// a comma separated list of arguments to -Wl.
|
// at deinitialization. We can pass both -init and -fini to the linker by
|
||||||
|
// using a comma separated list of arguments to -Wl.
|
||||||
//
|
//
|
||||||
// This previously used ld but ld cannot actually build a shared library
|
// This previously used ld but ld cannot actually build a shared library
|
||||||
// correctly this way since all the other dependencies provided implicitly
|
// correctly this way since all the other dependencies provided implicitly
|
||||||
@@ -457,11 +458,11 @@ i32 linker_stage(lbGenerator *gen) {
|
|||||||
// Shared libraries are .dylib on MacOS and .so on Linux.
|
// Shared libraries are .dylib on MacOS and .so on Linux.
|
||||||
#if defined(GB_SYSTEM_OSX)
|
#if defined(GB_SYSTEM_OSX)
|
||||||
output_ext = STR_LIT(".dylib");
|
output_ext = STR_LIT(".dylib");
|
||||||
link_settings = gb_string_appendc(link_settings, "-Wl,-init,'__odin_entry_point' ");
|
|
||||||
#else
|
#else
|
||||||
output_ext = STR_LIT(".so");
|
output_ext = STR_LIT(".so");
|
||||||
link_settings = gb_string_appendc(link_settings, "-Wl,-init,'__odin_entry_point' ");
|
|
||||||
#endif
|
#endif
|
||||||
|
link_settings = gb_string_appendc(link_settings, "-Wl,-init,'_odin_entry_point' ");
|
||||||
|
link_settings = gb_string_appendc(link_settings, "-Wl,-fini,'_odin_exit_point' ");
|
||||||
} else {
|
} else {
|
||||||
link_settings = gb_string_appendc(link_settings, "-no-pie ");
|
link_settings = gb_string_appendc(link_settings, "-no-pie ");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user