[llvm] [llvm] export private symbols needed by unittests (PR #145767)

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 9 10:00:11 PDT 2025


compnerd wrote:

> > I wonder if we should track these somehow? Since we will have some path towards a more formal definition of the API surface that is needed as ABI for the tools, we could work from there to a future where we can maintain source compatibility at least (C++ is not the best language for ABI stability).
> 
> @compnerd not sure it solves the problem you're thinking of, but I have considered aliasing `LLVM_ABI` to a different name, like `LLVM_ABI_FOR_TEST` or `LLVM_ABI_PRIVATE`, to use in places where it isn't actually supposed to be part of the public ABI. It would at least be a bit more self-documenting when people encounter it.
> 
> Ideally, I think unit tests that access private APIs should link statically against the components they test. Other functional tests should only use the public interface and can link against the shared library. Exporting some private interfaces in this PR is more of a pragmatic solution for the existing codebase.

I think that `LLVM_ABI_FOR_TEST` is great! It would resolve my issue with the approach - it makes it clear that these are specifically for tests. Possibly we could even allow building a release mode distribution which would remove those from the ABI easily.

https://github.com/llvm/llvm-project/pull/145767


More information about the llvm-commits mailing list