summaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2014-10-09 14:38:45 -0700
committerIan Lance Taylor <iant@golang.org>2014-10-09 14:38:45 -0700
commit0e62ef01c88fca69015123193863f332852f8f0b (patch)
tree24471ac782b9ca4a8425bc95b4708bf8060370e7 /src/debug
parente04979c0c2779a7b4830ffcd694480e588941b22 (diff)
downloadgo-0e62ef01c88fca69015123193863f332852f8f0b.tar.gz
debug/elf: add comments explaining applyRelocations for amd64/arm64
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://codereview.appspot.com/155190043
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/elf/file.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/debug/elf/file.go b/src/debug/elf/file.go
index c908e7a88..de8a3a24f 100644
--- a/src/debug/elf/file.go
+++ b/src/debug/elf/file.go
@@ -564,6 +564,10 @@ func (f *File) applyRelocationsAMD64(dst []byte, rels []byte) error {
continue
}
+ // There are relocations, so this must be a normal
+ // object file, and we only look at section symbols,
+ // so we assume that the symbol value is 0.
+
switch t {
case R_X86_64_64:
if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 {
@@ -646,6 +650,10 @@ func (f *File) applyRelocationsARM64(dst []byte, rels []byte) error {
continue
}
+ // There are relocations, so this must be a normal
+ // object file, and we only look at section symbols,
+ // so we assume that the symbol value is 0.
+
switch t {
case R_AARCH64_ABS64:
if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 {