summaryrefslogtreecommitdiff
path: root/module/system/vm/linker.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-12-10 20:03:59 +0100
committerAndy Wingo <wingo@pobox.com>2013-12-10 20:03:59 +0100
commit812c83d48b38240d4c6c61c3ba89ea67a44efd42 (patch)
tree1b508830926eb3df1de644dbf22bdf29dc891ee1 /module/system/vm/linker.scm
parent18e1113513467f319de09feae51e792548db9ecc (diff)
downloadguile-812c83d48b38240d4c6c61c3ba89ea67a44efd42.tar.gz
Fix section table writing for non-loadable sections
* module/system/vm/linker.scm (add-elf-objects): Don't fill in the sh_addr field if the section is not loadable.
Diffstat (limited to 'module/system/vm/linker.scm')
-rw-r--r--module/system/vm/linker.scm28
1 files changed, 17 insertions, 11 deletions
diff --git a/module/system/vm/linker.scm b/module/system/vm/linker.scm
index cc68ca58e..5449e8634 100644
--- a/module/system/vm/linker.scm
+++ b/module/system/vm/linker.scm
@@ -517,17 +517,23 @@ list of objects, augmented with objects for the special ELF sections."
(write-elf-section-header bv offset endianness word-size section)
(if (= (elf-section-type section) SHT_NULL)
relocs
- (cons* (make-linker-reloc
- reloc-kind
- (+ offset (elf-section-header-addr-offset word-size))
- 0
- section-label)
- (make-linker-reloc
- reloc-kind
- (+ offset (elf-section-header-offset-offset word-size))
- 0
- section-label)
- relocs))))
+ (let ((relocs
+ (cons (make-linker-reloc
+ reloc-kind
+ (+ offset
+ (elf-section-header-offset-offset word-size))
+ 0
+ section-label)
+ relocs)))
+ (if (zero? (logand SHF_ALLOC (elf-section-flags section)))
+ relocs
+ (cons (make-linker-reloc
+ reloc-kind
+ (+ offset
+ (elf-section-header-addr-offset word-size))
+ 0
+ section-label)
+ relocs))))))
(let ((relocs (fold-values
(lambda (object relocs)
(write-and-reloc