Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: illegal text-relocation for c-archive darwin/amd64 #14217

Closed
azinman opened this issue Feb 4, 2016 · 5 comments

Comments

Projects
None yet
6 participants
@azinman
Copy link
Contributor

commented Feb 4, 2016

When compiling using buildmode c-archive on darwin/amd64 (targeting the iOS simulator), I run into this error when trying to link the resulting archive to my Swift code:

ld: illegal text-relocation to 'type..eq.[0]encoding/xml.Attr' in .../lib.a(go.o) from 'runtime.rodata' in .../lib.a(go.o) for architecture x86_64

Looking at the cmd/link/internal/ld/macho.go, it seems that it currently is only checking for shared archives on amd64 when it chooses to use the DATA segment over TEXT.

@azinman

This comment has been minimized.

Copy link
Contributor Author

commented Feb 4, 2016

@ianlancetaylor ianlancetaylor modified the milestones: Go1.6Maybe, Go1.7 Feb 4, 2016

@gopherbot

This comment has been minimized.

Copy link

commented Feb 18, 2016

CL https://golang.org/cl/19206 mentions this issue.

@gopherbot gopherbot closed this in aea4222 Mar 8, 2016

@dcu

This comment has been minimized.

Copy link

commented Mar 29, 2016

would it be possible to include this for go 1.6.1? It's kind of blocking my team

@ianlancetaylor ianlancetaylor modified the milestones: Go1.6.1, Go1.7 Mar 29, 2016

@minux

This comment has been minimized.

Copy link
Member

commented Mar 30, 2016

@adg adg added the Release-OK label Apr 7, 2016

@adg adg modified the milestones: Go1.6.1, Go1.6.2 Apr 7, 2016

@gopherbot

This comment has been minimized.

Copy link

commented Apr 14, 2016

CL https://golang.org/cl/22046 mentions this issue.

gopherbot pushed a commit that referenced this issue Apr 14, 2016

darwin/amd64: fix text-relocation issues for c-archive libraries

The existing implementation deals with absolute relocations in __TEXT
for darwin/amd64 in build-mode c-shared, but it ignores c-archive.
This results in issues when trying to use a c-archive in an iOS
app on the 64-bit simulator. This patch adds c-archive to the
handling of this issue.

Fixes #14217

Change-Id: I2e4d5193caa531171ad22fd0cd420a8bfb4646a6
Reviewed-on: https://go-review.googlesource.com/19206
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/22046

@adg adg added Release-Applied and removed Release-OK labels Apr 14, 2016

@golang golang locked and limited conversation to collaborators Apr 19, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.