From ffb3861c7076345f2e43497e5079e9a970571ff0 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Fri, 5 Nov 2010 18:29:18 -0700 Subject: Move symbol prefix logic into separate function, add underscore prefix for windows. --- src/comp/back/x86.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/comp/back') diff --git a/src/comp/back/x86.rs b/src/comp/back/x86.rs index 0a5fc506..22ee3da3 100644 --- a/src/comp/back/x86.rs +++ b/src/comp/back/x86.rs @@ -127,13 +127,19 @@ fn decl_upcall_glue(int align, str prefix, uint n) -> str { upcall_glue(i)); } +fn get_symbol_prefix() -> str { + if (_str.eq(target_os(), "macos") || + _str.eq(target_os(), "win32")) { + ret "_"; + } else { + ret ""; + } +} + fn get_module_asm() -> str { auto align = 4; - auto prefix = ""; - if (_str.eq(target_os(), "macos")) { - prefix = "_"; - } + auto prefix = get_symbol_prefix(); auto glues = vec(decl_glue(align, prefix, -- cgit v1.2.3