Skip to content

[dlfcn] Add library search path for DT_NEEDED resolution (#2076, #2122)#4

Draft
esaurez wants to merge 1 commit into
fix/dlfcn-atomic-registryfrom
fix/dlfcn-search-paths
Draft

[dlfcn] Add library search path for DT_NEEDED resolution (#2076, #2122)#4
esaurez wants to merge 1 commit into
fix/dlfcn-atomic-registryfrom
fix/dlfcn-search-paths

Conversation

@esaurez

@esaurez esaurez commented Apr 19, 2026

Copy link
Copy Markdown
Owner

Summary

Add library search path resolution for bare DT_NEEDED names and path normalization to prevent duplicate loading.

Fixes nanvix#2076 and nanvix#2122. Depends on PR #3 (atomic registry rollback).

Changes

  • resolve_library_path(): Searches lib/ for bare library names (e.g., libm.so -> lib/libm.so). Strips leading / so /lib/libc.so and lib/libc.so produce the same canonical path.
  • dlopen(): Calls resolve_library_path() at entry to normalize the filename.
  • load_all_dependencies(): Resolves bare dep names and matches against both bare and resolved names in the registry.

Affected Files

  • src/libs/syscall/src/dlfcn/syscall/mod.rsLIBRARY_SEARCH_PATHS, resolve_library_path()
  • src/libs/syscall/src/dlfcn/syscall/dlopen.rs — path resolution at entry and in dep loading

Testing

All existing integration tests pass.

@esaurez esaurez force-pushed the fix/dlfcn-search-paths branch from 577e8cf to 099b25a Compare April 20, 2026 17:34
@esaurez esaurez changed the base branch from dev to fix/dlfcn-atomic-registry April 20, 2026 17:36
@esaurez esaurez force-pushed the fix/dlfcn-search-paths branch from 099b25a to af08a9f Compare April 20, 2026 17:51
@esaurez esaurez force-pushed the fix/dlfcn-atomic-registry branch from 1677feb to 0b657d1 Compare April 20, 2026 20:04
@esaurez esaurez force-pushed the fix/dlfcn-search-paths branch 2 times, most recently from 5356da0 to 19608f9 Compare April 20, 2026 20:46
…2076, nanvix#2122)

Add resolve_library_path() that searches configured directories
(default: lib/) for bare library names from DT_NEEDED entries.
Paths are normalized by stripping leading / to ensure /lib/libc.so
and lib/libc.so are treated as the same library.

Changes:
- Add LIBRARY_SEARCH_PATHS static with default ["lib/"].
- Add resolve_library_path() with leading-/ stripping and file
  probing.
- dlopen() calls resolve_library_path() at entry.
- load_all_dependencies() resolves bare dep names and matches
  against both bare and resolved names.

Closes nanvix#2076
Closes nanvix#2122

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@esaurez esaurez force-pushed the fix/dlfcn-search-paths branch from 19608f9 to 0d0d6fa Compare April 20, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dlfcn] DT_NEEDED library search path is missing

1 participant