Skip to content

Commit

Permalink
pprof/internal/binutils: update windows test binary
Browse files Browse the repository at this point in the history
Recompiled test binary using MSYS2 gcc 10.2.0 and verified
that the binary does not trigger anti-virus using virustotal.

Fixes google#607
  • Loading branch information
egonelbre committed Feb 25, 2021
1 parent 1612e9b commit 67bf4e8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/binutils/binutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,9 @@ func TestPEFile(t *testing.T) {
start, limit, offset uint64
addr uint64
}{
{"fake mapping", 0, math.MaxUint64, 0, 0x401560},
{"fixed load address", 0x400000, 0x402000, 0, 0x401560},
{"simulated ASLR address", 0x500000, 0x502000, 0, 0x501560},
{"fake mapping", 0, math.MaxUint64, 0, 0x140001594},
{"fixed load address", 0x140000000, 0x140002000, 0, 0x140001594},
{"simulated ASLR address", 0x150000000, 0x150002000, 0, 0x150001594},
} {
t.Run(tc.desc, func(t *testing.T) {
bu := &Binutils{}
Expand Down
5 changes: 5 additions & 0 deletions internal/binutils/testdata/build_binaries.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,16 @@ func main() {
}

case "windows":
// Many gcc enviroments may create binaries that trigger false-positives
// in antiviruses. MSYS2 with gcc 10.2.0 is a working environment for
// compiling. To setup the environment follow the guide at
// https://www.msys2.org/ and install gcc with `pacman -S gcc`.
out, err := exec.Command("gcc", "-g", "-ffile-prefix-map="+wd+"=", "-o", "exe_windows_64.exe", "hello.c").CombinedOutput()
log.Println(string(out))
if err != nil {
log.Fatal(err)
}
log.Println("Please verify that exe_windows_64.exe does not trigger any antivirus on `virustotal.com`.")
default:
log.Fatalf("Unsupported OS %q", runtime.GOOS)
}
Expand Down
Binary file modified internal/binutils/testdata/exe_windows_64.exe
Binary file not shown.

0 comments on commit 67bf4e8

Please sign in to comment.