Skip to content

Commit 38769c0

Browse files
committed
---
yaml --- r: 1009 b: refs/heads/master c: f371dc6 h: refs/heads/master i: 1007: 2b42d1a v: v3
1 parent 2abae28 commit 38769c0

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: aeef8cee2904cc52e00fc34bcd370c38e8615fa8
2+
refs/heads/master: f371dc613adb41a9d62eecc9dd7dbde92b5f38a2

trunk/src/comp/back/x86.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,26 @@ fn get_module_asm() -> str {
157157
ret _str.connect(glues, "\n\n");
158158
}
159159

160+
fn get_data_layout() -> str {
161+
if (_str.eq(target_os(), "macos")) {
162+
ret "e-p:32:32-f64:32:64-i64:32:64-f80:128:128-n8:16:32";
163+
}
164+
if (_str.eq(target_os(), "win32")) {
165+
ret "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32";
166+
}
167+
ret "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32";
168+
}
169+
170+
fn get_target_triple() -> str {
171+
if (_str.eq(target_os(), "macos")) {
172+
ret "i686-apple-darwin";
173+
}
174+
if (_str.eq(target_os(), "win32")) {
175+
ret "i686-pc-mingw32";
176+
}
177+
ret "i686-pc-linux-gnu";
178+
}
179+
160180

161181
//
162182
// Local Variables:

trunk/src/comp/middle/trans.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,6 +2151,9 @@ fn trans_crate(session.session sess, @ast.crate crate, str output) {
21512151
llvm.LLVMModuleCreateWithNameInContext(_str.buf("rust_out"),
21522152
llvm.LLVMGetGlobalContext());
21532153

2154+
llvm.LLVMSetDataLayout(llmod, _str.buf(x86.get_data_layout()));
2155+
llvm.LLVMSetTarget(llmod, _str.buf(x86.get_target_triple()));
2156+
21542157
llvm.LLVMSetModuleInlineAsm(llmod, _str.buf(x86.get_module_asm()));
21552158

21562159
auto intrinsics = declare_intrinsics(llmod);

0 commit comments

Comments
 (0)