go-delve / delve

Delve is a debugger for the Go programming language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unpredictable debugger link error

WutingjiaX opened this issue · comments

  1. What version of Delve are you using (dlv version)?
    I have tried 1.21.2 and 1.22.0

  2. What version of Go are you using? (go version)?
    1.18.10

  3. What operating system and processor architecture are you using?
    MacOS M1 pro

  4. my clang version is:

Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.0.0
Thread model: posix
  1. What did you do?
    I just
dlv debug

and part of out put is:

**/opt/homebrew/Cellar/go@1.18/1.18.10/libexec/pkg/tool/darwin_arm64/link: running clang failed: exit status 1**
ld: warning: -bind_at_load is deprecated on macOS
ld: warning: '/private/var/folders/b1/0fd1b6hs7lz0fm_mh346lybm0000gn/T/go-link-2944169425/go.o' has malformed LC_DYSYMTAB, expected 127 undefined symbols to start at index 555876, found 147 undefined symbols starting at index 122
**ld: B/BL out of range -142357712 (max +/-128MB) to '_runtime.memequal'
clang: error: linker command failed with exit code 1 (use -v to see invocation)**

I have no idea what kind of operation would lead to such a result. Sometimes I add an assignment statement to the code, and sometimes I upgrade the go mod, both of which can result in such results. It is normal for the compiled product to run normally.

This is a bug with Go's linker, not with the delve. You may be seeing it only when you compile with delve because we run the compiler with optimizations and inlining disabled and it will produce more/different code.

The right place to report this bug is https://github.com/golang/go/issues/ but without a reproducer it's going to be difficult to figure out what's wrong.

This is a bug with Go's linker, not with the delve. You may be seeing it only when you compile with delve because we run the compiler with optimizations and inlining disabled and it will produce more/different code.

The right place to report this bug is https://github.com/golang/go/issues/ but without a reproducer it's going to be difficult to figure out what's wrong.

thanks~