Skip to content

LLVM depends on some symbols that are incorrectly exported by libffi on AArch64 #3839

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

Open
ziyao233 opened this issue Apr 25, 2025 · 2 comments

Comments

@ziyao233
Copy link
Member

After upgrading to libffi 3.4.81 (we skipped 3.4.7 release because of a breakage in Clang build in upstream), libLLVM-19.so in our AArch64 port isn't functional anymore, breaking Clang and our base-devel.

An unresolved symbol, __clear_cache, shows up when ldd on the shared library,

$ ldd /usr/lib/libLLVM-19.so 
        ldd (0xffffa4020000)
        libffi.so.8 => /usr/lib/../lib/libffi.so.8 (0xffffa3fe8000)
        libedit.so.0 => /usr/lib/../lib/libedit.so.0 (0xffffa3f84000)
        libz.so.1 => /usr/lib/../lib/libz.so.1 (0xffffa3f39000)
        libzstd.so.1 => /usr/lib/../lib/libzstd.so.1 (0xffffa3e67000)
        libxml2.so.2 => /usr/lib/../lib/libxml2.so.2 (0xffff9e08f000)
        libc++.so.1 => /usr/lib/../lib/libc++.so.1 (0xffff9df5b000)
        libc++abi.so.1 => /usr/lib/../lib/libc++abi.so.1 (0xffff9dee4000)
        libunwind.so.1 => /usr/lib/../lib/libunwind.so.1 (0xffffa3e27000)
        libc.so => ldd (0xffffa4020000)
        libncursesw.so.6 => /usr/lib/../lib/libncursesw.so.6 (0xffff9de57000)
        liblzma.so.5 => /usr/lib/../lib/liblzma.so.5 (0xffff9ddfe000)
Error relocating /usr/lib/libLLVM-19.so: __clear_cache: symbol not found

It's found that the symbol is actually exported by libffi.so. Bisecting suggests commit 593cb01 (Add mold linker to linker checks. (#866), 2024-12-13), which makes the buildscript correctly recognizes mold linker and enables versionscript support by default, removes the symbol since it's not listed in the script. This should be the correct behavior.

It's still unknown why __clear_cache used in libLLVM-19.so, which is implemented in compiler-rt, resolves to the symbol provided by libffi.

This introduces an ABI change in the dependency graph of our base-devel (libffi removes some symbol) and requires manual transition. Before figuring out the root cause, let's disable version script in libffi to workaround the ABI issue.

ziyao233 added a commit to ziyao233/eweos-packages that referenced this issue Apr 25, 2025
This won't be a correct fix, but the in-progress transition on AArch64
could continue.

Reference: eweOS#3839
ziyao233 added a commit that referenced this issue Apr 25, 2025
This won't be a correct fix, but the in-progress transition on AArch64
could continue.

Reference: #3839
@ziyao233
Copy link
Member Author

#3840 lands a workaround.

@ziyao233
Copy link
Member Author

ziyao233 commented May 8, 2025

The root cause is that symbols provided by compiler-rt aren't correctly set to HIDDEN visibility, see #3594.

@ziyao233 ziyao233 mentioned this issue May 8, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant