aboutsummaryrefslogtreecommitdiff
path: root/src/debug/pe/section.go
AgeCommit message (Collapse)Author
2023-10-18debug: add available godoc linkcui fliter
Change-Id: I9e7b7e10d9e3d23e4ed540eb8137cd1f4d103711 Reviewed-on: https://go-review.googlesource.com/c/go/+/534761 Reviewed-by: Carlos Amedee <carlos@golang.org> Run-TryBot: shuang cui <imcusg@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-09-07all: use io.{SeekStart, SeekCurrent, SeekEnd}Jes Cok
Currently we include these symbols in bootstrap code. Change-Id: I19b504237b0344f0e87cda0fbe651811c72daba1 GitHub-Last-Rev: 5134baec387659c5e2ca8c4fc65a5e73c07f00ce GitHub-Pull-Request: golang/go#62368 Reviewed-on: https://go-review.googlesource.com/c/go/+/524258 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2023-05-01debug/pe: return error on reading from section with uninitialized dataIan Lance Taylor
A section with uninitialized data contains no bytes and occupies no space in the file. This change makes it return an error on reading from this section so that it will force the caller to check for a section with uninitialized data. This is the debug/pe version of CL 429601. This will break programs that expect a byte slice with the length described by the SizeOfRawData field. There are two reasons to introduce this breaking change: 1) uninitialized data is uninitialized and there is no reason to allocate memory for it; 2) it could result in an OOM if the file is corrupted and has a large invalid SizeOfRawData. No test case because the problem can only happen for invalid data. Let the fuzzer find cases like this. For #47653 Fixes #59817 Change-Id: I1ae94e9508f803b37926275d9a571f724a09af9f Reviewed-on: https://go-review.googlesource.com/c/go/+/488475 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: kortschak <dan@kortschak.io> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-08-19debug/pe: fetch section size directly in (*Section).DataIan Lance Taylor
Change-Id: Idc1f8b3fb6b4b2fdcc6dade048cc14c53715319f Reviewed-on: https://go-review.googlesource.com/c/go/+/424197 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-08-17debug/pe, internal/saferio: use saferio to read PE section dataIan Lance Taylor
For #47653 Fixes #53189 Change-Id: If35b968fc53e4c96b18964cfb020cdc003b881bf Reviewed-on: https://go-review.googlesource.com/c/go/+/412014 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-03-31debug/pe: add APIs for reading section def aux infoThan McIntosh
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>
2016-10-17cmd/dist: use debug/pe directly for cmd/linkRuss Cox
Delete vendored copy. Change-Id: I06e9d3b709553a1a8d06275e99bd8f617aac5788 Reviewed-on: https://go-review.googlesource.com/31011 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-08-18debug/pe: revert CL 22720Alex Brainman
CL 22720 hid all recently added functionality for go1.7. Make everything exported again, so we could use it now. Updates #15345 Change-Id: Id8ccba7199422b554407ec14c343d2c28fbb8f72 Reviewed-on: https://go-review.googlesource.com/27212 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-05-05debug/pe: unexport newly introduced identifiersAlex Brainman
CLs 22181, 22332 and 22336 intorduced new functionality to be used in cmd/link (see issue #15345 for details). But we didn't have chance to use new functionality yet. Unexport newly introduced identifiers, so we don't have to commit to the API until we actually tried it. Rename File.COFFSymbols into File._COFFSymbols, COFFSymbol.FullName into COFFSymbol._FullName, Section.Relocs into Section._Relocs, Reloc into _Relocs, File.StringTable into File._StringTable and StringTable into _StringTable. Updates #15345 Change-Id: I770eeb61f855de85e0c175225d5d1c006869b9ec Reviewed-on: https://go-review.googlesource.com/22720 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-24debug/pe: introduce File.COFFSymbols and (*COFFSymbol).FullNameAlex Brainman
Reloc.SymbolTableIndex is an index into symbol table. But Reloc.SymbolTableIndex cannot be used as index into File.Symbols, because File.Symbols slice has Aux lines removed as it is built. We cannot change the way File.Symbols works, so I propose we introduce new File.COFFSymbols that does not have that limitation. Also unlike File.Symbols, File.COFFSymbols will consist of COFFSymbol. COFFSymbol matches PE COFF specification exactly, and it is simpler to use. Updates #15345 Change-Id: Icbc265853a472529cd6d64a76427b27e5459e373 Reviewed-on: https://go-review.googlesource.com/22336 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-21debug/pe: introduce Section.RelocsAlex Brainman
cmd/link reads PE object files when building programs with cgo. cmd/link accesses object relocations. Add new Section.Relocs that provides similar functionality in debug/pe. Updates #15345 Change-Id: I34de91b7f18cf1c9e4cdb3aedd685486a625ac92 Reviewed-on: https://go-review.googlesource.com/22332 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-04-21debug/pe: pretty section.go codeAlex Brainman
Introduce (*SectionHeader32).fullName and add documentation comments. Updates #15345 Change-Id: I8f3b8ab9492642d62e7aad010c91c68daea3f14b Reviewed-on: https://go-review.googlesource.com/22301 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-20debug/pe: move some code into section.go and symbol.goAlex Brainman
Just moving code. No code changes. Updates #15345 Change-Id: I89c257b7aae4fbd78ce59a42909ecb3ff493659d Reviewed-on: https://go-review.googlesource.com/22300 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>