Skip to content

zig ld: act as linker for golang#9086

Merged
kubkon merged 3 commits intomasterfrom
fix-9050
Jun 12, 2021
Merged

zig ld: act as linker for golang#9086
kubkon merged 3 commits intomasterfrom
fix-9050

Conversation

@kubkon
Copy link
Copy Markdown
Member

@kubkon kubkon commented Jun 11, 2021

Fixes #9050

Changes:

  • match all __DATA sections as __data except __const --- in golang, you will get __DATA,__noptrdata or __DATA,__go_buildinfo which should be mapped to __DATA,__data
  • allow for existence of __DATA_CONST sections in objects --- up until now, we only expected old-fashioned objects which carried two basic segments by name: __TEXT and __DATA. Since macOS 11.1, there is a new segment __DATA_CONST, and we should expect and correctly parse sections designated to that segment explicitly as is the case in golang
  • throw an error if found unknown section in object --- we will silently ignore expected section that are either won't take part in linking such as any __DWARF section, or are known but are not yet implemented such as __TEXT,__eh_frame. For any other we will throw an error and exit
  • inform the caller that we currently are unable to handle frameworks

kubkon added 3 commits June 11, 2021 16:52
Examples of such sections include:
* in Go, you will get `__DATA,__noptrdata` or `__DATA,__go_buildinfo`
  which should be mapped to `__DATA,__data`
Up until now, we only expected old-fashioned objects which carried
two basic segments by name: __TEXT and __DATA. Since macOS 11.1,
there is a new segment __DATA_CONST, and we should expect and
correctly parse sections designated to that segment explicitly
as is the case in golang.
We will silently ignore expected section that are either won't take
part in linking such as any `__DWARF` section, or are known but are
not yet implemented such as `__TEXT,__eh_frame`. For any other
we will throw an error and exit.

Also, inform the caller that we currently are unable to handle
frameworks.
@kubkon kubkon added this to the 0.8.1 milestone Jun 11, 2021
@kubkon kubkon requested a review from andrewrk June 11, 2021 22:18
@kubkon kubkon merged commit 05b5e49 into master Jun 12, 2021
@kubkon kubkon deleted the fix-9050 branch June 12, 2021 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[go/link x86_64-macos] linker segfault when using zig

2 participants