]> Cypherpunks repositories - gostls13.git/commit
cmd/link: support weak binding on darwin
authorqmuntal <quimmuntal@gmail.com>
Wed, 22 Oct 2025 14:33:18 +0000 (16:33 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Wed, 5 Nov 2025 20:38:57 +0000 (12:38 -0800)
commit8cf7a0b4c956aad5a8b98efde8ea6b7cde173902
tree0bcafd2aa09032ebe34e7780d5fc7ba489724697
parent2dd7e94e163f172472273b81846e6e3add412bc6
cmd/link: support weak binding on darwin

Symbols loaded from host files can have the N_WEAK_REF bit set,
which is used to instruct the loader to not fail if that symbol
can't be resolved.

The Go internal linker should honor this information by setting the
BIND_SYMBOL_FLAGS_WEAK_IMPORT flag in the corresponding bind table
entry.

Fixes #76023

Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64-longtest,gotip-darwin-amd64_12,gotip-darwin-arm64_12,gotip-darwin-arm64_15,gotip-darwin-arm64-longtest,gotip-darwin-amd64_14
Change-Id: Id2cef247ec7a9cb08455844f3c30ff874772bb7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/713760
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/cgo/internal/test/cgo_darwin_test.go [new file with mode: 0644]
src/cmd/cgo/internal/test/issue76023.go [new file with mode: 0644]
src/cmd/link/internal/ld/macho.go
src/cmd/link/internal/loader/loader.go
src/cmd/link/internal/loadmacho/ldmacho.go