You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
garble/go_std_tables.go

274 lines
10 KiB
Go

// Code generated by scripts/gen_go_std_tables.go; DO NOT EDIT.
// Generated from Go versions [go1.25.0].
package main
// runtimeAndDeps contains the runtime package and all of its transitive dependencies
// as reported by 'go list -deps'.
var runtimeAndDeps = map[string]bool{
"internal/abi": true, // go1.25
"internal/asan": true, // go1.25
"internal/bytealg": true, // go1.25
"internal/byteorder": true, // go1.25
"internal/chacha8rand": true, // go1.25
"internal/coverage/rtcov": true, // go1.25
"internal/cpu": true, // go1.25
"internal/goarch": true, // go1.25
"internal/godebugs": true, // go1.25
"internal/goexperiment": true, // go1.25
"internal/goos": true, // go1.25
"internal/msan": true, // go1.25
"internal/profilerecord": true, // go1.25
"internal/race": true, // go1.25
"internal/runtime/atomic": true, // go1.25
"internal/runtime/cgroup": true, // go1.25
"internal/runtime/exithook": true, // go1.25
"internal/runtime/gc": true, // go1.25
"internal/runtime/maps": true, // go1.25
"internal/runtime/math": true, // go1.25
"internal/runtime/strconv": true, // go1.25
"internal/runtime/sys": true, // go1.25
"internal/runtime/syscall": true, // go1.25
"internal/stringslite": true, // go1.25
"internal/trace/tracev2": true, // go1.25
"runtime": true, // go1.25
"unsafe": true, // go1.25
}
// runtimeAndLinknamed contains the runtime package and all the packages
// which it points to via //go:linkname directives.
// We need to track these as some are not imported as transitive dependencies,
// and we need to load these to properly obfuscate the linkname target names.
//
// Note that runtimeAndLinknamed may contain duplicates with runtimeAndDeps.
// This is on purpose; some packages are in runtimeAndDeps via 'go list -deps'
// but not transitively imported on some platforms, even though they are used
// from the runtime package via //go:linkname directives on those platforms.
// To make sure we have coverage on all platforms, we allow duplicates.
var runtimeAndLinknamed = []string{
"arena", // go1.25
"crypto/internal/boring", // go1.25
"crypto/internal/boring/bcache", // go1.25
"crypto/internal/fips140", // go1.25
"crypto/internal/sysrand", // go1.25
"crypto/rand", // go1.25
"crypto/x509/internal/macos", // go1.25
"internal/bytealg", // go1.25
"internal/coverage/cfile", // go1.25
"internal/cpu", // go1.25
"internal/godebug", // go1.25
"internal/poll", // go1.25
"internal/race", // go1.25
"internal/reflectlite", // go1.25
"internal/runtime/atomic", // go1.25
"internal/runtime/cgroup", // go1.25
"internal/runtime/maps", // go1.25
"internal/sync", // go1.25
"internal/synctest", // go1.25
"internal/syscall/unix", // go1.25
"internal/syscall/windows", // go1.25
"maps", // go1.25
"os", // go1.25
"os/signal", // go1.25
"plugin", // go1.25
"reflect", // go1.25
"runtime", // go1.25
"runtime/debug", // go1.25
"runtime/metrics", // go1.25
"runtime/pprof", // go1.25
"runtime/trace", // go1.25
"sync", // go1.25
"sync/atomic", // go1.25
"sync_test", // go1.25
"syscall", // go1.25
"syscall/js", // go1.25
"time", // go1.25
"unique", // go1.25
"weak", // go1.25
// The net package linknames to the runtime, not the other way around.
"net",
// The testing package uses a //go:linkname directive pointing to testing/synctest,
// but it doesn't import the package, presumably to avoid an import cycle.
"testing/synctest",
}
avoid breaking intrinsics when obfuscating names We obfuscate import paths as well as their declared names. The compiler treats some packages and APIs in special ways, and the way it detects those is by looking at import paths and names. In the past, we have avoided obfuscating some names like embed.FS or reflect.Value.MethodByName for this reason. Otherwise, go:embed or the linker's deadcode elimination might be broken. This matching by path and name also happens with compiler intrinsics. Intrinsics allow the compiler to rewrite some standard library calls with small and efficient assembly, depending on the target GOARCH. For example, math/bits.TrailingZeros32 gets replaced with ssa.OpCtz32, which on amd64 may result in using the TZCNTL instruction. We never noticed that we were breaking many of these intrinsics. The intrinsics for funcs declared in the runtime and its dependencies still worked properly, as we do not obfuscate those packages yet. However, for other packages like math/bits and sync/atomic, the intrinsics were being entirely disabled due to obfuscated names. Skipping intrinsics is particularly bad for performance, and it also leads to slightly larger binaries: │ old │ new │ │ bin-B │ bin-B vs base │ Build-16 5.450Mi ± ∞ ¹ 5.333Mi ± ∞ ¹ -2.15% (p=0.029 n=4) Finally, the main reason we noticed that intrinsics were broken is that apparently GOARCH=mips fails to link without them, as some symbols end up being not defined at all. This patch fixes builds for the MIPS family of architectures. Rather than building and linking all of std for every GOARCH, test that intrinsics work by asking the compiler to print which intrinsics are being applied, and checking that math/bits gets them. This fix is relatively unfortunate, as it means we stop obfuscating about 120 function names and a handful of package paths. However, fixing builds and intrinsics is much more important. We can figure out better ways to deal with intrinsics in the future. Fixes #646.
3 years ago
var compilerIntrinsics = map[string]map[string]bool{
"internal/runtime/atomic": {
"And": true, // go1.25
"And32": true, // go1.25
"And64": true, // go1.25
"And8": true, // go1.25
"Anduintptr": true, // go1.25
"Cas": true, // go1.25
"Cas64": true, // go1.25
"CasRel": true, // go1.25
"Casint32": true, // go1.25
"Casint64": true, // go1.25
"Casp1": true, // go1.25
"Casuintptr": true, // go1.25
"Load": true, // go1.25
"Load64": true, // go1.25
"Load8": true, // go1.25
"LoadAcq": true, // go1.25
"LoadAcq64": true, // go1.25
"LoadAcquintptr": true, // go1.25
"Loadint32": true, // go1.25
"Loadint64": true, // go1.25
"Loadp": true, // go1.25
"Loaduint": true, // go1.25
"Loaduintptr": true, // go1.25
"Or": true, // go1.25
"Or32": true, // go1.25
"Or64": true, // go1.25
"Or8": true, // go1.25
"Oruintptr": true, // go1.25
"Store": true, // go1.25
"Store64": true, // go1.25
"Store8": true, // go1.25
"StoreRel": true, // go1.25
"StoreRel64": true, // go1.25
"StoreReluintptr": true, // go1.25
"Storeint32": true, // go1.25
"Storeint64": true, // go1.25
"StorepNoWB": true, // go1.25
"Storeuintptr": true, // go1.25
"Xadd": true, // go1.25
"Xadd64": true, // go1.25
"Xaddint32": true, // go1.25
"Xaddint64": true, // go1.25
"Xadduintptr": true, // go1.25
"Xchg": true, // go1.25
"Xchg64": true, // go1.25
"Xchg8": true, // go1.25
"Xchgint32": true, // go1.25
"Xchgint64": true, // go1.25
"Xchguintptr": true, // go1.25
},
"internal/runtime/maps": {
"bitsetFirst": true, // go1.25
"bitsetLowestSet": true, // go1.25
"bitsetRemoveBelow": true, // go1.25
"bitsetShiftOutLowest": true, // go1.25
"ctrlGroupMatchEmpty": true, // go1.25
"ctrlGroupMatchEmptyOrDeleted": true, // go1.25
"ctrlGroupMatchFull": true, // go1.25
"ctrlGroupMatchH2": true, // go1.25
},
"internal/runtime/math": {
"MulUintptr": true, // go1.25
},
"internal/runtime/sys": {
"Bswap32": true, // go1.25
"Bswap64": true, // go1.25
"Len64": true, // go1.25
"Len8": true, // go1.25
"OnesCount64": true, // go1.25
"Prefetch": true, // go1.25
"PrefetchStreamed": true, // go1.25
"TrailingZeros32": true, // go1.25
"TrailingZeros64": true, // go1.25
"TrailingZeros8": true, // go1.25
},
"math": {
"Abs": true, // go1.25
"Ceil": true, // go1.25
"Copysign": true, // go1.25
"FMA": true, // go1.25
"Floor": true, // go1.25
"Round": true, // go1.25
"RoundToEven": true, // go1.25
"Trunc": true, // go1.25
"sqrt": true, // go1.25
},
"math/big": {
"mulWW": true, // go1.25
},
"math/bits": {
"Add": true, // go1.25
"Add64": true, // go1.25
"Div": true, // go1.25
"Div64": true, // go1.25
"Len": true, // go1.25
"Len16": true, // go1.25
"Len32": true, // go1.25
"Len64": true, // go1.25
"Len8": true, // go1.25
"Mul": true, // go1.25
"Mul64": true, // go1.25
"OnesCount": true, // go1.25
"OnesCount16": true, // go1.25
"OnesCount32": true, // go1.25
"OnesCount64": true, // go1.25
"OnesCount8": true, // go1.25
"Reverse": true, // go1.25
"Reverse16": true, // go1.25
"Reverse32": true, // go1.25
"Reverse64": true, // go1.25
"Reverse8": true, // go1.25
"ReverseBytes16": true, // go1.25
"ReverseBytes32": true, // go1.25
"ReverseBytes64": true, // go1.25
"RotateLeft": true, // go1.25
"RotateLeft16": true, // go1.25
"RotateLeft32": true, // go1.25
"RotateLeft64": true, // go1.25
"RotateLeft8": true, // go1.25
"Sub": true, // go1.25
"Sub64": true, // go1.25
"TrailingZeros16": true, // go1.25
"TrailingZeros32": true, // go1.25
"TrailingZeros64": true, // go1.25
"TrailingZeros8": true, // go1.25
},
"runtime": {
"publicationBarrier": true, // go1.25
},
"sync": {
"runtime_LoadAcquintptr": true, // go1.25
"runtime_StoreReluintptr": true, // go1.25
},
"sync/atomic": {
"AddInt32": true, // go1.25
"AddInt64": true, // go1.25
"AddUint32": true, // go1.25
"AddUint64": true, // go1.25
"AddUintptr": true, // go1.25
"AndInt32": true, // go1.25
"AndInt64": true, // go1.25
"AndUint32": true, // go1.25
"AndUint64": true, // go1.25
"AndUintptr": true, // go1.25
"CompareAndSwapInt32": true, // go1.25
"CompareAndSwapInt64": true, // go1.25
"CompareAndSwapUint32": true, // go1.25
"CompareAndSwapUint64": true, // go1.25
"CompareAndSwapUintptr": true, // go1.25
"LoadInt32": true, // go1.25
"LoadInt64": true, // go1.25
"LoadPointer": true, // go1.25
"LoadUint32": true, // go1.25
"LoadUint64": true, // go1.25
"LoadUintptr": true, // go1.25
"OrInt32": true, // go1.25
"OrInt64": true, // go1.25
"OrUint32": true, // go1.25
"OrUint64": true, // go1.25
"OrUintptr": true, // go1.25
"StoreInt32": true, // go1.25
"StoreInt64": true, // go1.25
"StoreUint32": true, // go1.25
"StoreUint64": true, // go1.25
"StoreUintptr": true, // go1.25
"SwapInt32": true, // go1.25
"SwapInt64": true, // go1.25
"SwapUint32": true, // go1.25
"SwapUint64": true, // go1.25
"SwapUintptr": true, // go1.25
},
avoid breaking intrinsics when obfuscating names We obfuscate import paths as well as their declared names. The compiler treats some packages and APIs in special ways, and the way it detects those is by looking at import paths and names. In the past, we have avoided obfuscating some names like embed.FS or reflect.Value.MethodByName for this reason. Otherwise, go:embed or the linker's deadcode elimination might be broken. This matching by path and name also happens with compiler intrinsics. Intrinsics allow the compiler to rewrite some standard library calls with small and efficient assembly, depending on the target GOARCH. For example, math/bits.TrailingZeros32 gets replaced with ssa.OpCtz32, which on amd64 may result in using the TZCNTL instruction. We never noticed that we were breaking many of these intrinsics. The intrinsics for funcs declared in the runtime and its dependencies still worked properly, as we do not obfuscate those packages yet. However, for other packages like math/bits and sync/atomic, the intrinsics were being entirely disabled due to obfuscated names. Skipping intrinsics is particularly bad for performance, and it also leads to slightly larger binaries: │ old │ new │ │ bin-B │ bin-B vs base │ Build-16 5.450Mi ± ∞ ¹ 5.333Mi ± ∞ ¹ -2.15% (p=0.029 n=4) Finally, the main reason we noticed that intrinsics were broken is that apparently GOARCH=mips fails to link without them, as some symbols end up being not defined at all. This patch fixes builds for the MIPS family of architectures. Rather than building and linking all of std for every GOARCH, test that intrinsics work by asking the compiler to print which intrinsics are being applied, and checking that math/bits gets them. This fix is relatively unfortunate, as it means we stop obfuscating about 120 function names and a handful of package paths. However, fixing builds and intrinsics is much more important. We can figure out better ways to deal with intrinsics in the future. Fixes #646.
3 years ago
}
var reflectSkipPkg = map[string]bool{
"fmt": true,
}