# fix deadlock with build-exe on an object for windows · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/4797fdb3db6570ae65ff5f80cb1071307c42a244)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 4797fdb3db6570ae65ff5f80cb1071307c42a244

Requested commit: 4797fdb3db6570ae65ff5f80cb1071307c42a244

Commit: 4797fdb3db6570ae65ff5f80cb1071307c42a244

Tree: c1f05ac1432f2f47a960f2a86fabd862d2db1913

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
fix deadlock with build-exe on an object for windows

The steps to repro this issue are:

zig build-obj hello.zig -target x86_64-windows-msvc
zig build-exe hello.obj -target x86_64-windows-msvc --subsystem console
-lkernel32 -lntdll

What was happening is that the main Compilation added a work item to
produce kernel32.lib. Then it added a sub-Compilation to build zig's
libc, which ended up calling a function with extern "kernel32", which
caused the sub-Compilation to also try to produce kernel32.lib. The main
Compilation and sub-Compilation do not coordinate about the set of
import libraries that they will be trying to build, so this caused a
deadlock.

This commit solves the problem by disabling the extern "foo" feature
from working when building compiler_rt or libc. Zig's linker code is now
responsible for putting the appropriate import libs on the linker line,
if any for compiler_rt and libc.

Related: #5825

```

## Parents

- [74c17aa8c5bfff9ba13aaed7b978055d85709ede](https://git.cafe/gitcafe/zig/commit/74c17aa8c5bfff9ba13aaed7b978055d85709ede?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/4797fdb3db6570ae65ff5f80cb1071307c42a244?format=markdown)
