]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: don't pass -Wl,-S on Solaris
authorCherry Mui <cherryyz@google.com>
Fri, 26 Sep 2025 13:45:08 +0000 (09:45 -0400)
committerCherry Mui <cherryyz@google.com>
Mon, 29 Sep 2025 17:10:22 +0000 (10:10 -0700)
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>
src/cmd/link/dwarf_test.go
src/cmd/link/internal/ld/lib.go

index 4fce358e602de5d85bb9194fbdb223aa481482f1..56a076002a92d4b3a04c60920c452a6020942b11 100644 (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},
index 8d2763bb57f31ad599ced895a9c12f11c0483c3a..c7596d535e0ee5153dc6ab16ff76d8ff98f8a4b8 100644 (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
                }
        }