• Ian Lance Taylor's avatar
    cmd/ld: fix bug with "runtime/cgo" in external link mode · 1683dab7
    Ian Lance Taylor authored
    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
    1683dab7
Name
Last commit
Last update
..
backdoor Loading commit data...
align.go Loading commit data...
api.go Loading commit data...
basic.go Loading commit data...
callback.go Loading commit data...
callback_c.c Loading commit data...
callback_c_gc.c Loading commit data...
callback_c_gccgo.c Loading commit data...
cflags.go Loading commit data...
cgo_linux_test.go Loading commit data...
cgo_test.go Loading commit data...
cthread.go Loading commit data...
cthread_unix.c Loading commit data...
cthread_windows.c Loading commit data...
duplicate_symbol.go Loading commit data...
env.go Loading commit data...
exports.go Loading commit data...
fpvar.go Loading commit data...
helpers.go Loading commit data...
issue1222.go Loading commit data...
issue1328.go Loading commit data...
issue1560.go Loading commit data...
issue1635.go Loading commit data...
issue2462.go Loading commit data...
issue3250.go Loading commit data...
issue3250w.go Loading commit data...
issue3261.go Loading commit data...
issue3729.go Loading commit data...
issue3729w.go Loading commit data...
issue3741.go Loading commit data...
issue3775.go Loading commit data...
issue3945.go Loading commit data...
issue4029.go Loading commit data...
issue4029w.go Loading commit data...
issue4054a.go Loading commit data...
issue4054b.go Loading commit data...
issue4273.c Loading commit data...
issue4273b.c Loading commit data...
issue4339.c Loading commit data...
issue4339.go Loading commit data...
issue4339.h Loading commit data...
issue4417.go Loading commit data...
issue4857.go Loading commit data...
issue5227.go Loading commit data...
issue5337.go Loading commit data...
issue5337w.go Loading commit data...
issue5548.go Loading commit data...
issue5548_c.c Loading commit data...
issue5603.go Loading commit data...
issue5740.go Loading commit data...
issue5740a.c Loading commit data...
issue5740b.c Loading commit data...
issue5986.go Loading commit data...
issue6128.go Loading commit data...
issue6390.go Loading commit data...
issue6472.go Loading commit data...
issue6506.go Loading commit data...
issue6612.go Loading commit data...
issue6833.go Loading commit data...
issue6833_c.c Loading commit data...
issue6997_linux.c Loading commit data...
issue6997_linux.go Loading commit data...
issue7234_test.go Loading commit data...
setgid_linux.go Loading commit data...
sleep_windows_386.go Loading commit data...