summaryrefslogtreecommitdiffstats
path: root/sys/kern/link_elf_obj.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2004-05-18 05:15:43 +0000
committerpeter <peter@FreeBSD.org>2004-05-18 05:15:43 +0000
commit235a3d8f6454b995eea2c2e6a0a7bc93fd353dee (patch)
treea991d402ee63921c81007a7096d2d2732a404fb1 /sys/kern/link_elf_obj.c
parenta6091b3b0818b536c1fe7d7a6bd8d0013e3792bc (diff)
downloadFreeBSD-src-235a3d8f6454b995eea2c2e6a0a7bc93fd353dee.zip
FreeBSD-src-235a3d8f6454b995eea2c2e6a0a7bc93fd353dee.tar.gz
If a symbol has section+offset definitions provided, always use instead
of doing a name lookup for global symbols. This fixes the snd_pcm module.
Diffstat (limited to 'sys/kern/link_elf_obj.c')
-rw-r--r--sys/kern/link_elf_obj.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
index ce53105..c150fdf 100644
--- a/sys/kern/link_elf_obj.c
+++ b/sys/kern/link_elf_obj.c
@@ -868,12 +868,8 @@ elf_obj_lookup(linker_file_t lf, Elf_Word symidx, int deps)
sym = ef->ddbsymtab + symidx;
- /* Theoretically we can avoid a lookup for some locals */
- switch (ELF_ST_BIND(sym->st_info)) {
- case STB_LOCAL:
- /* Local, but undefined? huh? */
- if (sym->st_shndx == SHN_UNDEF)
- return (0);
+ /* Quick answer if there is a definition included. */
+ if (sym->st_shndx != SHN_UNDEF) {
ret = 0;
/* Relative to section number */
for (i = 0; i < ef->nprogtab; i++) {
@@ -883,6 +879,13 @@ elf_obj_lookup(linker_file_t lf, Elf_Word symidx, int deps)
}
}
return ret + sym->st_value;
+ }
+
+ /* If we get here, then it is undefined and needs a lookup. */
+ switch (ELF_ST_BIND(sym->st_info)) {
+ case STB_LOCAL:
+ /* Local, but undefined? huh? */
+ return (0);
case STB_GLOBAL:
/* Relative to Data or Function name */
OpenPOWER on IntegriCloud