Repository: rust
Issue: link_dead_code flag breaks sodiumoxide build
Labels: A-linkage,I-crash,P-medium,T-compiler,C-bug,link-dead-code

When trying to disable dead code elimination project fails to build.

To be clear, this works:
`cargo test --no-run`
this doesn't: 
`RUSTFLAGS=-Clink_dead_code cargo test --no-run`

```
Build log:

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-L" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper0.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper1.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper10.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper11.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper12.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper13.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper14.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper15.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper2.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper3.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper4.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper5.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper6.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper7.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper8.rust-cgu.o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.libwhisper9.rust-cgu.o" "-o" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libwhisper-3838df784f3557e7.crate.allocator.rust-cgu.o" "-nodefaultlibs" "-L" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps" "-L" "/usr/local/Cellar/libsodium/1.0.15/lib" "-L" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libchrono-a2ac93e1e7f3829f.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libnum-c49ae6ecf79aff3b.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libnum_iter-529703f02f959052.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libnum_integer-ef7f59b4e3fd69a0.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libnom-d63d0bb4b90726c4.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libmemchr-90d85a68cc7f0681.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libtime-9ed328ba0dc074f6.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libnum_traits-5f9924077010f966.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libsodiumoxide-18211dc8e7914ec4.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libserde-9cbcd9e9b1f85d31.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/liblibsodium_sys-0b032eb7c19f6f3e.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libbytes-d7c1bd52839d451a.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libiovec-c288cddee47c6551.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/liblibc-1d475d610e8905d5.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libbyteorder-330a9355803e29d8.rlib" "/Users/andoriyu/Dev/Heaven/libwhisper-rs/target/debug/deps/libquick_error-8a3cabb77e931a5b.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libtest-191b92e1a25a742e.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libterm-16adb5ef965afad6.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgetopts-f78c669374ceb40f.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-a812896ed8dd253f.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-f80668a71535d14a.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-e7385b9dc1f6352a.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-fa5ca42c4beb9fd9.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_system-39205359e68fcafd.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-6d1727ccc0bf3375.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-59037b68a5b9d10d.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_unicode-db482e95dfaeb4c7.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librand-6dde5ed2dcdc460f.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-ef96fd3d49f3c876.rlib" "/Users/andoriyu/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-213aeb9cef9ff383.rlib" "-l" "sodium" "-l" "System" "-l" "resolv" "-l" "pthread" "-l" "c" "-l" "m"
  = note: Undefined symbols for architecture x86_64:
            "_crypto_stream_aes128ctr", referenced from:
                sodiumoxide::crypto::stream::aes128ctr::stream::h096683557c24d55a in libsodiumoxide-18211dc8e7914ec4.rlib(sodiumoxide-18211dc8e7914ec4.sodiumoxide1.rust-cgu.o)
            "_crypto_stream_aes128ctr_xor", referenced from:
                sodiumoxide::crypto::stream::aes128ctr::stream_xor::h446c7cf4f1728666 in libsodiumoxide-18211dc8e7914ec4.rlib(sodiumoxide-18211dc8e7914ec4.sodiumoxide1.rust-cgu.o)
                sodiumoxide::crypto::stream::aes128ctr::stream_xor_inplace::h15e74395e3a300a9 in libsodiumoxide-18211dc8e7914ec4.rlib(sodiumoxide-18211dc8e7914ec4.sodiumoxide1.rust-cgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

Pretty odd...
## Meta

`rustc --version --verbose`:
 ```
rustc 1.23.0-nightly (269cf5026 2017-10-28)
binary: rustc
commit-hash: 269cf5026cdac6ff47f886a948e99101316d7091
commit-date: 2017-10-28
host: x86_64-apple-darwin
release: 1.23.0-nightly
LLVM version: 4.0
```
`cargo --version --verbose`:
```
cargo 0.24.0-nightly (e5562ddb0 2017-10-26)
release: 0.24.0
commit-hash: e5562ddb061b8eb5a0e754d702f164a1d42d0a21
commit-date: 2017-10-26
```

Backtrace: