[libc-commits] [libc] [libc] Move from alias(X) to asm(X) for aliasing (PR #89333)

via libc-commits libc-commits at lists.llvm.org
Fri Apr 19 16:16:38 PDT 2024


================
@@ -25,7 +25,7 @@
 #define LLVM_LIBC_FUNCTION_IMPL(type, name, arglist)                           \
   LLVM_LIBC_FUNCTION_ATTR decltype(LIBC_NAMESPACE::name)                       \
       __##name##_impl__ __asm__(#name);                                        \
-  decltype(LIBC_NAMESPACE::name) name [[gnu::alias(#name)]];                   \
----------------
lntue wrote:

So currently, the unmangled symbol `#name` is declared as the public symbol of `LIBC_NAMESPACE::name_impl`, which is declared in https://github.com/llvm/llvm-project/blob/main/libc/src/__support/common.h#L27 and define in https://github.com/llvm/llvm-project/blob/main/libc/src/__support/common.h#L29.

https://github.com/llvm/llvm-project/blob/main/libc/src/__support/common.h#L28 then defines the other C++ public symbol `LIBC_NAMESPACE::name` and aliases it with the unmangled C symbol.

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


More information about the libc-commits mailing list