Stream: general

Topic: Demangled symbol format


marmeladema (Apr 26 2020 at 17:52, on Zulip):

Hello! I've been running some analysis on binaries/shared lib of my rust projects. If I look at the demangled symbol, i can see a lot of core::ptr::drop_in_place.XXXX where XXXX is some integer number. Does someone know what is this integer? And why is there so many entries for apparently the same thing (ie: core::ptr::drop_in_place in my example)

marmeladema (Apr 26 2020 at 18:34, on Zulip):

Ok i ended up finding https://github.com/rust-lang/rust/issues/60705
I will try that mangling scheme to see the differences :)

ecstatic-morse (Apr 26 2020 at 18:52, on Zulip):

@marmeladema drop_in_place is the name used for drop shims/drop glue, which is the code that calls Drop::drop and then recurses into fields when something is dropped.

marmeladema (Apr 26 2020 at 18:53, on Zulip):

Yep but i was wondering what was the .XXXX at the end. In the new mangling scheme, its waaay more detailed and most of those are now pointing to fully qualified "type name"

marmeladema (Apr 26 2020 at 18:55, on Zulip):

most of the symbols ending with a .XXXXX integer are gone but some are still there like:

  ".text/<wirefilter::types::Type as core::clone::Clone>::clone.1885",
  ".text/<wirefilter::types::Type as core::clone::Clone>::clone.2457",
marmeladema (Apr 26 2020 at 18:56, on Zulip):

(.text prefix being the section where the symbol is found)

ecstatic-morse (Apr 26 2020 at 18:56, on Zulip):

True. It looks like shims have a special namespace in the new mangling scheme as well. Is v0 name mangling behind a flag?

marmeladema (Apr 26 2020 at 18:57, on Zulip):

Yes, i had to use nightly and add

[build]
rustflags = "-Zsymbol-mangling-version=v0"

to my cargo config file

ecstatic-morse (Apr 26 2020 at 18:58, on Zulip):

Hmm. Not sure then. eddyb would know, but I think they're not feeling well lately.

marmeladema (Apr 26 2020 at 18:58, on Zulip):

:o i hope he's ok :o

Last update: Jun 05 2020 at 22:15UTC