]> Cypherpunks repositories - gostls13.git/commit
cmd/link/internal/ld: copy Mach-O platform version commands to go.o
authorElias Naur <mail@eliasnaur.com>
Tue, 19 Mar 2019 11:19:48 +0000 (13:19 +0200)
committerElias Naur <mail@eliasnaur.com>
Thu, 21 Mar 2019 08:41:51 +0000 (08:41 +0000)
commit277609f844ed9254d25e975f7cf202d042beecc6
tree5dddab0e2f1aa96a8f1ab1b334e1d567776c27c2
parent0fe1986a72ea578390d4909988a1d7cb3a687544
cmd/link/internal/ld: copy Mach-O platform version commands to go.o

To build for watchOS and tvOS the Apple toolchain requires a Mach-O
load command that matches the platform for all object files in a build.
The go.o object file produced by the Go linker contains no such command.

The loader commands are mutually exclusive so we need to pick the
right one. Fortunately, cgo must be enabled for watchOS and tvOS to
be useful, so we can copy the first loader command we find in the object
files produced by the host compiler.

Add a test that builds a small program for tvOS to test both this CL
and the previous CL that added bitcode support.

Updates #22395

Change-Id: I7a47d19be9d80f0459dc358c600cddd9f236c444
Reviewed-on: https://go-review.googlesource.com/c/go/+/168321
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/link/dwarf_test.go
src/cmd/link/internal/ld/macho.go
src/cmd/link/testdata/lib.go [new file with mode: 0644]
src/cmd/link/testdata/main.m [new file with mode: 0644]