hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit d7207ba62f4f9f8bacbb24f7cf51305cb182502f
parent 9dfd725689151b3fdd5002cf24406fc1dbd814cd
Author: Evan Vogel <amavect@gmail.com>
Date:   Tue,  1 Mar 2022 18:54:27 -0600

rt/hare+libc.sc: include .rela.plt section for glibc ELF binaries

ld.bfd forgets to create a .rela.plt section for lazy references.
ld.bfd then shovels both immediate and lazy dynamic symbols in
a single .rela.dyn section.

glibc cannot handle different dynamic symbols in the same section
and throws the following error during program startup:
error while loading shared libraries:
unexpected PLT reloc type 0x08

ld.gold includes the missing section, and binaries work fine.
musl can handle both dynamic symbol types in the same section.

The fix is simple: explicitly include the missing section.

Signed-off-by: Evan Vogel <amavect@gmail.com>

Diffstat:
Mrt/hare+libc.sc | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/rt/hare+libc.sc b/rt/hare+libc.sc @@ -10,6 +10,10 @@ SECTIONS { *(.data.*) } + .rela.plt : { + *(.rela.plt) + } + .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(.init_array))