Skip to content

Commit

Permalink
debug/elf: add comments explaining applyRelocations for amd64/arm64
Browse files Browse the repository at this point in the history
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/155190043
  • Loading branch information
ianlancetaylor committed Oct 9, 2014
1 parent f1c0899 commit 7abc8c4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/debug/elf/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 7abc8c4

Please sign in to comment.