# std.zig.system: Fix detectAbiAndDynamicLinker\(\) for non-Linux/Hurd ELF hosts\. · gitcafe/zig

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

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

Visibility: public

Requested revision: 8818dc62131979cb29efe7a9f2a2ebd17583cd4a

Requested commit: 8818dc62131979cb29efe7a9f2a2ebd17583cd4a

Commit: 8818dc62131979cb29efe7a9f2a2ebd17583cd4a

Tree: 5316af595ee662e250f1f7de73c2bda9ba3f2098

Author: Alex Rønne Petersen

Committer: Alex Rønne Petersen

## Message

```
std.zig.system: Fix detectAbiAndDynamicLinker() for non-Linux/Hurd ELF hosts.

Since we exclude Abi.none from the list of ABIs to be tested, it means that
Abi.gnu, which happens to be the first in the list, always gets picked for hosts
where the dynamic linker path does not depend on the ABI component of the
triple. Such hosts include all the BSDs, Haiku, Serenity, Solaris, etc.

To fix this, use DynamicLinker.kind() to determine whether this whole exercise
even makes sense. If it doesn't, as is the case on every OS other than Linux and
Hurd, we'll just fall back to Abi.default() which will try to pick a sensible
default based on the arch and OS components. This detection logic still has
plenty of room for improvement, but is at least a notable step up from
confusingly detecting Abi.gnu ~everywhere.

Closes #9089.

```

## Parents

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

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