]> Cypherpunks repositories - gostls13.git/commit
cmd/link, cmd/go, cmd/dist: use copy of libgcc.a for internal linking
authorIan Lance Taylor <iant@golang.org>
Wed, 4 Nov 2015 19:14:19 +0000 (11:14 -0800)
committerIan Lance Taylor <iant@golang.org>
Sat, 14 Nov 2015 18:56:17 +0000 (18:56 +0000)
commit754f707f5f6b870892b78814bac4f90086312039
tree06562eb98e044e174ce636b59411f814318b30f3
parent5a0d9ef87387ce620af03274be2dd34a8ba4a99c
cmd/link, cmd/go, cmd/dist: use copy of libgcc.a for internal linking

Change the linker to use a copy of the C compiler support library,
libgcc.a, when doing internal linking.  This will be used to satisfy any
undefined symbols referenced by host objects.

Change the dist tool to copy the support library into a new directory
tree under GOROOT/pkg/libgcc.  This ensures that libgcc is available
even when building Go programs on a system that has no C compiler.  The
C compiler is required when building the Go installation in the first
place, but is not required thereafter.

Change the go tool to not link libgcc into cgo objects.

Correct the linker handling of a weak symbol in an ELF input object to
not always create a new symbol, but to use an existing symbol if there
is one; this is necessary on freebsd-amd64, where libgcc contains a weak
definition of compilerrt_abort_impl.

Fixes #9510.

Change-Id: I1ab28182263238d9bcaf6a42804e5da2a87d8778
Reviewed-on: https://go-review.googlesource.com/16741
Reviewed-by: Russ Cox <rsc@golang.org>
misc/cgo/test/cgo_test.go
misc/cgo/test/issue9510.go [new file with mode: 0644]
misc/cgo/test/issue9510a/a.go [new file with mode: 0644]
misc/cgo/test/issue9510b/b.go [new file with mode: 0644]
src/cmd/dist/build.go
src/cmd/go/build.go
src/cmd/link/internal/ld/ar.go
src/cmd/link/internal/ld/ldelf.go
src/cmd/link/internal/ld/lib.go