From c03e93ab3a4cf602e9fad9ef7bc7537a0cf96e8c Mon Sep 17 00:00:00 2001 From: jake Date: Fri, 27 Sep 2002 23:12:53 +0000 Subject: Add a workaround for what seems to be confusion between binutils and the sparc v9 ABI. The Elf_Rela records for local symbols appear to already have the symbol's value added in to the addend field, even though the ABI specifies we need to lookup the symbol and add its value too. This breaks text relocations in klds because the symbol's value is added twice, and the resulting address points off into nowhere land, so for now just use the addend. Tested by: rwatson --- sys/kern/link_elf.c | 10 ++++++++++ sys/kern/link_elf_obj.c | 10 ++++++++++ 2 files changed, 20 insertions(+) (limited to 'sys/kern') diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 9980005..ea4f0dd 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -1188,6 +1188,16 @@ link_elf_get_gp(linker_file_t lf) } #endif +const Elf_Sym * +elf_get_sym(linker_file_t lf, Elf_Word symidx) +{ + elf_file_t ef = (elf_file_t)lf; + + if (symidx >= ef->nchains) + return (NULL); + return (ef->symtab + symidx); +} + /* * Symbol lookup function that can be used when the symbol index is known (ie * in relocations). It uses the symbol index instead of doing a fully fledged diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 9980005..ea4f0dd 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -1188,6 +1188,16 @@ link_elf_get_gp(linker_file_t lf) } #endif +const Elf_Sym * +elf_get_sym(linker_file_t lf, Elf_Word symidx) +{ + elf_file_t ef = (elf_file_t)lf; + + if (symidx >= ef->nchains) + return (NULL); + return (ef->symtab + symidx); +} + /* * Symbol lookup function that can be used when the symbol index is known (ie * in relocations). It uses the symbol index instead of doing a fully fledged -- cgit v1.1