]> Cypherpunks repositories - gostls13.git/commit
runtime/cgo: move common symbol overrides into 6c-compiled code
authorRuss Cox <rsc@golang.org>
Thu, 28 Feb 2013 21:54:23 +0000 (13:54 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 28 Feb 2013 21:54:23 +0000 (13:54 -0800)
commit5bffa3b88e0d84e45139a891f25169399bfe10cc
treeaf3e3caf41ef43d55f05cb1fc92121649a08941f
parent7ae41e80103674f5cbc3e76724729c248e62d65f
runtime/cgo: move common symbol overrides into 6c-compiled code

There are some function pointers declared by 6c in
package runtime without initialization and then also
declared in package runtime/cgo with initialization,
so that if runtime/cgo is linked in, the function pointers
are non-nil, and otherwise they are nil. We depend on
this property for implementing non-essential cgo hooks
in package runtime.

The declarations in package runtime are 6c-compiled
and end up in .6 files. The declarations in package runtime/cgo
are gcc-compiled and end up in .o files. Since 6l links the .6
and .o files together, this all works.

However, when we switch to "external linking" mode,
6l will not see the .o files, and it would be up to the host linker
to resolve the two into a single initialized symbol.
Not all host linkers will do this (in particular OS X gcc will not).

To fix this, move the cgo declarations into 6c-compiled code,
so that they end up in .6 files, so that 6l gets them no matter what.

R=golang-dev
CC=golang-dev
https://golang.org/cl/7440045
19 files changed:
src/pkg/runtime/cgo/callbacks.c
src/pkg/runtime/cgo/gcc_darwin_386.c
src/pkg/runtime/cgo/gcc_darwin_amd64.c
src/pkg/runtime/cgo/gcc_freebsd_386.c
src/pkg/runtime/cgo/gcc_freebsd_amd64.c
src/pkg/runtime/cgo/gcc_freebsd_arm.c
src/pkg/runtime/cgo/gcc_linux_386.c
src/pkg/runtime/cgo/gcc_linux_amd64.c
src/pkg/runtime/cgo/gcc_linux_arm.c
src/pkg/runtime/cgo/gcc_netbsd_386.c
src/pkg/runtime/cgo/gcc_netbsd_amd64.c
src/pkg/runtime/cgo/gcc_netbsd_arm.c
src/pkg/runtime/cgo/gcc_openbsd_386.c
src/pkg/runtime/cgo/gcc_openbsd_amd64.c
src/pkg/runtime/cgo/gcc_setenv.c
src/pkg/runtime/cgo/gcc_util.c
src/pkg/runtime/cgo/gcc_windows_386.c
src/pkg/runtime/cgo/gcc_windows_amd64.c
src/pkg/runtime/cgo/setenv.c [new file with mode: 0644]