Skip to content

Commit

Permalink
Mention correct link_section in docs for Apple (#303)
Browse files Browse the repository at this point in the history
The code is correct by putting it actually in `__DATA`; update the docs
to match that.

The assembler only sets the `S_MOD_INIT_FUNC_POINTERS` section flag if
the `__DATA` segment is used, and without that, dyld will just ignore
it. It's the linker's job to move it to `__DATA_CONST` when targetting
a new enough OS version.
  • Loading branch information
BertalanD authored Sep 13, 2024
1 parent cc3ab91 commit 0bf7c15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ctor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ macro_rules! ctor_attributes {
/// #[cfg_attr(target_os = "netbsd", link_section = ".init_array")]
/// #[cfg_attr(target_os = "openbsd", link_section = ".init_array")]
/// #[cfg_attr(target_os = "illumos", link_section = ".init_array")]
/// #[cfg_attr(target_vendor = "apple", link_section = "__DATA_CONST,__mod_init_func")]
/// #[cfg_attr(target_vendor = "apple", link_section = "__DATA,__mod_init_func")]
/// #[cfg_attr(target_os = "windows", link_section = ".CRT$XCU")]
/// static FOO: extern fn() = {
/// #[cfg_attr(any(target_os = "linux", target_os = "android"), link_section = ".text.startup")]
Expand Down

0 comments on commit 0bf7c15

Please sign in to comment.