mirror of
https://github.com/golang/go.git
synced 2025-05-29 19:35:42 +00:00
runtime: add isarchive, set by the linker
According to Go execution modes, a Go program compiled with -buildmode=c-archive has a main function, but it is ignored on run. This gives the runtime the information it needs not to run the main. I have this working with pending linker changes on darwin/amd64. Change-Id: I49bd7d65aa619ec847c464a872afa5deea7d4d30 Reviewed-on: https://go-review.googlesource.com/8701 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
d340b10366
commit
d1b1eee280
@ -99,6 +99,11 @@ func main() {
|
|||||||
needUnlock = false
|
needUnlock = false
|
||||||
unlockOSThread()
|
unlockOSThread()
|
||||||
|
|
||||||
|
if isarchive {
|
||||||
|
// A program compiled with -buildmode=c-archive has a main,
|
||||||
|
// but it is not executed.
|
||||||
|
return
|
||||||
|
}
|
||||||
main_main()
|
main_main()
|
||||||
if raceenabled {
|
if raceenabled {
|
||||||
racefini()
|
racefini()
|
||||||
|
@ -621,9 +621,12 @@ var (
|
|||||||
cpuid_ecx uint32
|
cpuid_ecx uint32
|
||||||
cpuid_edx uint32
|
cpuid_edx uint32
|
||||||
lfenceBeforeRdtsc bool
|
lfenceBeforeRdtsc bool
|
||||||
|
)
|
||||||
|
|
||||||
// Set by the linker when linking with -shared.
|
// Set by the linker so the runtime can determine the buildmode.
|
||||||
islibrary bool
|
var (
|
||||||
|
islibrary bool // -buildmode=c-shared
|
||||||
|
isarchive bool // -buildmode=c-archive
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user