Skip to content

Commit 7abc8c4

Browse files
debug/elf: add comments explaining applyRelocations for amd64/arm64
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/155190043
1 parent f1c0899 commit 7abc8c4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/debug/elf/file.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,10 @@ func (f *File) applyRelocationsAMD64(dst []byte, rels []byte) error {
564564
continue
565565
}
566566

567+
// There are relocations, so this must be a normal
568+
// object file, and we only look at section symbols,
569+
// so we assume that the symbol value is 0.
570+
567571
switch t {
568572
case R_X86_64_64:
569573
if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 {
@@ -646,6 +650,10 @@ func (f *File) applyRelocationsARM64(dst []byte, rels []byte) error {
646650
continue
647651
}
648652

653+
// There are relocations, so this must be a normal
654+
// object file, and we only look at section symbols,
655+
// so we assume that the symbol value is 0.
656+
649657
switch t {
650658
case R_AARCH64_ABS64:
651659
if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 {

0 commit comments

Comments
 (0)