You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "casaroli (via GitHub)" <gi...@apache.org> on 2026/10/11 18:57:44 UTC
[PR] libs/libc/elf: Read the symbol and string tables at once to find a symbol. [nuttx]
casaroli opened a new pull request, #20601:
URL: https://github.com/apache/nuttx/pull/20601
## Summary
`libelf_findsymbol()` read every symbol and then its name with separate file reads. binfmt calls it on every exec for `nx_stacksize` and `nx_priority` (and for `nx_uid`, `nx_gid` and `nx_mode` with `SCHED_USER_IDENTITY`), and most programs define none of them, so each call read the whole table. For a program with 5700 symbols that is about 23000 reads per exec.
This PR reads the symbol table and the string table into memory once and compares the names there. If there is no memory for them, it reads one symbol at a time as before.
## Impact
Faster exec of ELF programs, mostly on slow file systems. The loader allocates the two tables for the time of the search.
## Testing
The run-time tests ran on a local branch that has this change and other pending changes on top of master; the builds are of this branch alone.
qemu-armv8a, kernel build, QEMU 11 with HVF on Apple M4, programs on a virtio 9P share. An exec of a program with 5700 symbols took 1.2 s before and 44 ms after (10 execs in 437 ms).
Builds with `-Wno-cpp -Werror`: `qemu-armv8a:knsh`, `mps2-an500:nsh`, `rv-virt:knsh64`. `tools/checkpatch.sh -c -u -m -g` passes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] libs/libc/elf: Read the symbol and string tables at once to find a symbol. [nuttx]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20601:
URL: https://github.com/apache/nuttx/pull/20601#issuecomment-6112594091
<!-- membrowse-pr-comment -->
## <img src="https://membrowse.com/membrowse-logo.svg" height="24" align="top"> MemBrowse Memory Report
### [s698pm-dkit](https://membrowse.com/public/apache/nuttx/target/s698pm-dkit/compare?head=e4927bcab8bb4238a92f8a07eb8ff28c9edaa857&base=4bc1ab2fd7bede547e91c8e3a7dac3bd6eb941f7)
- **Code**: .text +640 B (+0.2%, 374,480 B)
*No memory changes detected for:*
- [arduino-mega2560](https://membrowse.com/public/apache/nuttx/target/arduino-mega2560/compare?head=e4927bcab8bb4238a92f8a07eb8ff28c9edaa857&base=4bc1ab2fd7bede547e91c8e3a7dac3bd6eb941f7)
- [esp32-devkitc](https://membrowse.com/public/apache/nuttx/target/esp32-devkitc/compare?head=e4927bcab8bb4238a92f8a07eb8ff28c9edaa857&base=4bc1ab2fd7bede547e91c8e3a7dac3bd6eb941f7)
- [hifive1-revb](https://membrowse.com/public/apache/nuttx/target/hifive1-revb/compare?head=e4927bcab8bb4238a92f8a07eb8ff28c9edaa857&base=4bc1ab2fd7bede547e91c8e3a7dac3bd6eb941f7)
- [mirtoo](https://membrowse.com/public/apache/nuttx/target/mirtoo/compare?head=e4927bcab8bb4238a92f8a07eb8ff28c9edaa857&base=4bc1ab2fd7bede547e91c8e3a7dac3bd6eb941f7)
- [qemu-armv8a](https://membrowse.com/public/apache/nuttx/target/qemu-armv8a/compare?head=e4927bcab8bb4238a92f8a07eb8ff28c9edaa857&base=4bc1ab2fd7bede547e91c8e3a7dac3bd6eb941f7)
- [qemu-intel64](https://membrowse.com/public/apache/nuttx/target/qemu-intel64/compare?head=e4927bcab8bb4238a92f8a07eb8ff28c9edaa857&base=4bc1ab2fd7bede547e91c8e3a7dac3bd6eb941f7)
- [rx65n-rsk2mb](https://membrowse.com/public/apache/nuttx/target/rx65n-rsk2mb/compare?head=e4927bcab8bb4238a92f8a07eb8ff28c9edaa857&base=4bc1ab2fd7bede547e91c8e3a7dac3bd6eb941f7)
- [stm32-nucleo-f103rb](https://membrowse.com/public/apache/nuttx/target/stm32-nucleo-f103rb/compare?head=e4927bcab8bb4238a92f8a07eb8ff28c9edaa857&base=4bc1ab2fd7bede547e91c8e3a7dac3bd6eb941f7)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] libs/libc/elf: Read the symbol and string tables at once to find a symbol. [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis merged PR #20601:
URL: https://github.com/apache/nuttx/pull/20601
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org