Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: burrowers/garble
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.5.1
Choose a base ref
...
head repository: burrowers/garble
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 14,013 additions and 3,278 deletions.
  1. +1 −1 .github/FUNDING.yml
  2. +53 −59 .github/workflows/test.yml
  3. +3 −1 .gitignore
  4. +5 −1 AUTHORS
  5. +316 −12 CHANGELOG.md
  6. +56 −2 CONTRIBUTING.md
  7. +87 −43 README.md
  8. +199 −53 bench_test.go
  9. +354 −0 bundled_typeparams.go
  10. +295 −0 bundled_typeutil.go
  11. +129 −0 cmdgo_quoted.go
  12. +669 −0 docs/CONTROLFLOW.md
  13. +13 −9 go.mod
  14. +22 −43 go.sum
  15. +240 −0 go_std_tables.go
  16. +214 −125 hash.go
  17. +72 −1 internal/asthelper/asthelper.go
  18. +266 −0 internal/ctrlflow/ctrlflow.go
  19. +279 −0 internal/ctrlflow/hardening.go
  20. +43 −0 internal/ctrlflow/ssa.go
  21. +311 −0 internal/ctrlflow/transform.go
  22. +555 −0 internal/ctrlflow/trash.go
  23. +100 −0 internal/ctrlflow/trash_test.go
  24. +264 −0 internal/linker/linker.go
  25. +9 −0 internal/linker/patches/README
  26. +47 −0 internal/linker/patches/go1.23/0001-add-custom-magic-value.patch
  27. +85 −0 internal/linker/patches/go1.23/0002-add-unexported-function-name-removing.patch
  28. +43 −0 internal/linker/patches/go1.23/0003-add-entryOff-encryption.patch
  29. +47 −0 internal/linker/patches/go1.24/0001-add-custom-magic-value.patch
  30. +85 −0 internal/linker/patches/go1.24/0002-add-unexported-function-name-removing.patch
  31. +43 −0 internal/linker/patches/go1.24/0003-add-entryOff-encryption.patch
  32. +106 −0 internal/literals/fuzz_test.go
  33. +124 −102 internal/literals/literals.go
  34. +46 −26 internal/literals/obfuscators.go
  35. +31 −0 internal/literals/random_testing.go
  36. +4 −3 internal/literals/seed.go
  37. +34 −14 internal/literals/shuffle.go
  38. +4 −3 internal/literals/simple.go
  39. +17 −24 internal/literals/split.go
  40. +7 −7 internal/literals/swap.go
  41. +1,193 −0 internal/ssa2ast/func.go
  42. +408 −0 internal/ssa2ast/func_test.go
  43. +73 −0 internal/ssa2ast/helpers_test.go
  44. +176 −0 internal/ssa2ast/polyfill.go
  45. +262 −0 internal/ssa2ast/type.go
  46. +104 −0 internal/ssa2ast/type_test.go
  47. +1,375 −1,071 main.go
  48. +204 −78 main_test.go
  49. +104 −107 position.go
  50. +480 −0 reflect.go
  51. +273 −0 reflect_abi_code.go
  52. +79 −0 reflect_abi_patch.go
  53. +30 −49 reverse.go
  54. +268 −0 runtime_patch.go
  55. +0 −187 runtime_strip.go
  56. +160 −0 scripts/bench_literals.go
  57. +5 −0 scripts/cached_modfiles/github.com_andybalholm_brotli.mod
  58. +2 −0 scripts/cached_modfiles/github.com_andybalholm_brotli.sum
  59. +8 −0 scripts/cached_modfiles/github.com_samber_lo.mod
  60. +4 −0 scripts/cached_modfiles/github.com_samber_lo.sum
  61. +14 −0 scripts/cached_modfiles/golang.zx2c4.com_wireguard.mod
  62. +16 −0 scripts/cached_modfiles/golang.zx2c4.com_wireguard.sum
  63. +10 −0 scripts/cached_modfiles/google.golang.org_protobuf.mod
  64. +9 −0 scripts/cached_modfiles/google.golang.org_protobuf.sum
  65. +92 −0 scripts/check-third-party.sh
  66. +13 −14 scripts/crlf-test.sh
  67. +242 −0 scripts/gen_go_std_tables.go
  68. +0 −21 scripts/runtime-linknamed-nodeps.sh
  69. +281 −97 shared.go
  70. +0 −16 testdata/bench-nocache/main.go
  71. +3 −0 testdata/{bench-cache → bench}/main.go
  72. +13 −1 testdata/mod/gopkg.in_garbletest.v2_v2.999.0.txt
  73. +32 −0 testdata/mod/gopkg.in_garbletestconst.v2_v2.999.0.txt
  74. +4 −0 testdata/mod/rsc.io_sampler_v1.3.0.txt
  75. +4 −0 testdata/mod/rsc.io_sampler_v1.99.99.txt
  76. +156 −0 testdata/script/asm.txtar
  77. +51 −0 testdata/script/atomic.txtar
  78. +6 −5 testdata/{scripts/basic.txt → script/basic.txtar}
  79. +100 −0 testdata/script/cache.txtar
  80. +122 −0 testdata/script/cgo.txtar
  81. +52 −0 testdata/script/crossbuild.txtar
  82. +119 −0 testdata/script/ctrlflow.txtar
  83. +6 −9 testdata/{scripts/debugdir.txt → script/debugdir.txtar}
  84. +2 −6 testdata/{scripts/embed.txt → script/embed.txtar}
  85. +55 −0 testdata/script/goenv.txtar
  86. +49 −22 testdata/{scripts/gogarble.txt → script/gogarble.txtar}
  87. +109 −0 testdata/script/goversion.txtar
  88. +122 −0 testdata/script/help.txtar
  89. +43 −9 testdata/{scripts/implement.txt → script/implement.txtar}
  90. +57 −20 testdata/{scripts/imports.txt → script/imports.txtar}
  91. +2 −3 testdata/{scripts/init.txt → script/init.txtar}
  92. +21 −8 testdata/{scripts/ldflags.txt → script/ldflags.txtar}
  93. +74 −0 testdata/script/linker.txtar
  94. +193 −0 testdata/script/linkname.txtar
  95. +29 −0 testdata/script/list_error.txtar
  96. +204 −68 testdata/{scripts/literals.txt → script/literals.txtar}
  97. +9 −10 testdata/{scripts/modinfo.txt → script/modinfo.txtar}
  98. +3 −6 testdata/{scripts/plugin.txt → script/plugin.txtar}
  99. +9 −5 testdata/{scripts/position.txt → script/position.txtar}
  100. +645 −0 testdata/script/reflect.txtar
  101. +20 −53 testdata/{scripts/reverse.txt → script/reverse.txtar}
  102. +29 −0 testdata/script/run.txtar
  103. +72 −0 testdata/script/seed-cache.txtar
  104. +233 −0 testdata/script/seed.txtar
  105. +29 −12 testdata/{scripts/syntax.txt → script/syntax.txtar}
  106. +44 −7 testdata/{scripts/test.txt → script/test.txtar}
  107. +74 −0 testdata/script/tiny.txtar
  108. +55 −0 testdata/script/typeparams.txtar
  109. +0 −64 testdata/scripts/asm.txt
  110. +0 −71 testdata/scripts/cgo.txt
  111. +0 −26 testdata/scripts/crossbuild.txt
  112. +0 −74 testdata/scripts/goversion.txt
  113. +0 −93 testdata/scripts/help.txt
  114. +0 −117 testdata/scripts/linkname.txt
  115. +0 −255 testdata/scripts/reflect.txt
  116. +0 −115 testdata/scripts/seed.txt
  117. +0 −50 testdata/scripts/tiny.txt
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github: [mvdan, lu4p]
github: [mvdan, lu4p, pagran]
112 changes: 53 additions & 59 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -2,41 +2,74 @@ on:
push:
branches:
- master
- ci-test
pull_request:
branches:
- master

