burrowers / garble

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

Support for Go 1.23 #859

Closed stefanb closed 1 month ago

stefanb commented 3 months ago

What version of Garble and Go are you using?

$ ./garble version     
mvdan.cc/garble v0.0.0-20240425150835-c41f026cd6df

Build settings:
      -buildmode exe
       -compiler gc
  DefaultGODEBUG asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1
     CGO_ENABLED 1
          GOARCH arm64
            GOOS darwin
         GOARM64 v8.0
             vcs git
    vcs.revision c41f026cd6df95e98667934e4895678dae28e11f
        vcs.time 2024-04-25T15:08:35Z
    vcs.modified false

$ go1.23rc1 version
go version go1.23rc1 darwin/arm64

What environment are you running Garble on?

go env Output
$ go env

What did you do?

$ go1.23rc1 build -v ./...
mvdan.cc/garble/internal/asthelper
mvdan.cc/garble/internal/linker
mvdan.cc/garble/internal/ssa2ast
mvdan.cc/garble/internal/literals
mvdan.cc/garble/internal/ctrlflow
mvdan.cc/garble
$ PATH=$(go1.23rc1 env GOROOT)/bin:${PATH} ./garble build ./...
Go version "go1.23rc1" is too new; Go linker patches aren't available for go1.23 or later yet

What did you expect to see?

build to succeed

What did you see instead?

Error

Go version "go1.23rc1" is too new; Go linker patches aren't available for go1.23 or later yet


Note, this nicer error shows on current master, because commit https://github.com/burrowers/garble/commit/9a2ef369b2ee71481ff62ffc9ad699bc6c20aacc wasn't released yet in current v0.12.1.

In https://github.com/Homebrew/homebrew-core/pull/175310 test failed more cryptically:

  # runtime
  panic: package "internal/coverage/cfile" still missing after go list call

  goroutine 1 [running]:
  main.listPackage(0x14000186600, {0x140000f3e89, 0x17})
    mvdan.cc/garble/shared.go:385 +0x5c4
  main.(*transformer).transformLinkname(0x140000bc8a0, {0x140000f3e6e?, 0x100dfa138?}, {0x140000f3e89, 0x29})
    mvdan.cc/garble/main.go:1157 +0x2d4
  main.(*transformer).transformDirectives(0x140000bc8a0, {0x14000314b10, 0x2, 0x16f41747d?})
    mvdan.cc/garble/main.go:1097 +0x124
  main.(*transformer).transformCompile(0x140000bc8a0, {0x140000b2c58?, 0x1400002e3b4?, 0x7?})
    mvdan.cc/garble/main.go:1044 +0x95c
  main.mainErr({0x140000b2c38, 0xb7, 0x101014060?})
    mvdan.cc/garble/main.go:458 +0x738
  main.main1()
    mvdan.cc/garble/main.go:255 +0x21c
  main.main()
    mvdan.cc/garble/main.go:147 +0x1c
  exit status 1
mvdan commented 1 month ago

I am working on this - later than previous releases, and perhaps not in time for the final Go 1.23 release, but I will finish it.

mvdan commented 1 month ago

I think all the changes above should mean complete support. It is very late and I'm going to sleep before CI has had a chance to finish.

mvdan commented 1 month ago

Ah, I broke Go 1.22. I know how to fix it, but that will be for tomorrow.

mvdan commented 1 month ago

https://github.com/burrowers/garble/pull/871 should be ready now; reviewers welcome. There are a number of commits to split up each of the steps I had to take.

mvdan commented 1 month ago

Please try master and let me know how it works with Go 1.23. I will tag a release in a day's time unless any bugs or regressions are reported.

mvdan commented 1 month ago

Release done: https://github.com/burrowers/garble/releases/tag/v0.13.0