burrowers / garble

Obfuscate Go builds
BSD 3-Clause "New" or "Revised" License
3.73k stars 239 forks source link

run binary got fatal error: invalid function symbol table after garble build with go 1.22+ #839

Closed nickolastone closed 1 week ago

nickolastone commented 4 months ago

runtime: pcHeader: magic= 0xfffffff1 pad1= 0 pad2= 0 minLC= 1 ptrSize= 8 pcHeader.textStart= 0x56f8000 text= 0x56f8000 pluginpath= fatal error: invalid function symbol table

$ garble version
mvdan.cc/garble v0.12.1

Build settings:
      -buildmode exe
       -compiler gc
  DefaultGODEBUG httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1
     CGO_ENABLED 1
          GOARCH arm64
            GOOS darwin

$ go version
go version go1.22.1 darwin/arm64

What environment are you running Garble on?

garble -literals -seed=random build -ldflags "-s -w" -trimpath

go env Output
$ go env
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/nickolast/Library/Caches/go-build'
GOENV='/Users/nickolast/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/nickolast/go/pkg/mod'
GOOS='darwin'
GOPATH='/Users/nickolast/go'
GOPROXY='https://goproxy.cn,direct'
GOROOT='/opt/homebrew/Cellar/go/1.22.1/libexec'
GOSUMDB='sum.golang.google.cn'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.1/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.1'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/nickolast/code/test/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/9r/n4smctzd5tx3vr1z48tmn1y00000gn/T/go-build3876726514=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

  1. run garble -literals -seed=random build -ldflags "-s -w" -trimpath main.go
  2. ./main
  3. got fatal error: invalid function symbol table

What did you expect to see?

run successed with golang 1.21.7 run successed with golang 1.22+

What did you see instead?

run successed with golang 1.21.7 run failed with golang 1.22+

mvdan commented 4 months ago

Interesting, thanks for the report. Do you have any way for us to reproduce the issue, or any more details? Unfortunately this isn't enough for us to figure out what the bug or fix are.

mvdan commented 1 week ago

Closing for now because we can't investigate a panic we cannot reproduce.