Skip to content

Commit

Permalink
add dollar sign as valid suffix token
Browse files Browse the repository at this point in the history
  • Loading branch information
lqd committed Mar 2, 2022
1 parent 16f95f9 commit 8e83f7f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions text/2603-rust-symbol-name-mangling-v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ Mangled names conform to the following grammar:
<instantiating-crate> = <path>
// There are no restrictions on the characters that may be used
// in the suffix following the `.`.
<vendor-specific-suffix> = "." <suffix>
// in the suffix following the `.` or `$`.
<vendor-specific-suffix> = ("." | "$") <suffix>
```

### Namespace Tags
Expand Down Expand Up @@ -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.<numbers>` 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.<numbers>` 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

Expand Down

0 comments on commit 8e83f7f

Please sign in to comment.