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

Issue 58410043: code review 58410043: cmd/ld: fix bug with "runtime/cgo" in external link mode (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 3 months ago by iant
Modified:
10 years, 3 months ago
Reviewers:
gobot, dave, dvyukov
CC:
golang-codereviews, dvyukov, bradfitz
Visibility:
Public.

Description

cmd/ld: fix bug with "runtime/cgo" in external link mode In external link mode the linker explicitly adds the string constant "runtime/cgo". It adds the string constant using the same symbol name as the compiler, but a different format. The compiler assumes that the string data immediately follows the string header, but the linker puts the two in different sections. The result is bad string data when the compiler sees "runtime/cgo" used as a string constant. The compiler assumption is in datastring in [568]g/gobj.c. The linker layout is in addstrdata in ld/data.c. The compiler assumption is valid for string literals. The linker is not creating a string literal, so its assumption is also valid. There are a few ways to avoid this problem. This patch fixes it by only doing the fake import of runtime/cgo if necessary, and by only creating the string symbol if necessary. Fixes issue 7234.

Patch Set 1 #

Patch Set 2 : diff -r efb71a1d099d https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+42 lines, -18 lines) Patch
A misc/cgo/test/issue7234_test.go View 1 chunk +21 lines, -0 lines 0 comments Download
M src/cmd/ld/lib.c View 3 chunks +21 lines, -18 lines 0 comments Download

Messages

Total messages: 8
iant
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
10 years, 3 months ago (2014-01-29 23:09:08 UTC) #1
dvyukov
LGTM
10 years, 3 months ago (2014-01-30 06:44:45 UTC) #2
bradfitz
s/it's/its/ On Thu, Jan 30, 2014 at 12:09 AM, <iant@golang.org> wrote: > Reviewers: golang-codereviews, > ...
10 years, 3 months ago (2014-01-30 09:03:02 UTC) #3
iant
*** Submitted as https://code.google.com/p/go/source/detail?r=4193f3bd6bcc *** cmd/ld: fix bug with "runtime/cgo" in external link mode In ...
10 years, 3 months ago (2014-01-30 17:25:55 UTC) #4
gobot
This CL appears to have broken the darwin-amd64 builder.
10 years, 3 months ago (2014-01-30 17:29:23 UTC) #5
iant
On Thu, Jan 30, 2014 at 9:29 AM, <gobot@golang.org> wrote: > This CL appears to ...
10 years, 3 months ago (2014-01-30 18:52:03 UTC) #6
bradfitz
That looks like the failure Keith filed bugs about. On Jan 30, 2014 7:52 PM, ...
10 years, 3 months ago (2014-01-30 19:14:12 UTC) #7
dave_cheney.net
10 years, 3 months ago (2014-01-31 00:24:08 UTC) #8
I believe the build failure was,
https://code.google.com/p/go/issues/detail?id=7205, which is unrelated to
the commit.


On Fri, Jan 31, 2014 at 5:52 AM, Ian Lance Taylor <iant@golang.org> wrote:

> On Thu, Jan 30, 2014 at 9:29 AM,  <gobot@golang.org> wrote:
> > This CL appears to have broken the darwin-amd64 builder.
> >
> > https://codereview.appspot.com/58410043/
>
> I'm skeptical, as this CL should only affect external linking, and
> http://build.golang.org/log/840d6baa24bd3e4c3760cdc809e8fc55f73b7ac5
> is showing a segmentation violation when testing the reflect package.
> Let's see what happens after the next commit.
>
> Ian
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-codereviews" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-codereviews+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
Sign in to reply to this message.

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