]> Cypherpunks repositories - gostls13.git/commitdiff
debug/elf: add comments explaining applyRelocations for amd64/arm64
authorIan Lance Taylor <iant@golang.org>
Thu, 9 Oct 2014 21:38:45 +0000 (14:38 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 9 Oct 2014 21:38:45 +0000 (14:38 -0700)
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/155190043

src/debug/elf/file.go

index c908e7a8893a658ff6dfacded0c977165fbc0d04..de8a3a24fe9584a3424daee4dcfb2574f3176443 100644 (file)
@@ -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 {