-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: PIC support for darwin/arm #12896
Comments
Duplicate of #9210. |
The only workaround before #9210 is fixed is to keep targeting SDK version 22.
|
@rakyll Sorry if I wasn't clear. This is for iOS framework. When code of custom iOS framework calling methods that are generated by gomobile cause illegal text-relocation. |
Sorry, it was not clear from the text. /cc @crawshaw |
updated the original report. |
Hi @KennyAtBaidu. Can you tell if this is coming from the ARMv7 or ARMv8 (arm64) binary? (You can extract the individual .a files by running gomobile with the -work.) For ARMv7 it looks like we are not compiling as PIC for iOS, which is easy to fix. For ARMv8 I was under the impression the compiler was generating PC-relative code by default, but I tried to confirm with a quick inspection of the compiler and it's not clear to me. |
Hi @crawshaw
gives me x86_64, armv7, and arm64 architecture. I tried to toggle around with the Xcode build setting, if I build with simulator, I got the same error. if I build with armv7, it'll first complain there's no bitcode, then I have the error
If I build with arm64, it still complains there's no bitcode but once I disable bitcode, it built successfully. :D |
Ok great, then this might be easy to fix. I'll try to attach a cl later today. |
do we have any updates? I also hit into this. |
same here. And thank you for your great effort. |
I can see the individual statics with Otherwise is there another quick way of getting the embedded framework to function? |
I just tested this and it works fine (except for a warning) with armv7+arm64. It stops working when I add amd64 to the fat binary. UPDATE: I talked too soon, it still doesn't work. |
@crawshaw hi, is there anything we can help with to help you fix this issue? |
this currently doesn't work due to golang/go#12896
CL https://golang.org/cl/22461 mentions this issue. |
@crawshaw @cherrymui thanks for your hard work on this issue. I tested this on tip but I'm getting the following error: gomobile bind -target=ios
gomobile: reading export data: /var/folders/y_/ws09jpg90_b5y710wmd7kvj5sbl416/T/gomobile-work-499035079/fakegopath/pkg/darwin_arm/path/to/my/sdk.a: unknown version:
make: *** [ios] Error 1 so I backported the commit to go 1.6 but when compiling I'm getting a similar error to the previous one: ld: illegal text-relocation to 'go.string.*' in /test/sdk.framework/sdk(go.o) from 'runtime.interhash' in /test/sdk.framework/sdk(go.o) for architecture armv7 Let me know if we can provide more information. |
@dcu is the first error in your comment, about "reading export data", fixed? I believe I saw the CL go by updating the gcimporter, and have no been able to replicate that error message. |
@crawshaw no, sorry I forgot to update here. This got fixed after #15519 and updating gomobile. it works on both 1.6 and 1.7. |
When including the generated gomobile iOS framework into another iOS framework, calling gomobile generated method from the wrapper framework causes linker failure with message "ld: illegal text-relocation to 'type..eq.[0]string'"
The text was updated successfully, but these errors were encountered: