properly expose all symbls in manganis without linker intercept (#3230)

* force a volatile read of manganis symbols to preserve them in the final binary
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-11-17 00:36:56 -05:00
1 parent 017478d212
commit 493c5c7532
4 files changed
+12 -25

No files matched your search

@@ -104,6 +104,8 @@ impl ToTokens for AssetParser {
// "/blahcss123.css"
bundled: #bundled,
metadata: __volatile_reader as fn() -> u8,
}
}
) #option_source
@@ -17,5 +17,9 @@ pub fn generate_link_section(asset: &impl Serialize) -> TokenStream2 {
#[link_section = #section_name]
#[used]
static ASSET: [u8; #len] = * #asset_bytes;
fn __volatile_reader() -> u8 {
unsafe { std::ptr::read_volatile(ASSET.as_ptr()) }
}
}
}