-
Notifications
You must be signed in to change notification settings - Fork 18k
debug/pe: add APIs to support reading COMDAT info for sections #51868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Adding to proposal project for discussion, but my personal feeling is that we don't need a formal proposal to add simple accessors and constants to the debug/* packages. |
I agree, it seems a bit heavyweight, but I am just following the instructions as laid out in https://go.googlesource.com/go/+/96567fb3ccdc8d8c052606112db7b39abd725b59/api/README |
Change https://go.dev/cl/394534 mentions this issue: |
Your proposal LGTM. Thank you. Alex |
This seems clear enough and unobjectionable enough that I think we can just move it to accept. Thanks! |
No change in consensus, so accepted. 🎉 |
https://go.dev/cl/394534 has been +2'd and is ready to submit; I am going to go ahead and close this issue out (this is now required in order for the API check test to pass during all.bash). |
Add hooks to support reading of section definition symbol aux data (including COMDAT information) from the aux symbols associated with section definition symbols. The COFF symbol array made available by "pe.File" includes entries for aux symbols, but doesn't expose their structure (since it varies depending on the type of aux symbol). This patch adds a function for returning a specific class of aux symbol ("type 5") that immediately follows a COFF symbol corresponding to a section definition. Updates #35006. Updates #51868. Change-Id: I21fcc057150f7a3c64f01a5961aabca0fa43399e Reviewed-on: https://go-review.googlesource.com/c/go/+/394534 Reviewed-by: Alex Brainman <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Trust: Alex Brainman <[email protected]> Trust: Than McIntosh <[email protected]> Run-TryBot: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
Change https://go.dev/cl/414515 mentions this issue: |
It was #51868 not #51686. For #53310. Change-Id: I2cf28ca4de65e7030fdbd05e7f32fe42c8f3ca0a Reviewed-on: https://go-review.googlesource.com/c/go/+/414515 Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Russ Cox <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
It was golang#51868 not golang#51686. For golang#53310. Change-Id: I2cf28ca4de65e7030fdbd05e7f32fe42c8f3ca0a Reviewed-on: https://go-review.googlesource.com/c/go/+/414515 Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Russ Cox <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
This is a proposal to add additional APIs to the "debug/pe" package to
enable reading of auxiliary symbol information, specifically to enable
extraction of info about COMDAT sections, needed by the Go linker.
Background + Motivation
The debug/pe package currently provides hooks for reading symbol table
information from PE object files, notably the "COFFSymbols" slice
provided in pe's "File" type:
The COFFSymbols array is something of a fiction, in that the slice
includes entries for "regular" symbols, but also for entries in the
file's symbol array that correspond to aux symbols. Both regular
symbols and aux symbols are 18 bytes in size, but the format of aux
symbols varies depending on the type of regular symbol it precedes.
Picture to illustrate:
More can be found in the Microsoft PE format documentation.
The existing
debug/pe
APIs list the number of aux symbols for eachregular symbol, making it possible to skip aux entries when iterating
through the main symbol array, but there is no way to look inside the
aux symbols.
One class of aux symbol is the section definition
aux symbol, which holds additional bits of info about symbols
corresponding to defined sections in the object file.
One part of the section definition aux symbol is material related to
COMDAT sections; the Go linker needs to be able to access this COMDAT
info in order to support more modern clang-based C toolchains on
Windows (see CL stack at
https://go-review.googlesource.com/q/topic:modernize_windows_c_compiler
and associated issue at https://golang.org/issue/35006).
Proposal details
The proposal is to add these new APIs to debug/pe:
When a client discovers a section definition symbol that has the
IMAGE_SCN_LNK_COMDAT
bit set in its characteristics flags, it can call intoCOFFSymbolReadSectionDefAux
to obtain a pointer to the aux info for the section, allowing it to read the info about the COMDAT section.The text was updated successfully, but these errors were encountered: