summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2002-09-27 23:12:53 +0000
committerjake <jake@FreeBSD.org>2002-09-27 23:12:53 +0000
commitc03e93ab3a4cf602e9fad9ef7bc7537a0cf96e8c (patch)
treeba3c4f5add825cc1d7164df7492430782b2070c4 /sys/kern
parentd08d61cf7e649a1706432628cc516edea8878dd9 (diff)
downloadFreeBSD-src-c03e93ab3a4cf602e9fad9ef7bc7537a0cf96e8c.zip
FreeBSD-src-c03e93ab3a4cf602e9fad9ef7bc7537a0cf96e8c.tar.gz
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
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/link_elf.c10
-rw-r--r--sys/kern/link_elf_obj.c10
2 files changed, 20 insertions, 0 deletions
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
OpenPOWER on IntegriCloud