[release-branch.go1.8] cmd/link: do not pass -s through to host linker on macOS

This keeps the host linker from printing
ld: warning: option -s is obsolete and being ignored

Fixes #19775.

Change-Id: I18dd4e4b3f59cbf35dad770fd65e6baea5a7347f
Reviewed-on: https://go-review.googlesource.com/38851
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/39606
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Russ Cox 2017-03-29 20:39:32 -04:00
parent 6c5abcf21a
commit 3a8841bcaf
1 changed files with 4 additions and 0 deletions

View File

@ -998,6 +998,10 @@ func (l *Link) hostlink() {
if !*FlagS && !debug_s {
argv = append(argv, "-gdwarf-2")
} else if Headtype == obj.Hdarwin {
// Recent versions of macOS print
// ld: warning: option -s is obsolete and being ignored
// so do not pass any arguments.
} else {
argv = append(argv, "-s")
}