aboutsummaryrefslogtreecommitdiff
path: root/src/debug/pe/section.go
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2022-03-22 08:49:52 -0400
committerThan McIntosh <thanm@google.com>2022-03-31 14:57:35 +0000
commit378221bd6e73bdc21884fed9e32f53e6672ca0cd (patch)
tree1dee063d40f14b65a4148aefcdd9cfef777904ed /src/debug/pe/section.go
parentcdee8004ab5fa71d705979eaaee0948200256ed0 (diff)
downloadgo-378221bd6e73bdc21884fed9e32f53e6672ca0cd.tar.xz
debug/pe: add APIs for reading section def aux info
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 <alex.brainman@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Trust: Alex Brainman <alex.brainman@gmail.com> Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/debug/pe/section.go')
-rw-r--r--src/debug/pe/section.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/debug/pe/section.go b/src/debug/pe/section.go
index b641158ecc..ee59dedeb4 100644
--- a/src/debug/pe/section.go
+++ b/src/debug/pe/section.go
@@ -109,3 +109,15 @@ func (s *Section) Data() ([]byte, error) {
func (s *Section) Open() io.ReadSeeker {
return io.NewSectionReader(s.sr, 0, 1<<63-1)
}
+
+// Section characteristics flags.
+const (
+ IMAGE_SCN_CNT_CODE = 0x00000020
+ IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040
+ IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080
+ IMAGE_SCN_LNK_COMDAT = 0x00001000
+ IMAGE_SCN_MEM_DISCARDABLE = 0x02000000
+ IMAGE_SCN_MEM_EXECUTE = 0x20000000
+ IMAGE_SCN_MEM_READ = 0x40000000
+ IMAGE_SCN_MEM_WRITE = 0x80000000
+)