-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: [cgo] Linker error with Go tip on darwin, ld: illegal text-relocation #9411
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
Comments
If it's of any help in tracking it down, the following work around appears to do fine: package main
/*
#include <stdlib.h>
typedef void (*destructor)(void*);
destructor std_free() {
return free;
}
static void my_func(destructor d, char *p) {
d(p);
}
*/
import "C"
func main() {
C.my_func(C.destructor(C.std_free()), C.CString("test"))
} EDIT: of course I meant to actually call std_free not just reference it |
The problem is that Go tip generate write barriers for the variable _Cfpvar_fp_free: using LEAQ instruction (see the LEQA at offset 0x55): Mach-O doesn't support this kind of pc relative relocation of a dynamic I see multiple possible ways to fix this, for example:
Suggestions? |
Is this the same issue as #8791? |
This commit adds a workaround that go-libjpeg can not build with golang 1.5 (devel). Here is the linker issue of golang: golang/go#9411
CL https://golang.org/cl/11693 mentions this issue. |
By applying the patch, https://github.com/gwenn/goreadline builds correctly. |
i can confirm that the patch fixes the problem I reported in #10015, a duplicate of this one. |
…affects this. Also set up proper multithreading on OS X. Currently crashes due to similar issue I've had with libui.
With the following code:
I get the following error:
The text was updated successfully, but these errors were encountered: