From 8e83f7fc7fc8ac543e66948908e6b8cb422adf96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Wed, 2 Mar 2022 11:09:20 +0100 Subject: [PATCH] add dollar sign as valid suffix token --- text/2603-rust-symbol-name-mangling-v0.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/text/2603-rust-symbol-name-mangling-v0.md b/text/2603-rust-symbol-name-mangling-v0.md index b9f660b6666..5489b3d19c8 100644 --- a/text/2603-rust-symbol-name-mangling-v0.md +++ b/text/2603-rust-symbol-name-mangling-v0.md @@ -749,8 +749,8 @@ Mangled names conform to the following grammar: = // There are no restrictions on the characters that may be used -// in the suffix following the `.`. - = "." +// in the suffix following the `.` or `$`. + = ("." | "$") ``` ### Namespace Tags @@ -809,12 +809,13 @@ like regular identifiers and need no further special handling. ### Vendor-specific suffix Similarly to the [Itanium C++ ABI mangling scheme][itanium-mangling-structure], a symbol name -containing a period (`.`) represents a vendor-specific version of the symbol. There are no -restrictions on the characters following the period. +containing a period (`.`) or a dollar sign (`$`) represents a vendor-specific version of the symbol. +There are no restrictions on the characters following the period or dollar sign. This can happen in practice when locally unique names needed to become globally unique. For example, -LLVM can append a `.llvm.` suffix during LTO to ensure a unique name. In these situations -it's generally fine to ignore the suffix: the suffixed name has the same semantics as the original. +LLVM can append a `.llvm.` suffix during LTO to ensure a unique name, and `$` can be used +for thread-local data on Mach-O. In these situations it's generally fine to ignore the suffix: the +suffixed name has the same semantics as the original. [itanium-mangling-structure]: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-structure