# macho: rework symbol handling to match zld/ELF · gitcafe/zig

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

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

Visibility: public

Requested revision: 9eb7e5182b963366da9415ff7efe7c0fa5b1ad62

Requested commit: 9eb7e5182b963366da9415ff7efe7c0fa5b1ad62

Commit: 9eb7e5182b963366da9415ff7efe7c0fa5b1ad62

Tree: 8f93fc1156cdc5e9480519c1db0eafbae545fab0

Author: Jakub Konka

Committer: Jakub Konka

## Message

```
macho: rework symbol handling to match zld/ELF

Now, each object file will store a mutable table of symbols that it
defines. Upon symbol resolution between object files, the symbol
will be updated with a globally allocated section ordinal and address
in virtual memory. If the object defines a globally available symbol,
its location only (comprising of the symbol index and object index)
will be stored in the globals map for easy access when relocating, etc.
This approach cleans up the symbol management significantly, and matches
the status quo used in zld/ELF.

Additionally, this makes scoping symbol stabs easier too as they are
now naturally contained within each object file.

```

## Parents

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

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