1
0
mirror of https://github.com/golang/go synced 2024-11-13 18:40:22 -07:00
go/misc
Ian Lance Taylor 1683dab725 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 #7234.

LGTM=dvyukov
R=golang-codereviews, dvyukov, bradfitz
CC=golang-codereviews
https://golang.org/cl/58410043
2014-01-30 09:25:47 -08:00
..
arm
bash misc/bash: Completion for go tool. 2012-02-28 07:41:49 +11:00
bbedit misc/{bbedit|IntelliJIDEA|kate}: add missing delete predeclared identifier 2013-06-24 13:17:56 -07:00
cgo cmd/ld: fix bug with "runtime/cgo" in external link mode 2014-01-30 09:25:47 -08:00
chrome/gophertool gophertool: fix links 2012-10-22 01:05:21 +08:00
dashboard/codereview misc/dashboard/app, misc/dashboard/builder: delete from main repo; part of move to go.tools 2013-08-01 13:27:27 +10:00
emacs misc/emacs: fontify type switch correctly 2014-01-06 11:11:03 -05:00
fraise
git misc/git: add gofmt git pre-commit hook 2012-11-15 19:58:49 +01:00
goplay misc/goplay: use go run x.go instead of go build x.go 2013-07-12 09:41:10 +10:00
IntelliJIDEA misc/{bbedit|IntelliJIDEA|kate}: add missing delete predeclared identifier 2013-06-24 13:17:56 -07:00
kate misc/{bbedit|IntelliJIDEA|kate}: add missing delete predeclared identifier 2013-06-24 13:17:56 -07:00
linkcheck misc/linkcheck: better redirect handling, use meaningful exit code 2013-10-25 17:31:02 +03:00
makerelease misc/dist: rename to makerelease 2013-12-11 14:47:18 +11:00
notepadplus misc/notepadplus: Fix Function List in Notepad++ 6.5 2013-12-18 10:17:38 -08:00
swig cmd/go: add any .c/.cc files to the SWIG shared library 2013-10-09 10:35:46 -07:00
vim misc/vim: Fix broken quote 2013-12-24 08:40:13 +11:00
xcode misc/xcode: use xcode-select to determine path 2013-08-20 20:48:29 +10:00
zsh misc: update zsh completion 2013-04-07 04:11:12 +08:00
benchcmp misc/benchcmp: show byte allocation statistics 2012-12-22 14:51:16 -05:00
pprof misc/pprof: support block profile 2013-09-23 14:15:20 -07:00