# macho\+zld: when finding by address, note the end of section symbols too · gitcafe/zig

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

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

Visibility: public

Requested revision: 1be86218153ae77109d785aafb29430f787adefd

Requested commit: 1be86218153ae77109d785aafb29430f787adefd

Commit: 1be86218153ae77109d785aafb29430f787adefd

Tree: 6cc3b61a15f9e4f1215dab07c1494286ab766564

Author: Jakub Konka

Committer: Jakub Konka

## Message

```
macho+zld: when finding by address, note the end of section symbols too

Previously, if we were looking for the very last symbol by address in some
section, and the next symbol happened to also have the same address value
but would reside in a different section, we would keep going finding the
wrong symbol in the wrong section.

This mechanism turns out vital for correct linking of Go binaries
where the runtime looks for specially crafted synthetic symbols
which mark the beginning and end of each section. In this case,
we had an unfortunate clash between the end of PC marked machine code
section (`_runtime.etext`) and beginning of read-only data (`_runtime.rodata`).

```

## Parents

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

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