Comment #0 by leandro.lucarella — 2009-05-03T21:12:27Z
When linking any D program using the GNU Gold linker [http://en.wikipedia.org/wiki/Gold_(linker)], I get these errors:
/usr/bin/ld: hello.o: bad e_ehsize (36 != 52)
/usr/bin/ld: /home/luca/tesis/dmd/linux/bin/.. /lib/libphobos.a(dmain2_190_1a5.o): bad e_ehsize (36 != 52)
This is repeated for each .o file in the .a static library.
This might trigger a bug in GNU Gold itself: http://sourceware.org/bugzilla/show_bug.cgi?id=10126
Comment #1 by leandro.lucarella — 2009-05-06T08:47:21Z
BTW, GNU Gold works great with gdc and ldc, so it looks like it's definitely not a frontend problem.
GNU Gold is supposed to replace the old GNU ld linker sooner than later, so I suggest that DMD should be fixed sooner than later too =)
Comment #2 by leandro.lucarella — 2009-06-23T06:03:49Z
This seems to be a DMD error indeed. Here is what the Gold author said:
"""
The object file you attached does indeed have an e_ehsize field with a
value of 36. The e_ehsize field is supposed to hold the size of the ELF file
header. The ELF file header should be 52 bytes long. 36 bytes omits the last 7
fields--although the fields do appear to be actually present. There is
something wrong with the compiler which is generating this object file. My best
guess is that the person who wrote the object file creation code did not realize
that the 16 byte magic number field is included in the size of the file header.
I would be happy to help explain the problem the the authors of this code, if
necessary.
"""
(the object file he is talking about is an object file generated by DMD)