]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: recognize DLL magic from llvm binaries
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 15 Feb 2021 19:20:15 +0000 (20:20 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 23 Feb 2021 17:58:33 +0000 (17:58 +0000)
When using LLD with c-shared, the magic in the output DLL is slightly
different than for EXEs.

Change-Id: Icc5f34f7bb61f11a9d75494236b7797cc1988b40
Reviewed-on: https://go-review.googlesource.com/c/go/+/291638
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/go/internal/work/exec.go

index 422e83c224f84c7ae43f2e7036ca0eab5b9b90d2..d957fa1fcdc7b8d021ba027797f3e14aebf607f0 100644 (file)
@@ -1841,6 +1841,7 @@ var objectMagic = [][]byte{
        {0xCE, 0xFA, 0xED, 0xFE},                  // Mach-O little-endian 32-bit
        {0xCF, 0xFA, 0xED, 0xFE},                  // Mach-O little-endian 64-bit
        {0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00},      // PE (Windows) as generated by 6l/8l and gcc
+       {0x4d, 0x5a, 0x78, 0x00, 0x01, 0x00},      // PE (Windows) as generated by llvm for dll
        {0x00, 0x00, 0x01, 0xEB},                  // Plan 9 i386
        {0x00, 0x00, 0x8a, 0x97},                  // Plan 9 amd64
        {0x00, 0x00, 0x06, 0x47},                  // Plan 9 arm