Commit 7ee26224 authored by Cherry Zhang's avatar Cherry Zhang
Browse files

cmd/link: link dynamic library automatically

cgo_import_dynamic pragma indicates a symbol is imported from a
dynamic library. Currently, the linker does not actually link
against the dynamic library, so we have to "force" it by using

//go:cgo_import_dynamic _ _ "dylib"

syntax, which links in the library unconditionally.

This CL changes it to link in the library automatically when a
symbol is imported from the library, without using the "force"
syntax. (The "force" syntax is still supported.)

Remove the unconditional imports in the runtime. Now,
Security.framework and CoreFoundation.framework are only linked
when the x509 package is imported (or otherwise specified).

Fixes #40727.

Change-Id: Ied36b1f621cdcc5dc4a8f497cdf1c554a182d0e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/248333


Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: default avatarFilippo Valsorda <filippo@golang.org>
Reviewed-by: default avatarThan McIntosh <thanm@google.com>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent a22ec6e6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment