[libcxx-commits] [libcxx] [libcxx] Support providing symbol suffix through compiler define (PR #122570)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 16 08:11:09 PST 2025


================
@@ -56,6 +56,15 @@
 // with this macro must be defined at global scope.
 //
 
+// When -funique-internal-linkage-names option is enabled, Clang will append a unique suffix
----------------
ldionne wrote:

It sounds like a generally missing feature that Clang doesn't provide any way to access that. I would prefer if we instead introduced either a macro that contains this suffix, or even better some kind of `__builtin_symbol_name(name)` that returns a string representing the symbol name for that entity while taking into account `-funique-internal-linkage-names` if needed.

That's something we could also use when defining `operator new` itself, i.e. we would not have to hardcode the mangled name in the macro. Similarly, we could refactor horrors like https://github.com/llvm/llvm-project/blob/main/libcxx/src/iostream.cpp#L22 where we hardcode mangled names, something @philnik777 was looking to do recently.

WDYT?

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


More information about the libcxx-commits mailing list