[libcxx-commits] [libcxx] [libcxx] Use local names for the operator new impl symbols (PR #122983)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 14 15:00:01 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Petr Hosek (petrhosek)

<details>
<summary>Changes</summary>

This way the impl symbols don't even make it into the symbol table which is important for symbolization since we want the symbolizer to always pick up the public symbol (which has the same address as the impl one).

---
Full diff: https://github.com/llvm/llvm-project/pull/122983.diff


1 Files Affected:

- (modified) libcxx/src/include/overridable_function.h (+2-2) 


``````````diff
diff --git a/libcxx/src/include/overridable_function.h b/libcxx/src/include/overridable_function.h
index 7372e347831bb4..71feebf0c15b20 100644
--- a/libcxx/src/include/overridable_function.h
+++ b/libcxx/src/include/overridable_function.h
@@ -90,8 +90,8 @@ _LIBCPP_END_NAMESPACE_STD
 
 #  define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
 #  define _LIBCPP_OVERRIDABLE_FUNCTION(symbol, type, name, arglist)                                                    \
-    static type symbol##_impl__ arglist __asm__(_LIBCPP_TOSTRING(symbol##_impl__));                                    \
-    [[gnu::weak, gnu::alias(_LIBCPP_TOSTRING(symbol##_impl__))]] type name arglist;                                    \
+    static type symbol##_impl__ arglist __asm__(".L" _LIBCPP_TOSTRING(symbol));                                        \
+    [[gnu::weak, gnu::alias(".L" _LIBCPP_TOSTRING(symbol))]] type name arglist;                                        \
     _LIBCPP_BEGIN_NAMESPACE_STD                                                                                        \
     template <>                                                                                                        \
     inline bool __is_function_overridden<static_cast<type(*) arglist>(name)>() {                                       \

``````````

</details>


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


More information about the libcxx-commits mailing list