]> Cypherpunks repositories - gostls13.git/commit
cmd/link: suppress symbol table on Mach-O when -s
authorCherry Mui <cherryyz@google.com>
Fri, 5 May 2023 21:04:45 +0000 (17:04 -0400)
committerCherry Mui <cherryyz@google.com>
Fri, 21 Jul 2023 15:42:40 +0000 (15:42 +0000)
commit1d84c89bec2ad5a4a186afe40ef1910e33376a43
tree96247de50614def446253b7f8eb0d77b4f23401e
parent3437ff0d7ad9b556b534871dec14bf4ac4e603fe
cmd/link: suppress symbol table on Mach-O when -s

Currently, on Mach-O, we don't strip the symbol table even the -s
flag is set. This CL makes it suppress the symbol table, as
documented.

On Mach-O, even with -s, we still need to keep symbols that are
dynamically exported or referenced symbol. Otherwise the dynamic
linker cannot resolve them and the binary doesn't run.
(Interestingly, for a PIE binary it is okay to strip the symbol
table entirely. We keep the dynamic symbols for consistency. And
this is also in consistent with what the system "strip" command
does.)

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