Skip to content
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

CMake: Visibility hidden is not applied to asm: T _blake3_compress_in_place_avx512 #322

Open
vt-alt opened this issue Jul 9, 2023 · 1 comment

Comments

@vt-alt
Copy link

vt-alt commented Jul 9, 2023

-fvisibility=hidden is not applied to asm sources (and will not work AFAIK) making libblake3 export internal functions like _blake3_compress_in_place_avx512 (note _ prefix):

000000000000c4c0 T _blake3_compress_in_place_avx512
000000000000f240 T _blake3_compress_in_place_sse2
0000000000011c40 T _blake3_compress_in_place_sse41
000000000000c640 T _blake3_compress_xof_avx512
000000000000f440 T _blake3_compress_xof_sse2
0000000000011e00 T _blake3_compress_xof_sse41
0000000000006800 T _blake3_hash_many_avx2
0000000000008d80 T _blake3_hash_many_avx512
000000000000c800 T _blake3_hash_many_sse2
000000000000f680 T _blake3_hash_many_sse41

Maybe it's better to use version-script?

Something like this should work in Linux: add -Wl,--version-script=libblake3.map to final linking step with libblake3.map content:

{
        global:
                blake3_version;
                blake3_hasher_init;
                blake3_hasher_init_keyed;
                blake3_hasher_init_derive_key;
                blake3_hasher_init_derive_key_raw;
                blake3_hasher_update;
                blake3_hasher_finalize;
                blake3_hasher_finalize_seek;
        local: *;
};

@BurningEnlightenment

@BurningEnlightenment
Copy link
Collaborator

The hidden symbols on non-Windows platforms just were a nice side artifact that came about when adding support for dynamic libraries for Windows.

I'm aware that CMake's visibility option has no effect on assembly symbols, but I don't think this is worth fixing. Especially since linker scripts introduce further compatibility issues (not all linkers support version-scripts), making the build system even more complicated for little benefit.

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

No branches or pull requests

2 participants