-
Notifications
You must be signed in to change notification settings - Fork 772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide private symbols in libarchive.so #1017
Comments
First, you should double-check your list. Libarchive's public API includes everything in A 1% reduction in code size is not particularly interesting, and I suspect the dynamic linker speedup is similarly modest. However, preventing clients from using internal APIs is a good thing, and this seems like a simple way to achieve that. |
Thanks, Tim. Indeed, I missed 0001-Hide-private-symbols-v2.patch.txt Note that code size reduction is a bit misleading. Hidden visibility allows to perform inlining and cloning more aggressively so code size typically grows at BTW do you think -fno-semantic-interposition is worth a try? This would allow GCC to assume that even exported functions won't be interposed at runtime and optimize calls to them more heavily. |
Tim, have you made up your mind on this? I think it it's a no-go we better close the issue, otherwise I'd be happy to perform additional testing/refactor. Updated patch which does a better job of checking for availability of visibility. |
@kientzle A friendly reminder. I'm fine with closing this if it's not interesting for the project. If it is, I'd be happy to make needed updates. |
It would be really useful to have this. Exposing private symbols makes it very hard for ABI checkers as well to function correctly. |
I have no problems with this. |
@yugr did you validate that building against this project still works after your change? (In other words public ABI remains such) |
AFAIR I only verified that |
I took liberty of grabbing patch for testing into https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/merge_requests/7646, it will be built against bunch of projects and ABI checker against version without the patch will be ran at the end of build which should clearly state which symbols get hidden. |
abidiff.txt |
Two concerns:
|
Okay, I would say fixing visibility of archive_entry symbols is probably blocker for this work then. Maybe they should be exposed through headers? |
These symbols are not present in installed headers so shouldn't this be a good thing? |
@kientzle so what's the next step? Are those actually supposed to be exposed and if yes, should they be added into headers? |
This ABI cleanup would still be desired by libarchive downstreams. |
I was mistaken. Those are not in fact supposed to be exposed. This can go ahead. (Sorry for the long delay.) |
…s (see discussion in libarchivegh-1017).
…s (see discussion in libarchivegh-1017).
…s (see discussion in libarchivegh-1017).
Fixed. |
Libarchive.so presently exports 281 symbols (over 50%, full list attached) which are not present in libarchive's headers and thus are not supposed to be used by clients.
Removing these symbols would allow compiler to optimize code more aggressively (
.text
reduced by 1%), speed up dynamic linker on Linux and prevent clients from inadvertently using internal APIs.I attached a simple patch that hides private symbols. It passes make check (I can do additional testing if needed). Would something like this be interesting for the project?
0001-Hide-private-symbols.patch.txt
private_syms.txt
The issue was found using ShlibVisibilityChecker.
The text was updated successfully, but these errors were encountered: