diff options
| author | Patrick Walton <[email protected]> | 2011-05-05 12:45:34 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-05-05 12:46:22 -0700 |
| commit | a74feaf1594673bcec77ed45bd4b6766289a25b3 (patch) | |
| tree | 0e9ae545b866d22b99d6d22424fed528a76b6796 /src/comp | |
| parent | Put out burning tinderbox. (diff) | |
| download | rust-a74feaf1594673bcec77ed45bd4b6766289a25b3.tar.xz rust-a74feaf1594673bcec77ed45bd4b6766289a25b3.zip | |
rustc: Link with intrinsics.bc; change intrinsics linkage to linkonce_odr
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/back/Link.rs | 26 | ||||
| -rw-r--r-- | src/comp/back/x86.rs | 4 |
2 files changed, 28 insertions, 2 deletions
diff --git a/src/comp/back/Link.rs b/src/comp/back/Link.rs index da165787..ebeda8dc 100644 --- a/src/comp/back/Link.rs +++ b/src/comp/back/Link.rs @@ -2,12 +2,14 @@ import driver.session; import lib.llvm.llvm; import middle.trans; import std._str; +import std.fs; import lib.llvm.llvm.ModuleRef; import lib.llvm.llvm.ValueRef; import lib.llvm.mk_pass_manager; import lib.llvm.mk_target_data; import lib.llvm.mk_type_names; +import lib.llvm.False; tag output_type { output_type_none; @@ -16,8 +18,30 @@ tag output_type { output_type_object; } +fn llvm_err(session.session sess, str msg) { + sess.err(msg + ": " + _str.str_from_cstr(llvm.LLVMRustGetLastError())); + fail; +} + fn link_intrinsics(session.session sess, ModuleRef llmod) { - // TODO + auto path = fs.connect(sess.get_opts().sysroot, "intrinsics.bc"); + auto membuf = + llvm.LLVMRustCreateMemoryBufferWithContentsOfFile(_str.buf(path)); + if ((membuf as uint) == 0u) { + llvm_err(sess, "installation problem: couldn't open intrinstics.bc"); + fail; + } + + auto llintrinsicsmod = llvm.LLVMRustParseBitcode(membuf); + if ((llintrinsicsmod as uint) == 0u) { + llvm_err(sess, "installation problem: couldn't parse intrinstics.bc"); + fail; + } + + if (llvm.LLVMLinkModules(llmod, llintrinsicsmod) == False) { + llvm_err(sess, "couldn't link the module with the intrinsics"); + fail; + } } mod Write { diff --git a/src/comp/back/x86.rs b/src/comp/back/x86.rs index 063afe03..a40592d5 100644 --- a/src/comp/back/x86.rs +++ b/src/comp/back/x86.rs @@ -336,7 +336,9 @@ fn get_meta_sect_name() -> str { 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"; + ret "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64" + + "-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0: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"; |