Skip to content

Commit ffb3861

Browse files
committed
Move symbol prefix logic into separate function, add underscore prefix for windows.
1 parent c1fb592 commit ffb3861

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/comp/back/x86.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,19 @@ fn decl_upcall_glue(int align, str prefix, uint n) -> str {
127127
upcall_glue(i));
128128
}
129129

130+
fn get_symbol_prefix() -> str {
131+
if (_str.eq(target_os(), "macos") ||
132+
_str.eq(target_os(), "win32")) {
133+
ret "_";
134+
} else {
135+
ret "";
136+
}
137+
}
138+
130139
fn get_module_asm() -> str {
131140
auto align = 4;
132141

133-
auto prefix = "";
134-
if (_str.eq(target_os(), "macos")) {
135-
prefix = "_";
136-
}
142+
auto prefix = get_symbol_prefix();
137143

138144
auto glues =
139145
vec(decl_glue(align, prefix,

0 commit comments

Comments
 (0)