Commit 1f8433c6 authored by Hiroshi Ioka's avatar Hiroshi Ioka Committed by Ian Lance Taylor

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/44771Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: 's avatarAvelino <t@avelino.xxx>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent bac1cc0d
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment