mirror of
https://github.com/golang/go
synced 2024-11-19 14:54:43 -07:00
cmd/link: don't link the same dylib multiple times
Also, unexport Machoadddynlib n=`go test -c crypto/x509 && otool -l x509.test | grep libSystem | wc -l` Before this CL, n = 3. After this CL, n = 1. on my environment. Change-Id: Ic7b8157435cc85086404860dc6c84eb0aecc5d19 Reviewed-on: https://go-review.googlesource.com/44771 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Avelino <t@avelino.xxx> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
bac1cc0d16
commit
1f8433c66a
@ -175,7 +175,7 @@ func loadcgo(ctxt *Link, file string, pkg string, p string) {
|
||||
havedynamic = 1
|
||||
|
||||
if Headtype == objabi.Hdarwin {
|
||||
Machoadddynlib(lib)
|
||||
machoadddynlib(lib)
|
||||
} else {
|
||||
dynlib = append(dynlib, lib)
|
||||
}
|
||||
|
@ -380,7 +380,12 @@ func (ctxt *Link) domacho() {
|
||||
}
|
||||
}
|
||||
|
||||
func Machoadddynlib(lib string) {
|
||||
func machoadddynlib(lib string) {
|
||||
if seenlib[lib] || Linkmode == LinkExternal {
|
||||
return
|
||||
}
|
||||
seenlib[lib] = true
|
||||
|
||||
// Will need to store the library name rounded up
|
||||
// and 24 bytes of header metadata. If not enough
|
||||
// space, grab another page of initial space at the
|
||||
|
Loading…
Reference in New Issue
Block a user