Skip to content

Commit bba71f4

Browse files
authored
Document that RISC-V follows the Itanium C++ ABI for C++ name mangling (#194)
Closes: #175
1 parent 8f4d51f commit bba71f4

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

riscv-elf.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
* [Named ABIs](#named-abis)
1515
* [Default ABIs](#default-abis)
1616
* [Code models](#code-models)
17-
3. [C type details](#c-types)
18-
* [C type sizes and alignments](#c-type-sizes)
19-
* [C type representations](#c-type-representation)
17+
3. [C/C++ type details](#c-types)
18+
* [C/C++ type sizes and alignments](#c-type-sizes)
19+
* [C/C++ type representations](#c-type-representation)
2020
* [va_list, va_start, and va_arg](#va-list-va-start-and-va-arg)
21+
* [C++ Name Mangling](#c++-name-mangling)
2122
4. [ELF Object Files](#elf-object-file)
2223
* [File Header](#file-header)
2324
* [Sections](#sections)
@@ -370,11 +371,12 @@ a signed 32-bit offset, relative to the value of the `pc` register,
370371
can be produced.
371372
This code model is position independent.
372373

373-
# <a name=c-types></a>C type details
374374

375-
## <a name=c-type-sizes></a>C type sizes and alignments
375+
# <a name=c-types></a>C/C++ type details
376376

377-
There are two conventions for C type sizes and alignments.
377+
## <a name=c-type-sizes></a>C/C++ type sizes and alignments
378+
379+
There are two conventions for C/C++ type sizes and alignments.
378380

379381
* **LP64, LP64F, LP64D, and LP64Q**: use the following type sizes and
380382
alignments (based on the LP64 convention):
@@ -424,7 +426,7 @@ The alignment of `max_align_t` is 16.
424426
Structs and unions are aligned to the alignment of their most strictly aligned
425427
member. The size of any object is a multiple of its alignment.
426428

427-
## <a name=c-type-representation></a>C type representations
429+
## <a name=c-type-representation></a>C/C++ type representations
428430

429431
`char` is unsigned.
430432

@@ -449,6 +451,14 @@ of the vararg save area. The `va_arg` macro will increment its `va_list`
449451
argument according to the size of the given type, taking into account the
450452
rules about 2&times;XLEN aligned arguments being passed in "aligned" register pairs.
451453

454+
## <a name=c++-name-mangling></a>C++ Name Mangling
455+
456+
C++ name mangling for RISC-V follows the [Itanium C++ ABI](http://itanium-cxx-abi.github.io/cxx-abi/); there are no RISC-V
457+
specific mangling rules.
458+
459+
See [Type encodings](http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-type)
460+
for more detail on how to mangle types.
461+
452462
# <a name=elf-object-file></a>ELF Object Files
453463

454464
## <a name=file-header></a>File Header

0 commit comments

Comments
 (0)