Bug 14178 – C++ linux name mangling does not handle standard abbreviations for const types
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-02-14T20:40:54Z
Last change time
2018-06-08T08:44:23Z
Keywords
C++, mangling
Assigned to
No Owner
Creator
Guillaume Chatelet
Comments
Comment #0 by chatelet.guillaume — 2015-02-14T20:40:54Z
There is a name mangling issue in dmd related to the compression of usual stl types when the type is const
eg. dmd will mangle 'std::vector<int>::size() const' as '_ZNK3std6vectorIiSaIiEE4sizeEv' where it should be mangled '_ZNKSt6vectorIiSaIiEE4sizeEv'. Note 'std' is being compressed into 'St'.
I believe this is coming from https://github.com/D-Programming-Language/dmd/blob/master/src/cppmangle.c#L453 which tests only the non const type pattern.
According to http://mentorembedded.github.io/cxx-abi/abi.html#mangling-compression this substitution seems illegal "Note that substitutable components are the represented symbolic constructs, not their associated mangling character strings."
This lead to undefined reference when linking.
Comment #1 by chatelet.guillaume — 2015-03-18T09:04:58Z
Comment #3 by chatelet.guillaume — 2015-07-07T10:44:46Z
Many things are broken with the current implementation : template substitutions, abbreviations. I'm rewriting the mangling code but it's quite complicated.
The test suite is pretty incomplete too, this is the first thing I want to fix.
Comment #4 by dsp — 2015-07-07T11:33:06Z
I have a hacky implementation for that particular issue, but if you rewritting the mangeling code it might hold off.
Comment #5 by chatelet.guillaume — 2015-07-07T12:11:36Z
I expect it to take quite some time for me to have it right.
This might be worth submitting you fix meanwhile.
Comment #6 by bugzilla — 2017-02-09T10:02:57Z
(In reply to Guillaume Chatelet from comment #3)
> Many things are broken with the current implementation : template
> substitutions, abbreviations.
It'd be nice to see a list of these.
Comment #7 by chatelet.guillaume — 2017-02-09T12:01:52Z