[llvm] [llvm] add documentation for public interface annotations (LLVM_ABI, etc) (PR #134710)

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 13:44:36 PDT 2025


================
@@ -0,0 +1,277 @@
+LLVM Interface Export Annotations
+=================================
+
+With the following build settings, LLVM will be built as a shared library with
+hidden default symbol visibility:
+
+::
+
+   LLVM_BUILD_LLVM_DYLIB_VIS=On
+   LLVM_BUILD_LLVM_DYLIB=On
+   LLVM_LINK_LLVM_DYLIB=On
+
+When building LLVM in this configuration, any symbol intended to be visible to
+clients must be explicitly exported.
+
+Exporting a symbol typically requires annotating it with the ``LLVM_ABI`` macro
+defined in `compiler.h
+<https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Support/Compiler.h#L152>`__.
+There are similar annotations that must be used in a few special cases. This
+document describes the common patterns for annotating LLVM symbols for export.
+
----------------
compnerd wrote:

I feel like we should have a section prior to the various cases about the macro itself. In particular, the following bits are useful to cover:

1. naming - `LLVM_ABI` vs `LLVMSupport_ABI` vs `Clang_ABI` vs `libclang_ABI`. The naming is important as it is not a "LLVM project ABI" but rather the "library named 'llvm'".
2. The need for the macro (a cursory explanation of DLL storage)

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


More information about the llvm-commits mailing list