]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: sort HOSTOBJ and UNDEFEXT symbols with undefined symbols in Mach-O symbol...
authorCherry Mui <cherryyz@google.com>
Wed, 14 Jun 2023 22:31:44 +0000 (18:31 -0400)
committerCherry Mui <cherryyz@google.com>
Thu, 27 Jul 2023 19:08:00 +0000 (19:08 +0000)
HOSTOBJ and UNDEFEXT symbols are actually not defined in the
current translation unit. So put them as undefined symbols, along
with DYNIMPORT.

For #61229.

Change-Id: I1112ca928cdc401bac45adaa3f88b19422813960
Reviewed-on: https://go-review.googlesource.com/c/go/+/503539
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/macho.go

index f48653b9107a71c3c18815091895b9a6d9f325fb..6722eed4bad9550b0ebc1b373b90aa76bc0132dd 100644 (file)
@@ -877,7 +877,7 @@ func asmbMacho(ctxt *Link) {
 }
 
 func symkind(ldr *loader.Loader, s loader.Sym) int {
-       if ldr.SymType(s) == sym.SDYNIMPORT {
+       if t := ldr.SymType(s); t == sym.SDYNIMPORT || t == sym.SHOSTOBJ || t == sym.SUNDEFEXT {
                return SymKindUndef
        }
        if ldr.AttrCgoExport(s) {