[Binutils support] Add demangling to libiberty

Iain Buclaw ibuclaw at gdcproject.org
Sat Jan 11 06:13:08 PST 2014


On 10 January 2014 20:05, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> On Fri, Jan 10, 2014 at 05:51:17PM +0000, Iain Buclaw wrote:
>> One of the binutils devs suggested this, to move D demangling into
>> libiberty, that way binutils programs (and any other program that
>> uses libiberty in a similar manner) will gain D support.
> [...]
>
> Yes! Please do!! This will go a long way in helping D get stronger tool
> support, at least on GNU platforms.
>


This is a start.  Unfortunately through testing, it becomes more
apparently that the ability to demangle templates is absolute key here
to the success of this.

Without demangling:
$ ./ld/ld-new test.o 2>&1 | grep -v "__T"

./ld/ld-new: warning: cannot find entry symbol _start; defaulting to
0000000000400120
test.o: In function `main':
/opt/usr/include/d/4.9.0/__entrypoint.di:59: undefined reference to
`_d_run_main'
test.o: In function `_Dmain':
/home/iain/src/gdc/gdb/objdir/test.d:5: undefined reference to
`_D3std4math3tanFNaNbNeeZe'
test.o: In function `test._D4test9__modinitFZv':
/home/iain/src/gdc/gdb/objdir/test.d:5: undefined reference to `_Dmodule_ref'
/home/iain/src/gdc/gdb/objdir/test.d:5: undefined reference to `_Dmodule_ref'
test.o:(.data+0x10): undefined reference to `_D3std4math12__ModuleInfoZ'


With demangling:
$ ./ld/ld-new test.o --demangle=dlang 2>&1 | grep -v "__T"

./ld/ld-new: warning: cannot find entry symbol _start; defaulting to
0000000000400120
test.o: In function `main':
/opt/usr/include/d/4.9.0/__entrypoint.di:59: undefined reference to
`_d_run_main'
test.o: In function `D main':
/home/iain/src/gdc/gdb/objdir/test.d:5: undefined reference to
`std.math.tan(real)'
test.o: In function `test._D4test9__modinitFZv':
/home/iain/src/gdc/gdb/objdir/test.d:5: undefined reference to `_Dmodule_ref'
/home/iain/src/gdc/gdb/objdir/test.d:5: undefined reference to `_Dmodule_ref'
test.o:(.data+0x10): undefined reference to `std.math.moduleinfo$'


Anyway, here's the guts of the change.

https://github.com/ibuclaw/gdb/commit/45c505dbc0eecb9fa7842dcbdf46894e450c9cbc


Regards
Iain.


More information about the Digitalmars-d mailing list