]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/link: store COFF symbol complex type in the LSB instead of the MSB
authorqmuntal <quimmuntal@gmail.com>
Mon, 13 Mar 2023 13:34:38 +0000 (14:34 +0100)
committerQuim Muntal <quimmuntal@gmail.com>
Tue, 14 Mar 2023 10:02:09 +0000 (10:02 +0000)
commitb37c0602cdc9b7f13b3d539663e68b12f10b44b1
treee000dd930d904302ad03387ec0695776f2313cea
parenta54fe8a270aef105dc5fbdca4eb90227587361e9
cmd/link: store COFF symbol complex type in the LSB instead of the MSB

Microsoft's PE documentation is contradictory. It says that the
symbol's complex type [1] is stored in the pesym.Type most significant
byte (MSB), but MSVC, LLVM, and mingw store it in the 4 high bits of
the less significant byte (LSB). dumpbin understands both encoding.

Previous to CL 475355 the Go compiler mixed MSB and LSB encoding.
CL 475355 updated to compiler to use the MSB, but this causes problems
with mingw, which emits a warning when MSB is used.

For reference, LLVM also hit this issue long time ago:
https://github.com/llvm/llvm-project/issues/8692

[1] https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#type-representation

Change-Id: I7e750bde9c20e2c4c1c023203d7abd6fb26d9d30
Reviewed-on: https://go-review.googlesource.com/c/go/+/475855
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/cmd/link/internal/ld/pe.go
src/cmd/link/internal/loadpe/ldpe.go