avoid obfuscating crypto/internal/fips140/...

Attempting to fix a failure on GOOS=darwin:

    > exec garble -literals build std
    [stderr]
    # crypto/internal/fips140
    <autogenerated>:1: crypto/internal/fips140.YVgfcHoMsU1M.func1.jump7: invalid relocation R_ADDR in fips data (SDATAFIPS)

And other failures I was seeing on Linux relating to `var RODATA`.
This commit is contained in:
Daniel Martí
2026-03-15 21:27:48 +00:00
committed by Paul
parent 639946fded
commit 2322872d3b
+6 -1
View File
@@ -387,7 +387,12 @@ func appendListedPackages(packages []string, mainBuild bool) error {
// We do not support obfuscating the runtime nor its dependencies.
case runtimeAndDeps[path],
// "unknown pc" crashes on windows in the cgo test otherwise.
path == "runtime/cgo":
path == "runtime/cgo",
// Obfuscating any of the fips140 packages breaks builds,
// not just because their import paths get special treatment,
// but also because they have special vars like "RODATA"
// and forbid relocations caused by literal obfuscation.
path == "crypto/internal/fips140", strings.HasPrefix(path, "crypto/internal/fips140/"):
// No point in obfuscating empty packages, like OS-specific ones that don't match.
case len(pkg.CompiledGoFiles) == 0: