Repository: rust
Issue: Core build is broken when using build-std with custom cross-compile target 
Labels: A-cross,T-compiler,C-bug,requires-nightly,A-target-feature,-Zbuild-std

Hello. I'm using the nightly feature `build-std` to cross-compile core to a custom target. It always works as expected, however, today it suddenly stopped working and throws an error:

```bash
LLVM ERROR: EH registrations only live in functions using WinEH
error: could not compile `core`
````

I tried the same on Windows, and another error occurs:
```
Caused by:
process didn't exit successfully: `rustc --crate-name core --edition=2018 C:\Users\Kernel\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=f8246f0242b85744 -C extra-filename=-f8246f0242b85744 --out-dir C:\Users\Kernel\Documents\Proyectos\etheryal\kernel\target\x86_64\debug\deps --target \\?\C:\Users\Kernel\Documents\Proyectos\etheryal\kernel\targets\x86_64.json -Z force-unstable-if-unmarked -L dependency=C:\Users\Kernel\Documents\Proyectos\etheryal\kernel\target\x86_64\debug\deps -L dependency=C:\Users\Kernel\Documents\Proyectos\etheryal\kernel\target\debug\deps --cap-lints allow` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)
warning: build failed, waiting for other jobs to finish...
error: build failed
```

### Meta
`rustc --version --verbose`:
```
rustc --version --verbose
rustc 1.51.0-nightly (c0b64d97b 2021-01-28)
binary: rustc
commit-hash: c0b64d97beebb09325b5587abed39f4f1621026f
commit-date: 2021-01-28
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
LLVM version: 11.0.1
```

<details><summary>Backtrace</summary>
<p>

```
   RUST_BACKTRACE=1 cargo build --verbose

   Compiling core v0.0.0 (/home/kernel/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
       Fresh autocfg v1.0.1
     Running `rustc --crate-name core --edition=2018 /home/kernel/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=6e4a9794a30e64e2 -C extra-filename=-6e4a9794a30e64e2 --out-dir /mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/x86_64/debug/deps --target /mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/targets/x86_64.json -Z force-unstable-if-unmarked -L dependency=/mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/x86_64/debug/deps -L dependency=/mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/debug/deps --cap-lints allow`
   Compiling rustc-std-workspace-core v1.99.0 (/home/kernel/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
     Running `rustc --crate-name rustc_std_workspace_core --edition=2018 /home/kernel/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=de6d357e632aa5bc -C extra-filename=-de6d357e632aa5bc --out-dir /mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/x86_64/debug/deps --target /mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/targets/x86_64.json -Z force-unstable-if-unmarked -L dependency=/mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/x86_64/debug/deps -L dependency=/mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/debug/deps --extern core=/mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/x86_64/debug/deps/libcore-6e4a9794a30e64e2.rmeta --cap-lints allow`
   Compiling compiler_builtins v0.1.39
     Running `rustc --crate-name compiler_builtins /home/kernel/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.39/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="mem"' --cfg 'feature="rustc-dep-of-std"' -C metadata=97388e1919ba9c5c -C extra-filename=-97388e1919ba9c5c --out-dir /mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/x86_64/debug/deps --target /mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/targets/x86_64.json -Z force-unstable-if-unmarked -L dependency=/mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/x86_64/debug/deps -L dependency=/mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/debug/deps --extern core=/mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/x86_64/debug/deps/librustc_std_workspace_core-de6d357e632aa5bc.rmeta --cap-lints allow --cfg 'feature="unstable"'`
LLVM ERROR: EH registrations only live in functions using WinEH
error: could not compile `core`

Caused by:
  process didn't exit successfully: `rustc --crate-name core --edition=2018 /home/kernel/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=6e4a9794a30e64e2 -C extra-filename=-6e4a9794a30e64e2 --out-dir /mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/x86_64/debug/deps --target /mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/targets/x86_64.json -Z force-unstable-if-unmarked -L dependency=/mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/x86_64/debug/deps -L dependency=/mnt/c/Users/Kernel/Documents/Proyectos/etheryal/kernel/target/debug/deps --cap-lints allow` (exit code: 101)
warning: build failed, waiting for other jobs to finish...
error: build failed
```

</p>
</details>

`config.toml:`
```toml
[unstable]
build-std = ["core", "compiler_builtins", "alloc"]
build-std-features = ["compiler-builtins-mem"]
```

Thank you for your great work!