ldc-developers / ldc

The LLVM-based D Compiler.
http://wiki.dlang.org/LDC
Other
1.2k stars 260 forks source link

OS X: Extra underscore in name mangling #114

Closed dnadlinger closed 6 years ago

dnadlinger commented 12 years ago

The OS X toolchain appends an underscore in front of symbols by default. For example, the symbol for printf is actually _printf, and if we emit a symbol _D3std… in LLVM, it becomes __D3std….

This seems to make sense, since GDB also expects the underscore and displays it as _D3std…. However, DMD emits an underscore less for extern(D) functions, thus this either needs fixing on our or on DMD side. I'm inclined to say that the DMD behavior should change, because it causes e.g. symbols in GDB to display as D3std…, whereas the D ABI documentation explicitly specifies the underscore as part of the symbol name.

dnadlinger commented 12 years ago

Upstream ticket: http://d.puremagic.com/issues/show_bug.cgi?id=8207

dnadlinger commented 9 years ago

Reported again in #971.

kinke commented 6 years ago

DMD switched to the extra underscore in 2.079.