1 pub mod linux {
2     use syn::Ident;
3 
section(ident: &Ident) -> String4     pub fn section(ident: &Ident) -> String {
5         format!("linkme_{}", ident)
6     }
7 
section_start(ident: &Ident) -> String8     pub fn section_start(ident: &Ident) -> String {
9         format!("__start_linkme_{}", ident)
10     }
11 
section_stop(ident: &Ident) -> String12     pub fn section_stop(ident: &Ident) -> String {
13         format!("__stop_linkme_{}", ident)
14     }
15 }
16 
17 pub mod freebsd {
18     use syn::Ident;
19 
section(ident: &Ident) -> String20     pub fn section(ident: &Ident) -> String {
21         format!("linkme_{}", ident)
22     }
23 
section_start(ident: &Ident) -> String24     pub fn section_start(ident: &Ident) -> String {
25         format!("__start_linkme_{}", ident)
26     }
27 
section_stop(ident: &Ident) -> String28     pub fn section_stop(ident: &Ident) -> String {
29         format!("__stop_linkme_{}", ident)
30     }
31 }
32 
33 pub mod macho {
34     use syn::Ident;
35 
section(ident: &Ident) -> String36     pub fn section(ident: &Ident) -> String {
37         format!(
38             "__DATA,__linkme{},regular,no_dead_strip",
39             crate::hash(ident),
40         )
41     }
42 
section_start(ident: &Ident) -> String43     pub fn section_start(ident: &Ident) -> String {
44         format!("\x01section$start$__DATA$__linkme{}", crate::hash(ident))
45     }
46 
section_stop(ident: &Ident) -> String47     pub fn section_stop(ident: &Ident) -> String {
48         format!("\x01section$end$__DATA$__linkme{}", crate::hash(ident))
49     }
50 }
51 
52 pub mod windows {
53     use syn::Ident;
54 
section(ident: &Ident) -> String55     pub fn section(ident: &Ident) -> String {
56         format!(".linkme_{}$b", ident)
57     }
58 
section_start(ident: &Ident) -> String59     pub fn section_start(ident: &Ident) -> String {
60         format!(".linkme_{}$a", ident)
61     }
62 
section_stop(ident: &Ident) -> String63     pub fn section_stop(ident: &Ident) -> String {
64         format!(".linkme_{}$c", ident)
65     }
66 }
67 
68 pub mod illumos {
69     use syn::Ident;
70 
section(ident: &Ident) -> String71     pub fn section(ident: &Ident) -> String {
72         format!("set_linkme_{}", ident)
73     }
74 
section_start(ident: &Ident) -> String75     pub fn section_start(ident: &Ident) -> String {
76         format!("__start_set_linkme_{}", ident)
77     }
78 
section_stop(ident: &Ident) -> String79     pub fn section_stop(ident: &Ident) -> String {
80         format!("__stop_set_linkme_{}", ident)
81     }
82 }
83