diff options
| author | Patrick Walton <[email protected]> | 2010-12-03 13:51:46 -0800 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2010-12-03 13:52:54 -0800 |
| commit | f371dc613adb41a9d62eecc9dd7dbde92b5f38a2 (patch) | |
| tree | b0ef7da69050eab1c4d888194b9c3b16258995b2 /src | |
| parent | Add load_non_structural and use it. (diff) | |
| download | rust-f371dc613adb41a9d62eecc9dd7dbde92b5f38a2.tar.xz rust-f371dc613adb41a9d62eecc9dd7dbde92b5f38a2.zip | |
rustc: Set data layout and target triple
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp/back/x86.rs | 20 | ||||
| -rw-r--r-- | src/comp/middle/trans.rs | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/comp/back/x86.rs b/src/comp/back/x86.rs index 94243c36..ac52fca5 100644 --- a/src/comp/back/x86.rs +++ b/src/comp/back/x86.rs @@ -157,6 +157,26 @@ fn get_module_asm() -> str { ret _str.connect(glues, "\n\n"); } +fn get_data_layout() -> str { + if (_str.eq(target_os(), "macos")) { + ret "e-p:32:32-f64:32:64-i64:32:64-f80:128:128-n8:16:32"; + } + if (_str.eq(target_os(), "win32")) { + ret "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32"; + } + ret "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"; +} + +fn get_target_triple() -> str { + if (_str.eq(target_os(), "macos")) { + ret "i686-apple-darwin"; + } + if (_str.eq(target_os(), "win32")) { + ret "i686-pc-mingw32"; + } + ret "i686-pc-linux-gnu"; +} + // // Local Variables: diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 2b4bec0c..9b6fa0ab 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -2151,6 +2151,9 @@ fn trans_crate(session.session sess, @ast.crate crate, str output) { llvm.LLVMModuleCreateWithNameInContext(_str.buf("rust_out"), llvm.LLVMGetGlobalContext()); + llvm.LLVMSetDataLayout(llmod, _str.buf(x86.get_data_layout())); + llvm.LLVMSetTarget(llmod, _str.buf(x86.get_target_triple())); + llvm.LLVMSetModuleInlineAsm(llmod, _str.buf(x86.get_module_asm())); auto intrinsics = declare_intrinsics(llmod); |