mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 22:20:01 +08:00
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:
committed by
Xiang Xiao
parent
c80cdf06c2
commit
c9db653c8d
+4
-20
@@ -73,8 +73,9 @@ extern "C"
|
||||
*
|
||||
* Description:
|
||||
* Find the symbol in the symbol table with the matching name.
|
||||
* This version assumes that table is not ordered with respect to symbol
|
||||
* name and, hence, access time will be linear with respect to nsyms.
|
||||
* The implementation will be linear with respect to nsyms if
|
||||
* CONFIG_SYMTAB_ORDEREDBYNAME is not selected, and logarithmic
|
||||
* if it is.
|
||||
*
|
||||
* Returned Value:
|
||||
* A reference to the symbol table entry if an entry with the matching
|
||||
@@ -86,30 +87,13 @@ FAR const struct symtab_s *
|
||||
symtab_findbyname(FAR const struct symtab_s *symtab,
|
||||
FAR const char *name, int nsyms);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: symtab_findorderedbyname
|
||||
*
|
||||
* Description:
|
||||
* Find the symbol in the symbol table with the matching name.
|
||||
* This version assumes that table ordered with respect to symbol name.
|
||||
*
|
||||
* Returned Value:
|
||||
* A reference to the symbol table entry if an entry with the matching
|
||||
* name is found; NULL is returned if the entry is not found.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR const struct symtab_s *
|
||||
symtab_findorderedbyname(FAR const struct symtab_s *symtab,
|
||||
FAR const char *name, int nsyms);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: symtab_findbyvalue
|
||||
*
|
||||
* Description:
|
||||
* Find the symbol in the symbol table whose value closest (but not greater
|
||||
* than), the provided value. This version assumes that table is not
|
||||
* ordered with respect to symbol name and, hence, access time will be
|
||||
* ordered with respect to symbol value and, hence, access time will be
|
||||
* linear with respect to nsyms.
|
||||
*
|
||||
* Returned Value:
|
||||
|
||||
Reference in New Issue
Block a user