rizinorg / rz-libdemangle

Rizin Library to demangle symbols
6 stars 5 forks source link

Support GNUv2 C++ mangling scheme #8

Closed XVilka closed 1 year ago

XVilka commented 3 years ago

Support GNUv2 C++ mangling scheme

How to reproduce:

[0x00000000]> iD c++ _AddColor__10ZafDisplayUcUcUcUcUc
# Get nothing

Currently demangling is implemented in librz/bin/mangling/*. The code on which the current GNU demangler is based on might have supported the V2 scheme as it contains gnu_demangling and gnu_v3_demangling in the list mangling styles.

See "8.4 Gnu 2 name mangling" chapter of the calling_conventions.pdf to understand the mangling syntax.

cc @karliss

karliss commented 3 years ago

One thing to consider is do we want to maintain our own version of libiberty glued together from multiple versions of it or better write a new clean implementation for GNUv2 mangling and use an unmodified libiberty for handling the new versions.

From what I understood it is desired in rizin cleaning up the dependencies so that they are better separated, labelled and with minimal modifications. This direction would be against the first approach and more in favor the second. Last version of GCC 2.x was released in 1999-2001. From the calling convention document variations of it were also used by other toolchains of that period and earlier possibly not only GCC. Although switching to newer ABI and toolchains might have taken some time. The older version of libiberty might not even properly handle those variations, who knows. So doing this properly might involve some software archeology. Anyone wanting to work on it should be prepared and interested in that.

It would be also valuable to gather more specific information on the toolchains, their versions, platforms, dates using it.

wargio commented 1 year ago

This adds support but is GPL. https://github.com/rizinorg/rz-libdemangle/pull/41