aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorDale Weiler <weilercdale@gmail.com>2022-01-13 00:19:04 -0500
committerDale Weiler <weilercdale@gmail.com>2022-01-13 00:19:04 -0500
commitee260986a9bb5dcf1eed24425313fae95c33f187 (patch)
treeebf8d577ae2aff9b574df0e266b4540288d3299d /src/main.cpp
parentc9bc7596240ac3c18d48c0545f478e08b0c2a23e (diff)
more fixes
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 35b3d713b..9aa9bd2ac 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -446,8 +446,9 @@ i32 linker_stage(lbGenerator *gen) {
link_settings = gb_string_appendc(link_settings, "-shared ");
// NOTE(dweiler): _odin_entry_point must be called at initialization
- // time of the shared object, we can pass -init to the linker by using
- // a comma separated list of arguments to -Wl.
+ // time of the shared object, similarly, _odin_exit_point must be called
+ // 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
// 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.
#if defined(GB_SYSTEM_OSX)
output_ext = STR_LIT(".dylib");
- link_settings = gb_string_appendc(link_settings, "-Wl,-init,'__odin_entry_point' ");
#else
output_ext = STR_LIT(".so");
- link_settings = gb_string_appendc(link_settings, "-Wl,-init,'__odin_entry_point' ");
#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 {
link_settings = gb_string_appendc(link_settings, "-no-pie ");
}