www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [Binutils support] Add demangling to libiberty

reply "Iain Buclaw" <ibuclaw ubuntu.com> writes:
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.

For binutils, this would include D demangling support for (via 
the -C or --demangle= switch).

- nm
- addr2line
- objdump
- ld

https://github.com/ibuclaw/gdb/commit/0ba7ac2f91f45b24bcfba2d1ecedb10580fac152

I have named the specified demangle style as 'dlang', if no one 
has objects, I'll go ahead and write it up.

Regards
Iain.
Jan 10 2014
next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
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. T -- Freedom: (n.) Man's self-given right to be enslaved by his own depravity.
Jan 10 2014
prev sibling next sibling parent Iain Buclaw <ibuclaw gdcproject.org> writes:
On 10 January 2014 20:05, H. S. Teoh <hsteoh 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.
Jan 11 2014
prev sibling parent reply Iain Buclaw <ibuclaw gdcproject.org> writes:
On 10 January 2014 20:05, H. S. Teoh <hsteoh 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.

Initial patches have been committed ! https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=log;h=50367cd2ada722ddf5bede594d8ed7631fcde5ab
Jan 18 2014
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 1/18/14 10:34 AM, Iain Buclaw wrote:
 On 10 January 2014 20:05, H. S. Teoh <hsteoh 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.

Initial patches have been committed ! https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=log;h=50367cd2ada722ddf5bede594d8ed7631fcde5ab

This is terrific. Congratulations! Andrei
Jan 19 2014