mirror of
https://github.com/golang/go
synced 2024-11-19 01:54:39 -07:00
cmd/compile: cleanup -dynlink/-shared support check
Moves the list of architectures that support shared libraries into a function. Also adds s390x to that list. Change-Id: I99c8a9f6cd4816ce3d53abaabaf8d002e25e6b28 Reviewed-on: https://go-review.googlesource.com/21661 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com> Run-TryBot: Michael Munday <munday@ca.ibm.com>
This commit is contained in:
parent
49e07f2b7e
commit
d22357ce9d
@ -91,6 +91,12 @@ func doversion() {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// supportsDynlink reports whether or not the code generator for the given
|
||||||
|
// architecture supports the -shared and -dynlink flags.
|
||||||
|
func supportsDynlink(arch *sys.Arch) bool {
|
||||||
|
return arch.InFamily(sys.AMD64, sys.ARM, sys.ARM64, sys.I386, sys.PPC64, sys.S390X)
|
||||||
|
}
|
||||||
|
|
||||||
func Main() {
|
func Main() {
|
||||||
defer hidePanic()
|
defer hidePanic()
|
||||||
|
|
||||||
@ -195,15 +201,13 @@ func Main() {
|
|||||||
obj.Flagcount("y", "debug declarations in canned imports (with -d)", &Debug['y'])
|
obj.Flagcount("y", "debug declarations in canned imports (with -d)", &Debug['y'])
|
||||||
var flag_shared int
|
var flag_shared int
|
||||||
var flag_dynlink bool
|
var flag_dynlink bool
|
||||||
if Thearch.LinkArch.InFamily(sys.ARM, sys.AMD64, sys.ARM64, sys.I386, sys.PPC64) {
|
if supportsDynlink(Thearch.LinkArch.Arch) {
|
||||||
obj.Flagcount("shared", "generate code that can be linked into a shared library", &flag_shared)
|
obj.Flagcount("shared", "generate code that can be linked into a shared library", &flag_shared)
|
||||||
|
flag.BoolVar(&flag_dynlink, "dynlink", false, "support references to Go symbols defined in other shared libraries")
|
||||||
}
|
}
|
||||||
if Thearch.LinkArch.Family == sys.AMD64 {
|
if Thearch.LinkArch.Family == sys.AMD64 {
|
||||||
obj.Flagcount("largemodel", "generate code that assumes a large memory model", &flag_largemodel)
|
obj.Flagcount("largemodel", "generate code that assumes a large memory model", &flag_largemodel)
|
||||||
}
|
}
|
||||||
if Thearch.LinkArch.InFamily(sys.ARM, sys.AMD64, sys.ARM64, sys.I386, sys.PPC64) {
|
|
||||||
flag.BoolVar(&flag_dynlink, "dynlink", false, "support references to Go symbols defined in other shared libraries")
|
|
||||||
}
|
|
||||||
obj.Flagstr("cpuprofile", "write cpu profile to `file`", &cpuprofile)
|
obj.Flagstr("cpuprofile", "write cpu profile to `file`", &cpuprofile)
|
||||||
obj.Flagstr("memprofile", "write memory profile to `file`", &memprofile)
|
obj.Flagstr("memprofile", "write memory profile to `file`", &memprofile)
|
||||||
obj.Flagint64("memprofilerate", "set runtime.MemProfileRate to `rate`", &memprofilerate)
|
obj.Flagint64("memprofilerate", "set runtime.MemProfileRate to `rate`", &memprofilerate)
|
||||||
|
Loading…
Reference in New Issue
Block a user