Skip to content

Version script glob support#943

Merged
davidlattimore merged 5 commits into
wild-linker:mainfrom
marxin:version-script-glob-support
Jun 28, 2025
Merged

Version script glob support#943
davidlattimore merged 5 commits into
wild-linker:mainfrom
marxin:version-script-glob-support

Conversation

@marxin

@marxin marxin commented Jun 27, 2025

Copy link
Copy Markdown
Collaborator

Based on the discussion with David, I tested the bevy with dynamic linking (500K symbols in a version script file), and I decided to keep the exact match implementation. The only change is that glob::Pattern is used for a general glob pattern; having that, the link time is equal for bevy. For a reasonably sized shared library that uses a couple of general globs, the speed should be good!

Plus the PR support if a space(s) is present after a symbol name.

@marxin marxin force-pushed the version-script-glob-support branch from 7297ba1 to 33a4597 Compare June 27, 2025 18:10

@davidlattimore davidlattimore left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Definitely good to have support for more patterns. The utf-8 string thing does make me a bit uneasy, but I guess we can go with it and potentially change it to something byte-based later.

Out of curiosity, what kinds of patterns have you encountered that weren't something*? Is it just patterns that have * somewhere in the middle, or have you found use of ? or character sets?

Comment thread libwild/src/version_script.rs Outdated
@marxin

marxin commented Jun 28, 2025

Copy link
Copy Markdown
Collaborator Author

Out of curiosity, what kinds of patterns have you encountered that weren't something*? Is it just patterns that have * somewhere in the middle, or have you found use of ? or character sets?

One example could be alsa-lib, where one of the versions is defined as:

$ wc -l ./work/alsa-lib-1.2.14-abi_x86_64.amd64/src/Versions
222 ./work/alsa-lib-1.2.14-abi_x86_64.amd64/src/Versions
...
$ grep '\*' ./work/alsa-lib-1.2.14-abi_x86_64.amd64/src/Versions
    snd_*;
    _snd_*_open;
    _snd_*_dlsym_*;
    _snd_*_poll_descriptor;
    _snd_pcm_hook_*;
    __snd_pcm_hw_params_*;
    __snd_pcm_sw_params_*;
    __snd_*_dlsym_*;
    *;
    _snd_safe_strto*;
    snd_ump_*;
    snd_seq_ump_*;
    snd_ump_endpoint_info_set_*;
    snd_ump_block_info_set_*;

@marxin marxin force-pushed the version-script-glob-support branch from 33a4597 to e1ac194 Compare June 28, 2025 12:48
@marxin

marxin commented Jun 28, 2025

Copy link
Copy Markdown
Collaborator Author

The utf-8 string thing does make me a bit uneasy, but I guess we can go with it and potentially change it to something byte-based later.

Yep, my expectation is the glob patterns are not so common, and if so, then the total number of symbols is reasonably small.

@marxin marxin requested a review from davidlattimore June 28, 2025 12:49
@marxin

marxin commented Jun 28, 2025

Copy link
Copy Markdown
Collaborator Author

Well, in the context of #952, I believe, the symbol identifiers should be valid UTF-8 strings :)

@davidlattimore davidlattimore merged commit dea0f60 into wild-linker:main Jun 28, 2025
20 checks passed
@marxin marxin deleted the version-script-glob-support branch June 29, 2025 05:49
AadiWaghray pushed a commit to AadiWaghray/wild that referenced this pull request Aug 10, 2025
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