#3748 closed defect (fixed)

libdl uses a linear symbol search on object file symbols

Reported by: Chris Johns Owned by: Chris Johns <chrisj@…>
Priority: normal Milestone: 5.1
Component: lib/dl Version: 5
Severity: normal Keywords:
Cc: Blocked By:


Symbol searching has two parts, searching the object file and searching the global symbol table. Currently the object file search is linear and the global table search uses a hash table.

A large incrementally linked object file can have a large local and global set of symbols and this can slow the loading process. This issue does not show up for small object files with a few symbols which is typically how our libraries are made.

Change the object file symbol search to a binary search (bsearch). A hash table for each object file would increase the in memory object file footprint by a significant amount and would harm the small object file use case that only have a few symbols. A binary search is a suitable compromise.

Change History (1)

comment:1 Changed on May 22, 2019 at 12:03:14 AM by Chris Johns <chrisj@…>

Owner: set to Chris Johns <chrisj@…>
Resolution: fixed
Status: assignedclosed

In 327e45da/rtems:

libdl: Sort object file symbols and use a binary search to find

  • Replace the linear object file symbol search with a binary search.
  • Sort the object file symbols after loading.

Closes #3748

Note: See TracTickets for help on using tickets.