support reversing asm filenames

Which can be helpful when debugging assembly build errors
such as the one from #948.
I could not get an obfuscated binary to ever print or show its
assembly positions or filenames, so this has no test.
master
Daniel Martí 3 months ago
parent 28f7a7ffbf
commit 33e574685b

@ -152,7 +152,8 @@ type listedPackage struct {
Standard bool
Dir string
CompiledGoFiles []string
CompiledGoFiles []string // all .go files to build
SFiles []string // all .s (asm) files to build
Imports []string
Error *packageError // to report package loading errors to the user

@ -68,6 +68,14 @@ One can reverse a captured panic stack trace as follows:
// Package paths are obfuscated, too.
addHashedWithPackage(lpkg.ImportPath)
// Assembly filenames are obfuscated in a simple way.
// Mirroring [transformer.transformAsm]; note the lack of a test
// as so far this has only mattered for build errors with positions.
for _, name := range lpkg.SFiles {
newName := hashWithPackage(lpkg, name) + ".s"
replaces = append(replaces, newName, name)
}
files, err := parseFiles(lpkg, lpkg.Dir, lpkg.CompiledGoFiles)
if err != nil {
return err

Loading…
Cancel
Save