# Note that a full "go test" is quite heavy,
# as it runs many builds under the hood.
# The default -timeout=10m can be hit by the hosted runners.
#
# Also note that we don't use Actions caching for Go on purpose.
# Caching GOMODCACHE wouldn't help much, as we have few deps.
# Caching GOCACHE would do more harm than good,
# as the tests redo most of their work if the garble version changes,
# and the majority of commits or PRs will do so.
# Moreover, GitHub saves and restores caches via compressed archives over the
# network, which means it can easily add one minute of overhead on its own for
# just a few hundred megabytes worth of files.

name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.17.x]
go-version: [1.23.x, 1.24.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: |
go env
go test -timeout=15m ./...
- name: Test with -race
# macos and windows tend to be a bit slower,
# and it's rare that a race in garble would be OS-specific.
if: matrix.os == 'ubuntu-latest'
cache: false
# linux already runs the tests with -race below, plus extra checks,
# so skip the regular tests to prevent it from taking the longest.
- if: matrix.os != 'ubuntu-latest'
run: go test -timeout=15m ./...
# macos and windows failures with bincmp can be hard to reproduce locally,
# so upload the binaries as artifacts.
- uses: actions/upload-artifact@v4
if: failure()
with:
name: bincmp_output
path: bincmp_output/
# macos and windows tend to be a bit slower,
# and it's rare that a race in garble would be OS-specific.
- if: matrix.os == 'ubuntu-latest'
run: go test -race -timeout=20m ./...

# Static checks from this point forward. Only run on one Go version and on
# linux, since it's the fastest platform, and the tools behave the same.
- name: Test third-party project builds
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.24.x'
run: |
go test -race -timeout=20m ./...
go install
./scripts/check-third-party.sh
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.24.x'
run: ./scripts/crlf-test.sh
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.24.x'
run: diff <(echo -n) <(gofmt -d .)
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.24.x'
run: go vet ./...
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.24.x'
uses: dominikh/staticcheck-action@v1
with:
version: "2025.1"
install-go: false

# We don't care about GOARCH=386 particularly,
# We don't care about GOARCH=386 particularly, hence -short,
# but it helps ensure we support 32-bit hosts and targets well.
# TODO: use CGO_ENABLED=1 once we figure out how to install gcc-multilib,
# and once gotooltest forwards the value of CGO_ENABLED to the scripts.
@@ -45,48 +78,9 @@ jobs:
env:
GOARCH: 386
steps:
- name: Install Go
uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.17.x
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: |
go env
go test -timeout=15m ./...
test-gotip:
runs-on: ubuntu-latest
steps:
- name: Install Go
env:
GO_COMMIT: 3b5eec937018be98549dea7067964018f0e5824c # 2022-01-14
run: |
cd $HOME
mkdir $HOME/gotip
cd $HOME/gotip
wget -O gotip.tar.gz https://go.googlesource.com/go/+archive/${GO_COMMIT}.tar.gz
tar -xf gotip.tar.gz
echo "devel go1.18-${GO_COMMIT}" >VERSION
cd src
# GOGC=off helps Go build about 20% faster, if we can spare memory.
GOGC=off ./make.bash
echo "GOROOT=$HOME/gotip" >>$GITHUB_ENV
echo "$HOME/gotip/bin" >>$GITHUB_PATH
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: |
go env
go test -timeout=15m ./...
code-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Test that only LF line endings are used
run: ./scripts/crlf-test.sh
go-version: 1.24.x
cache: false
- run: go test -short ./...
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/garble
/test
/test
/bincmp_output/
debug
6 changes: 5 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -8,7 +8,11 @@

Andrew LeFevre <jalefevre@liberty.edu>
Daniel Martí <mvdan@mvdan.cc>
Emmanuel Chee-zaram Okeke <ecokeke21@gmail.com>
NHAS <jordanatararimu@gmail.com>
Nicholas Jones <me@nicholasjon.es>
Paul Scheduikat <lu4p@pm.me>
Zachary Wasserman <zachwass2000@gmail.com>
lu4p <lu4p@pm.me>
pagran <pagran@protonmail.com>
shellhazard <shellhazard@tutanota.com>
xuannv <xuan11290@gmail.com>
Loading