]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: ignore GCC generated .wm4/.wm8 symbols with no type
authorIan Lance Taylor <iant@golang.org>
Thu, 5 Feb 2026 04:58:51 +0000 (20:58 -0800)
committerGopher Robot <gobot@golang.org>
Fri, 6 Feb 2026 17:37:39 +0000 (09:37 -0800)
Fixes #77436

Change-Id: I37d852a89678c929156c4765e774c819eb515e6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/742220
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

src/cmd/go/testdata/script/cgo_g3.txt [new file with mode: 0644]
src/cmd/link/internal/loadelf/ldelf.go

diff --git a/src/cmd/go/testdata/script/cgo_g3.txt b/src/cmd/go/testdata/script/cgo_g3.txt
new file mode 100644 (file)
index 0000000..ada9a8c
--- /dev/null
@@ -0,0 +1,18 @@
+[!cgo] skip
+
+# Test that -g3 works with cgo.
+env CGO_CFLAGS=-g3
+go build
+
+-- go.mod --
+module cgog3
+
+go 1.25
+-- m.go --
+package main
+
+import "os/user"
+
+func main() {
+       user.Current()
+}
index 239d4c169dcfd91ae01314c67935ae75cf3191bc..c5c4645656c0e2b5ec093085456085970d2856a8 100644 (file)
@@ -615,6 +615,14 @@ func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, f *bio.Reader,
                                        // Symbols generated by the relax feature of gcc and binutils on loong64.
                                        continue
                                }
+
+                               if strings.HasPrefix(elfsym.name, "wm4.") || strings.HasPrefix(elfsym.name, "wm8.") {
+                                       // Symbols generated by GCC as
+                                       // group symbols to eliminate
+                                       // duplicate debug info for
+                                       // preprocessor symbols.
+                                       continue
+                               }
                        }
 
                        if strings.HasPrefix(elfsym.name, ".Linfo_string") {