Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/link: PIC support for darwin/arm #12896
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.
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
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.
@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.