mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 12:20:20 +02:00
Fix linker bug that could fail to find the shstrtab
* module/system/vm/linker.scm (<linker-object>): Add name field. This allows the linker to find sections by name, notably before having found the .shstrtab section. As there can be multiple sections with type SHT_STRTAB, this fixes a bug whereby we could use a section name (a strtab index) into an unrelated strtab. In the past this worked because with ASCII identifiers there won't be an exception, although it is possible to accidentally mistake a shared string tail; but with UTF-8 identifiers, it's possible for a string table index to point in the middle of a codepoint, which is likely not valid UTF-8 and would raise a bug. Keeping an additional section name field fixes this bug. Adapt all callers to pass a name argument to make-linker-object. (find-shstrndx): Update to look at the name field. * module/system/vm/assembler.scm (make-object): Pass name to make-linker-object. Thanks to Daniel Llorens for the test case.
This commit is contained in:
parent
3e22eef52c
commit
c9e052be49
2 changed files with 19 additions and 17 deletions
|
@ -1550,7 +1550,8 @@ corresponding linker symbol for the start of the section."
|
|||
(let ((name-idx (intern-section-name! asm (symbol->string name)))
|
||||
(index (asm-next-section-number asm)))
|
||||
(set-asm-next-section-number! asm (1+ index))
|
||||
(make-linker-object (apply make-elf-section
|
||||
(make-linker-object (symbol->string name)
|
||||
(apply make-elf-section
|
||||
#:index index
|
||||
#:name name-idx
|
||||
#:size (bytevector-length bv)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue