Repository: rust
Issue: Incremental occasionally causes link failures (in particular when build process is interrupted)
Labels: A-linkage,T-compiler,A-incr-comp,C-bug,A-contributor-roadblock

<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicating the bug.
-->

I tried this code: https://github.com/rust-lang/rust/pull/81275/commits/b717882fb6f678606acc88d870987cab40e26107

I expected to see this happen: It compiles successfully.

Instead, this happened:

```
  = note: /usr/bin/ld: /tmp/rustc7n3dgo/librustc_typeck-c1c702f6c0ed082b.rlib(rustc_typeck-c1c702f6c0ed082b.1f6gvdzw1xg6y56.rcgu.o): relocation R_X86_64_PC32 against undefined hidden symbol `anon.e321930b0bae74a5b269c2d224f94109.135.llvm.15012941867981504210' can not be used when making a shared object
          /usr/bin/ld: /tmp/rustc7n3dgo/librustc_typeck-c1c702f6c0ed082b.rlib(rustc_typeck-c1c702f6c0ed082b.2kv783dkfz4eig4n.rcgu.o): relocation R_X86_64_PC32 against undefined hidden symbol `_ZN4core3ops8function6FnOnce9call_once17hb43433e1ee944fe7E.llvm.14317370391725333118' can not be used when making a shared object
          /usr/bin/ld: /tmp/rustc7n3dgo/librustc_typeck-c1c702f6c0ed082b.rlib(rustc_typeck-c1c702f6c0ed082b.3cqtg0ebrql2rd8.rcgu.o): relocation R_X86_64_PC32 against undefined hidden symbol `anon.eae49e7385ecc193ec1fcf539c5141a9.100.llvm.5499732698529515802' can not be used when making a shared object
          /usr/bin/ld: /tmp/rustc7n3dgo/librustc_middle-83b74242a7255742.rlib(rustc_middle-83b74242a7255742.29ntjh109p85p91e.rcgu.o): relocation R_X86_64_PC32 against undefined hidden symbol `anon.712e2f39c61ddadde64034dfaf0f738c.199.llvm.18382006748427464360' can not be used when making a shared object
          /usr/bin/ld: /tmp/rustc7n3dgo/librustc_middle-83b74242a7255742.rlib(rustc_middle-83b74242a7255742.38uvgcbj494cplao.rcgu.o): relocation R_X86_64_PC32 against undefined hidden symbol `anon.712e2f39c61ddadde64034dfaf0f738c.199.llvm.18382006748427464360' can not be used when making a shared object
          /usr/bin/ld: /tmp/rustc7n3dgo/librustc_middle-83b74242a7255742.rlib(rustc_middle-83b74242a7255742.3hr9th0q5c43xr2a.rcgu.o): relocation R_X86_64_PC32 against undefined hidden symbol `anon.82495b045438102480b0340cffb3c8e7.100.llvm.17830998827333553218' can not be used when making a shared object
          /usr/bin/ld: /tmp/rustc7n3dgo/librustc_middle-83b74242a7255742.rlib(rustc_middle-83b74242a7255742.44bsww8uk85mfq3a.rcgu.o): relocation R_X86_64_PC32 against undefined hidden symbol `anon.712e2f39c61ddadde64034dfaf0f738c.199.llvm.18382006748427464360' can not be used when making a shared object
          /usr/bin/ld: /tmp/rustc7n3dgo/librustc_middle-83b74242a7255742.rlib(rustc_middle-83b74242a7255742.4iywqxra088mgqr5.rcgu.o): relocation R_X86_64_PC32 against undefined hidden symbol `anon.712e2f39c61ddadde64034dfaf0f738c.389.llvm.18382006748427464360' can not be used when making a shared object
          /usr/bin/ld: /tmp/rustc7n3dgo/librustc_middle-83b74242a7255742.rlib(rustc_middle-83b74242a7255742.4s1s3wicvbdoxsru.rcgu.o): relocation R_X86_64_PC32 against undefined hidden symbol `anon.f6101ecacd895ad87283c593f614ce01.72.llvm.3245620587429400994' can not be used when making a shared object
          /usr/bin/ld: /tmp/rustc7n3dgo/librustc_middle-83b74242a7255742.rlib(rustc_middle-83b74242a7255742.5fsy1y6w5w7prvy9.rcgu.o): relocation R_X86_64_PC32 against undefined hidden symbol `anon.712e2f39c61ddadde64034dfaf0f738c.199.llvm.18382006748427464360' can not be used when making a shared object
          /usr/bin/ld: /tmp/rustc7n3dgo/librustc_middle-83b74242a7255742.rlib(rustc_middle-83b74242a7255742.zjtxsb10gpjb46g.rcgu.o): relocation R_X86_64_PC32 against undefined hidden symbol `anon.82495b045438102480b0340cffb3c8e7.100.llvm.17830998827333553218' can not be used when making a shared object
          /usr/bin/ld: final link failed: nonrepresentable section on output
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version`:
```
rustc 1.50.0-beta.1 (05b602367 2020-12-29)
```

cc @Aaron1011 , I think you were looking into something similar a while back.