diff options
| author | Graydon Hoare <[email protected]> | 2010-11-05 18:29:18 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-11-05 18:31:23 -0700 |
| commit | ffb3861c7076345f2e43497e5079e9a970571ff0 (patch) | |
| tree | 98d22ca29d8e6e4bf3270e7d0c3b77c33659ee67 | |
| parent | Emit WinMain@16 entrypoint on windows. (diff) | |
| download | rust-ffb3861c7076345f2e43497e5079e9a970571ff0.tar.xz rust-ffb3861c7076345f2e43497e5079e9a970571ff0.zip | |
Move symbol prefix logic into separate function, add underscore prefix for windows.
| -rw-r--r-- | src/comp/back/x86.rs | 14 |
1 files changed, 10 insertions, 4 deletions
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, |