Skip to content

Instantly share code, notes, and snippets.

@bschwind
Created June 12, 2017 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bschwind/94c6956a7c6adb1b0b14e6ac87cf82ab to your computer and use it in GitHub Desktop.
Save bschwind/94c6956a7c6adb1b0b14e6ac87cf82ab to your computer and use it in GitHub Desktop.
# Lifted from https://news.ycombinator.com/item?id=14305084
% cat test.rs
fn main() {
println!("Hello, world!");
}
% rustc --emit llvm-bc -C lto test.rs
% LIB=$HOME/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib
% xcrun --toolchain XcodeDefault clang -o test test.bc ~/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-ea49ffd3fee5264c.rlib
warning: overriding the module target triple with x86_64-apple-macosx10.12.0 [-Woverride-module]
1 warning generated.
% ./test
Hello, world!
% rustc --version
rustc 1.18.0-nightly (91ae22a01 2017-04-05)
% xcrun --toolchain XcodeDefault clang --version
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment