From 3ed2ba4f0739bbf3a9298354fcda09746df81f1c Mon Sep 17 00:00:00 2001 From: Cassie Jones Date: Sun, 1 Mar 2020 15:53:18 +0100 Subject: [PATCH] Make entry point symbols respect mangling The entry point symbols were hardcoded in strings, now they use the Label::Extern so they get proper printing. These should be migrated to use the assembly instruction types, probably. --- src/trans/x64.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/trans/x64.rs b/src/trans/x64.rs index 2608c79..f1952bc 100644 --- a/src/trans/x64.rs +++ b/src/trans/x64.rs @@ -9,11 +9,15 @@ use std::{ #[cfg(target_os = "macos")] macro_rules! extern_label { - ($l:literal) => { Label::Extern(concat!("_", $l)) } + ($l:literal) => { + Label::Extern(concat!("_", $l)) + }; } #[cfg(not(target_os = "macos"))] macro_rules! extern_label { - ($l:literal) => { Label::Extern($l) } + ($l:literal) => { + Label::Extern($l) + }; } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] @@ -125,10 +129,11 @@ _start: lea rdi, [rip + {}] mov rsi, {} mov rdx, 0 - call _ivy_make_lam + call {} mov [rip + {}], rax"#, builtin.defn.name, builtin.params, + extern_label!("ivy_make_lam"), Label::Global(builtin.number), )?; } @@ -138,9 +143,10 @@ _start: r#" call {} mov rdi, 0 - call _ivy_exit + call {} "#, - entry + entry, + extern_label!("ivy_exit"), )?; for builtin in &builtins { writeln!(out, "{}", builtin.defn)?; -- 2.47.0