cmd/internal/ld: add -buildmode=c-shared as an alternative to -shared

The linker currently (on some platforms) takes a -shared flag, which means
approximately what -buildmode=c-shared means in the in the proposed "Go
Execution Modes" document. As part of implementing other modes, the term
"shared" becomes horribly overloaded, so this replaces -shared with a
-buildmode argument instead (which currently only handles -buildmode=c-shared
and the default -buildmode=exe -- no new behaviour here).

As the linker support for -shared was in 1.4 this retains it as an alias.

Change-Id: Id2ebb8e05ee07f46208a554bc2622d0e67b47082
Reviewed-on: https://go-review.googlesource.com/8304
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Michael Hudson-Doyle 2015-03-27 02:48:27 +00:00 committed by Ian Lance Taylor
parent 47746f10fe
commit 2a5f88d850
8 changed files with 67 additions and 15 deletions

View file

@ -960,7 +960,7 @@ func dosymtype() {
}
// Create a new entry in the .init_array section that points to the
// library initializer function.
if Flag_shared != 0 && s.Name == INITENTRY {
if Buildmode == BuildmodeCShared && s.Name == INITENTRY {
addinitarrdata(s)
}
}
@ -1322,7 +1322,7 @@ func dodata() {
sect.Length = uint64(datsize) - sect.Vaddr
/* shared library initializer */
if Flag_shared != 0 {
if Buildmode == BuildmodeCShared {
sect := addsection(&Segdata, ".init_array", 06)
sect.Align = maxalign(s, SINITARR)
datsize = Rnd(datsize, int64(sect.Align))