]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/link: set cgo attributes early when internal cgo linking
authorCherry Zhang <cherryyz@google.com>
Fri, 1 Nov 2019 14:58:27 +0000 (10:58 -0400)
committerCherry Zhang <cherryyz@google.com>
Sat, 2 Nov 2019 00:36:59 +0000 (00:36 +0000)
commit48a0b979022d604771767cd03634986669c064ab
treef251e5b01ca32c5ec792424059d42eb5afee788b
parentdfd8de10040eb64dc255d1f6ed98728b169af885
[dev.link] cmd/link: set cgo attributes early when internal cgo linking

In newobj mode, cgo attributes are typically set later, as we
create sym.Symbols later. But when internal cgo linking, the
host object loaders still work with sym.Symbols, and the cgo
attributes need to be set for them to work properly. Therefore,
set them early. This will cause creating some Symbols eagerly,
but they are mostly host object symbols and will need to be
created anyway.

Now all cgo internal linking tests pass on ELF systems.

Change-Id: I023a4df4429acc8ebf5e185f62e6809198497a78
Reviewed-on: https://go-review.googlesource.com/c/go/+/204857
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/go.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/loadelf/ldelf.go
src/cmd/link/internal/loader/loader.go
src/cmd/link/internal/loadmacho/ldmacho.go
src/cmd/link/internal/loadxcoff/ldxcoff.go