Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(538)

Issue 7440045: code review 7440045: runtime/cgo: move common symbol overrides into 6c-compi... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 2 months ago by rsc
Modified:
12 years, 2 months ago
Reviewers:
bradfitz
CC:
golang-dev
Visibility:
Public.

Description

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.

Patch Set 1 #

Patch Set 2 : diff -r f5c0b6dc035c https://go.googlecode.com/hg #

Patch Set 3 : diff -r f5c0b6dc035c https://go.googlecode.com/hg #

Patch Set 4 : diff -r f5c0b6dc035c https://go.googlecode.com/hg #

Patch Set 5 : diff -r a0928cec80d2 https://go.googlecode.com/hg #

Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -47 lines) Patch
M src/pkg/runtime/cgo/callbacks.c View 1 1 chunk +16 lines, -0 lines 0 comments Download
M src/pkg/runtime/cgo/gcc_darwin_386.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/cgo/gcc_darwin_amd64.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/cgo/gcc_freebsd_386.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/cgo/gcc_freebsd_amd64.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/cgo/gcc_freebsd_arm.c View 1 2 chunks +0 lines, -5 lines 0 comments Download
M src/pkg/runtime/cgo/gcc_linux_386.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/cgo/gcc_linux_amd64.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/cgo/gcc_linux_arm.c View 1 2 chunks +0 lines, -5 lines 0 comments Download
M src/pkg/runtime/cgo/gcc_netbsd_386.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/cgo/gcc_netbsd_amd64.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/cgo/gcc_netbsd_arm.c View 1 2 chunks +0 lines, -5 lines 0 comments Download
M src/pkg/runtime/cgo/gcc_openbsd_386.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/cgo/gcc_openbsd_amd64.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/cgo/gcc_setenv.c View 1 2 chunks +1 line, -3 lines 0 comments Download
M src/pkg/runtime/cgo/gcc_util.c View 1 3 chunks +0 lines, -6 lines 0 comments Download
M src/pkg/runtime/cgo/gcc_windows_386.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/cgo/gcc_windows_amd64.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/cgo/setenv.c View 1 1 chunk +3 lines, -11 lines 0 comments Download

Messages

Total messages: 4
rsc
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg
12 years, 2 months ago (2013-02-28 21:50:25 UTC) #1
rsc
Just moving code from file to file. TBR=anyone
12 years, 2 months ago (2013-02-28 21:54:06 UTC) #2
rsc
*** Submitted as https://code.google.com/p/go/source/detail?r=86983e7002df *** runtime/cgo: move common symbol overrides into 6c-compiled code There are ...
12 years, 2 months ago (2013-02-28 21:54:31 UTC) #3
bradfitz
12 years, 2 months ago (2013-03-01 00:37:21 UTC) #4
LGTM

On Thu, Feb 28, 2013 at 1:54 PM, <rsc@golang.org> wrote:

> *** Submitted as
>
https://code.google.com/p/go/**source/detail?r=86983e7002df<https://code.goog...
>
>
> 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://codereview.appspot.**com/7440045<https://codereview.appspot.com/7440045>
>
>
>
https://codereview.appspot.**com/7440045/<https://codereview.appspot.com/7440...
>
> --
>
> ---You received this message because you are subscribed to the Google
> Groups "golang-dev" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
golang-dev+unsubscribe@**googlegroups.com<golang-dev%2Bunsubscribe@googlegrou...
> .
> For more options, visit
https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/o...
> .
>
>
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b