mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-11 10:55:31 +03:00
fully take ownership of memcpy in the builtins
This commit is contained in:
parent
dd04d653c0
commit
829b71aa1f
@ -6,12 +6,11 @@ const folly = @import("libc/folly.zig");
|
||||
const cpuid = @import("libc/cpuid.zig");
|
||||
|
||||
comptime {
|
||||
@export(memcpy, .{ .name = "roc_memcpy", .linkage = .Weak });
|
||||
// TODO: remove this workaround.
|
||||
// Wasm does not seem to respect that memcpy is weak.
|
||||
// This is probably a bug in our link steps somewhere.
|
||||
// Our wasm llvm pipeline always links in memcpy.
|
||||
// As such, our impl will conflict.
|
||||
if (arch != .wasm32) {
|
||||
@export(memcpy, .{ .name = "memcpy", .linkage = .Weak });
|
||||
@export(memcpy, .{ .name = "memcpy", .linkage = .Strong });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,6 @@ fn collect_roc_definitions<'a>(object: &object::File<'a, &'a [u8]>) -> MutMap<St
|
||||
|
||||
// special exceptions for roc_ functions that map to libc symbols
|
||||
let direct_mapping = match name {
|
||||
"roc_memcpy" => Some("memcpy"),
|
||||
"roc_memset" => Some("memset"),
|
||||
"roc_memmove" => Some("memmove"),
|
||||
|
||||
@ -1771,7 +1770,6 @@ mod tests {
|
||||
"roc_fx_getInt_help",
|
||||
"roc_fx_putInt",
|
||||
"roc_fx_putLine",
|
||||
"roc_memcpy",
|
||||
"roc_memset",
|
||||
"roc_panic",
|
||||
"roc_realloc"
|
||||
|
@ -141,9 +141,7 @@ fn collect_roc_definitions<'a>(object: &object::File<'a, &'a [u8]>) -> MutMap<St
|
||||
let address = sym.address();
|
||||
|
||||
// special exceptions for memcpy and memset.
|
||||
if name == "roc_memcpy" {
|
||||
vaddresses.insert("memcpy".to_string(), address);
|
||||
} else if name == "roc_memset" {
|
||||
if name == "roc_memset" {
|
||||
vaddresses.insert("memset".to_string(), address);
|
||||
}
|
||||
|
||||
|
@ -1319,7 +1319,6 @@ fn relocate_dummy_dll_entries(executable: &mut [u8], md: &PeMetadata) {
|
||||
/// Redirect `memcpy` and similar libc functions to their roc equivalents
|
||||
pub(crate) fn redirect_libc_functions(name: &str) -> Option<&str> {
|
||||
match name {
|
||||
"memcpy" => Some("roc_memcpy"),
|
||||
"memset" => Some("roc_memset"),
|
||||
"memmove" => Some("roc_memmove"),
|
||||
_ => None,
|
||||
|
Loading…
Reference in New Issue
Block a user