Skip to content

feat: Allow specifying library search paths in version scripts and export lists#1477

Merged
lapla-cogito merged 1 commit into
wild-linker:mainfrom
lapla-cogito:version_script_lib_path
Jan 22, 2026
Merged

feat: Allow specifying library search paths in version scripts and export lists#1477
lapla-cogito merged 1 commit into
wild-linker:mainfrom
lapla-cogito:version_script_lib_path

Conversation

@lapla-cogito

@lapla-cogito lapla-cogito commented Jan 22, 2026

Copy link
Copy Markdown
Member

When the -L option specifies a library search path, Wild now also searches that path for version scripts and export lists if none are found in the current directory.

@lapla-cogito lapla-cogito force-pushed the version_script_lib_path branch from 6625457 to a00c975 Compare January 22, 2026 05:00
@lapla-cogito lapla-cogito changed the title feat: Allow specifying library search paths in version scripts feat: Allow specifying library search paths in version scripts and export lists Jan 22, 2026
Comment thread libwild/src/input_data.rs
.export_list_path
.as_ref()
.map(|path| read_script_data(path, inputs_arena))
.map(|path| read_script_data(&resolve_script_path(path), inputs_arena))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first, I thought there was no need to apply the same change to export_list, based on how mold implements the corresponding part. However, I found that GNU ld searches paths specified via -L when options such as --dynamic-list are provided. Therefore, to match GNU ld’s behavior, this change also applies to export_list.

(▰╹◡╹)❯  tree .
.
├── searchdir
│   └── test.list
└── test.c

2 directories, 2 files

(▰╹◡╹)❯  gcc -shared -o test.so test.c -fPIC -Wl,-Lsearchdir -Wl,--dynamic-list,test.list -fuse-ld=mold
mold: fatal: cannot open test.list: No such file or directory
collect2: error: ld returned 1 exit status

(▰╹^╹)❯  gcc -shared -o test.so test.c -fPIC -Wl,-Lsearchdir -Wl,--dynamic-list,test.list -fuse-ld=bfd

(▰╹◡╹)❯  ls test.so
test.so

@lapla-cogito lapla-cogito merged commit a9b22ac into wild-linker:main Jan 22, 2026
20 checks passed
@lapla-cogito lapla-cogito deleted the version_script_lib_path branch January 22, 2026 05:44
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.

2 participants