digitalmars.D.bugs - [Issue 8207] New: OS X: Should extern(D) symbols include another underscore?
- d-bugmail puremagic.com (42/42) Jun 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8207
- d-bugmail puremagic.com (8/8) Jun 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8207
http://d.puremagic.com/issues/show_bug.cgi?id=8207 Summary: OS X: Should extern(D) symbols include another underscore? Product: D Version: D2 Platform: All OS/Version: Mac OS X Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: code klickverbot.at --- Comment #0 from klickverbot <code klickverbot.at> 2012-06-07 15:30:14 PDT --- On OS X, all symbol names by default have a leading underscore. For example, the C `printf` function is represented as `_printf`. This mangling scheme is expected at least by the system GDB and several other tools, which strip the leading underscore when rendering symbol names. Currently (DMD 2.060 Git), however, extern(D) symbols only have a single leading underscore as well. For example, `void foo()` in a module called test becomes `_D4test3fooFZv`, which in turn would be displayed by GDB as `D4test3fooFZv` This seems wrong, as the D ABI requires a leading underscore as part of the symbol name itself. If another underscore was added, it would e.g. the above function to be correctly displayed in GDB as `_D4test3fooFZv`. This is not merely a cosmetic issue, as other compilers have to follow the same ABI. My proposal would be to modify the Mach obj backend of DMD to also emit the additional underscore, instead of modifying LDC (and possibly GDC as well), because: 1) It would cause the names to be displayed as described in the spec in the tools. 2) The LLVM toolchain adds the underscore automatically, which seems to be a strong indication of the common practice, and 3) indeed, GCC also emits C++ functions with two underscores, e.g. __ZN4llvm10error_code7successEv (and the ABI describes the mangling with a single leading underscore as well). I already have a set of changes for this ready to be submitted as a pull request, in case this route is agreed on. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 07 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8207 --- Comment #1 from klickverbot <code klickverbot.at> 2012-06-07 16:37:16 PDT --- The D demangling code in newer GDB versions also seems to expect two underscores, see issue 8172. Will try to test my changes more thoroughly and put together a pull request asap. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 07 2012