symtabs: improve handling of symbol lookups

When CONFIG_SYMTAB_ORDEREDBYNAME is selected most code will use
the ordered search function. When it is not selected no code will
use the ordered search function. This change merges the two
functions and varies its behaviour based on the config setting,
such that all callers can simply call the one search function
and get the best behaviour.

An additional configuration option allows leading underscores to
be stripped from symbols being relocated in loaded objects. This
allows toolchains which prefix C symbol with underscores to make
loadable ELF objects.
This commit is contained in:
Byron Ellacott
2021-03-15 19:35:47 +10:00
committed by Xiang Xiao
parent c80cdf06c2
commit c9db653c8d
11 changed files with 94 additions and 178 deletions
-6
View File
@@ -290,14 +290,8 @@ int elf_symvalue(FAR struct elf_loadinfo_s *loadinfo, FAR Elf_Sym *sym,
/* Check if the base code exports a symbol of this name */
#ifdef CONFIG_SYMTAB_ORDEREDBYNAME
symbol = symtab_findorderedbyname(exports,
(FAR char *)loadinfo->iobuffer,
nexports);
#else
symbol = symtab_findbyname(exports, (FAR char *)loadinfo->iobuffer,
nexports);
#endif
if (!symbol)
{
berr("SHN_UNDEF: Exported symbol \"%s\" not found\n",