cmd/link: don't pass -Wl,-S on Solaris

Solaris linker's -S has a different meaning.

Fixes #75637.

Change-Id: I51e641d5bc6d7f64ab5aa280090c70ec787a1fbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/707096
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Cherry Mui 2025-09-26 09:45:08 -04:00
parent ae8eba071b
commit 047c2ab841
2 changed files with 2 additions and 2 deletions

View file

@ -386,7 +386,7 @@ func TestFlagW(t *testing.T) {
{"-s", false}, // -s implies -w
{"-s -w=0", true}, // -w=0 negates the implied -w
}
if testenv.HasCGO() {
if testenv.HasCGO() && runtime.GOOS != "solaris" { // Solaris linker doesn't support the -S flag
tests = append(tests,
testCase{"-w -linkmode=external", false},
testCase{"-s -linkmode=external", false},

View file

@ -1452,7 +1452,7 @@ func (ctxt *Link) hostlink() {
argv = append(argv, "-s")
}
} else if *FlagW {
if !ctxt.IsAIX() { // The AIX linker's -S has different meaning
if !ctxt.IsAIX() && !ctxt.IsSolaris() { // The AIX and Solaris linkers' -S has different meaning
argv = append(argv, "-Wl,-S") // suppress debugging symbols
}
}