Closed
Description
(This is somewhat related to issue #5699 but I was told to file a new one; things got more interesting since.) $ cat a.go package main; import "fmt" // #cgo LDFLAGS: -framework Foundation -framework AppKit // extern void *cgoptr; import "C" func main() { fmt.Printf("pointer from cgo: %p\n", C.cgoptr) } $ cat a.m #include <AppKit/NSKeyValueBinding.h> void *cgoptr = &NSObservedObjectKey; All of the following: $ CC=gcc CGO_ENABLED=1 GOARCH=amd64 go build -x $ CC=gcc CGO_ENABLED=1 GOARCH=386 go build -x $ CC=clang CGO_ENABLED=1 GOARCH=amd64 go build -x $ CC=clang CGO_ENABLED=1 GOARCH=386 go build -x will yield the following during the final link: main(__DATA/__data): unexpected reloc for dynamic symbol NSObservedObjectKey main(__DATA/__data): unhandled relocation for NSObservedObjectKey (type 32 rtype 1) This happens for any Objective-C anything. For larger projects, the link failures become more spectacular. Attached are the results of building andlabs/ui@93914ec (this specific commit) with a modified cmd/ld that does not terminate after 20 error messages (this should probably be an option like it is for the compilers but I'll leave that for another issue). I don't know why the 386 one has a different error from the rest; it should probably be a third issue... go version: go version devel +b10044024a6d Thu May 15 15:55:31 2014 +1000 darwin/amd64 gcc version: i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00) Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. clang version: Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn) Target: x86_64-apple-darwin10.8.0 Thread model: posix This is with Xcode 4.2 for Snow Leopard. Thanks.
Attachments:
- newerr.386 (10200 bytes)
- newerr.amd64 (17599 bytes)