Repository: rust
Issue: Cannot build `*-unknown-uefi` target with `profiler = true`
Labels: T-compiler,T-bootstrap,C-bug,O-UEFI

When building this:

```console
./x build library/std --target x86_64-unknown-uefi
```

with this `config.toml`:

```toml
[llvm]
download-ci-llvm = true

[target.x86_64-unknown-uefi]
profiler = true
```

It turns out that `build.rs` in `library/profile_builtins` failed to build the profileing code in LLVM compiler-rt.

I am not sure whether it makes sense for setting profiler in UEFI target. Feel free to close this if it is intended to not support.


### Meta

`rust-lang/rust` commit
```
6d2b84b3ed7848fd91b8d6151d4451b3103ed816
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary>Backtrace</summary>
<p>

```
 ./x build library/std --target x86_64-unknown-uefi
Building bootstrap
    Finished dev [unoptimized] target(s) in 0.03s
Building stage0 library artifacts (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.09s
Building compiler artifacts (stage0 -> stage1, x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.16s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 library artifacts {std} (x86_64-unknown-linux-gnu -> x86_64-unknown-uefi)
   Compiling profiler_builtins v0.0.0 (/home/dev/rust/library/profiler_builtins)
   Compiling std v0.0.0 (/home/dev/rust/library/std)
The following warnings were emitted during compilation:

warning: profiler_builtins@0.0.0: clang-16: warning: argument unused during compilation: '--gcc-toolchain=/nix/store/hf2gy3km07d5m0p1lwmja0rg9wlnmyr7-gcc-12.3.0' [-Wunused-command-line-argument]
warning: profiler_builtins@0.0.0: ../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c:33:10: fatal error: 'windows.h' file not found
warning: profiler_builtins@0.0.0: #include <windows.h>
warning: profiler_builtins@0.0.0:          ^~~~~~~~~~~
warning: profiler_builtins@0.0.0: 1 error generated.

error: failed to run custom build command for `profiler_builtins v0.0.0 (/home/dev/rust/library/profiler_builtins)`

Caused by:
  process didn't exit successfully: `/home/dev/rust/build/x86_64-unknown-linux-gnu/stage1-std/release/build/profiler_builtins-53581af9689cca4b/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=LLVM_PROFILER_RT_LIB
  TARGET = Some("x86_64-unknown-uefi")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-uefi
  CC_x86_64-unknown-uefi = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_uefi
  CC_x86_64_unknown_uefi = Some("clang")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-uefi
  CFLAGS_x86_64-unknown-uefi = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_uefi
  CFLAGS_x86_64_unknown_uefi = Some("-ffunction-sections -fdata-sections --target=x86_64-unknown-windows-gnu")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "--target=x86_64-unknown-windows-gnu" "-ffunction-sections" "-fdata-sections" "--target=x86_64-unknown-windows-gnu" "-I" "../../src/llvm-project/compiler-rt/include" "-fno-builtin" "-fomit-frame-pointer" "-fvisibility=hidden" "-DVISIBILITY_HIDDEN" "-DCOMPILER_RT_HAS_UNAME=1" "-DCOMPILER_RT_HAS_ATOMICS=1" "-o" "/home/dev/rust/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-uefi/release/build/profiler_builtins-65f9c5b87ee47c1a/out/../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.o" "-c" "../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c"
  cargo:warning=clang-16: warning: argument unused during compilation: '--gcc-toolchain=/nix/store/hf2gy3km07d5m0p1lwmja0rg9wlnmyr7-gcc-12.3.0' [-Wunused-command-line-argument]
  cargo:warning=../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c:33:10: fatal error: 'windows.h' file not found
  cargo:warning=#include <windows.h>
  cargo:warning=         ^~~~~~~~~~~
  cargo:warning=1 error generated.
  exit status: 1

  --- stderr


  error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "--target=x86_64-unknown-windows-gnu" "-ffunction-sections" "-fdata-sections" "--target=x86_64-unknown-windows-gnu" "-I" "../../src/llvm-project/compiler-rt/include" "-fno-builtin" "-fomit-frame-pointer" "-fvisibility=hidden" "-DVISIBILITY_HIDDEN" "-DCOMPILER_RT_HAS_UNAME=1" "-DCOMPILER_RT_HAS_ATOMICS=1" "-o" "/home/dev/rust/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-uefi/release/build/profiler_builtins-65f9c5b87ee47c1a/out/../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.o" "-c" "../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c" with args "clang" did not execute successfully (status code exit status: 1).

```

</p>
</details>