Collision-resistant hashing
Mark Mitchell
mark at codesourcery.com
Wed Dec 1 16:40:43 UTC 1999
>>>>> "Jonathan" == Jonathan Schilling <jls at sco.com> writes:
>> From: Mark Mitchell <mark at codesourcery.com>
>>
>> >>>>> "Jim" == Jim Dehnert <dehnert at baalbek.engr.sgi.com>
>> writes:
>>
Jim> I'm intrigued by Jonathon's idea of separating the link name
Jim> from the "real" mangled name. Suppose we used the
>> I thought that was my idea. :-) :-)
Jonathan> It was! I just made a comment on one point and Jim must
Jonathan> have misread the mail quotings.
Not that it matters; that's why I smiled.
Jonathan> In fact, I'm a little skeptical about this approach. It
Jonathan> probably violates the user expectation that the linker
Jonathan> symbol table name is also the mangled name; they won't
Jonathan> realize that there's a side table somewhere that is
Jonathan> needed to correlate the two. And I think "c++filt" has
Jonathan> to work all the time, not just when code is built with
Jonathan> -g.
Well, that's not, strictly speaking, an ABI issue. Perhaps your
compiler would keep the sections unless `strip' is used; another might
never emit them in the first place. I can imagine different user
communities having different needs here.
>From an ABI point of view, we need to say how one program can be
linked with another, so that requires specifying the mangling. We
need to specify how the linker handles any special sections (like the
hashed-name-to-long-mangled name section). It would also be nice if
debuggers could handle ABI-compliant programs without knowing which
compiler created them; that requires defining a way to get the long
names out. But, specifying exactly when the table is present seems to
me exactly akin to specifying when debugging information is present.
One interesting bit is that with a 160-bit hash (the length often used
for serious cryptographic purposes) you can be basically assured that
no two mangled names in the universe ever until the sun burns out will
collide. So, you could actually use a global repository
(mangled-name.com) to store all of them. Startup, anyone? :-) :-)
Seriously, some toolchains could conceivably put mangled names in some
kind of system-global repository (in ~/.mangled-names) or some such
rather than use the special section.
I don't really think that's a good idea, but I don't see it as an ABI
issue either.
--
Mark Mitchell mark at codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the cxx-abi-dev
mailing list