@@ -623,7 +623,8 @@ Mangled names conform to the following grammar:
623
623
624
624
```
625
625
// The <decimal-number> specifies the encoding version.
626
- <symbol-name> = "_R" [<decimal-number>] <path> [<instantiating-crate>]
626
+ <symbol-name> =
627
+ "_R" [<decimal-number>] <path> [<instantiating-crate>] [<vendor-specific-suffix>]
627
628
628
629
<path> = "C" <identifier> // crate root
629
630
| "M" <impl-path> <type> // <T> (inherent impl)
@@ -746,6 +747,10 @@ Mangled names conform to the following grammar:
746
747
// We use <path> here, so that we don't have to add a special rule for
747
748
// compression. In practice, only a crate root is expected.
748
749
<instantiating-crate> = <path>
750
+
751
+ // There are no restrictions on the characters that may be used
752
+ // in the suffix following the `.` or `$`.
753
+ <vendor-specific-suffix> = ("." | "$") <suffix>
749
754
```
750
755
751
756
### Namespace Tags
@@ -801,6 +806,21 @@ With this post-processing in place the Punycode strings can be treated
801
806
like regular identifiers and need no further special handling.
802
807
803
808
809
+ ### Vendor-specific suffix
810
+
811
+ Similarly to the [ Itanium C++ ABI mangling scheme] [ itanium-mangling-structure ] ,
812
+ a symbol name containing a period (` . ` ) or a dollar sign (` $ ` ) represents a
813
+ vendor-specific version of the symbol. There are no restrictions on the
814
+ characters following the period or dollar sign.
815
+
816
+ This can happen in practice when locally unique names needed to become globally
817
+ unique. For example, LLVM can append a ` .llvm.<numbers> ` suffix during LTO to
818
+ ensure a unique name, and ` $ ` can be used for thread-local data on Mach-O. In
819
+ these situations it's generally fine to ignore the suffix: the suffixed name has
820
+ the same semantics as the original.
821
+
822
+ [ itanium-mangling-structure ] : https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-structure
823
+
804
824
## Compression
805
825
806
826
Symbol name compression works by substituting parts of the mangled
@@ -1156,3 +1176,4 @@ pub static QUUX: u32 = {
1156
1176
- Make ` <binder> ` optional in ` <fn-sig> ` and ` <dyn-bounds> ` productions.
1157
1177
- Extend ` <const-data> ` to include ` bool ` values, ` char ` values, and negative integer values.
1158
1178
- Remove type from constant placeholders.
1179
+ - Allow vendor-specific suffixes.
0 commit comments