When used through the DMD D2 (2.029) compiler[1] to compile even the simplest program I get the error: /usr/bin/ld: internal error in relocate_sections, at ../../gold/reloc.cc:737 collect2: ld returned 1 exit status Here is the D trivial program: module hello; void main(char[][] args) { } This is the full log: $ dmd hello.d /usr/bin/ld: hello.o: bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(dmain2_190_1a5.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(memory_1cd_620.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object_.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1da_257.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1dc_382.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1de_32e.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1df_65e.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1e0_522.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1e1_66e.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1e2_58c.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1e3_7f4.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1e4_a07.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1e5_6d3.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(e::object(_6a8.o)): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1e7_583.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1e8_71e.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1e9_612.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1ea_597.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1eb_594.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1ec_739.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1ed_5e4.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1ee_3e4.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1ef_647.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1f0_7a9.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1f1_3a8.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1f3_4f4.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1f4_3af.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1f5_20a.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(f::object(_3f2.o)): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1f9_47d.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1fa_95e.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1fb_4af.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__1fc_47e.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__20c_8af.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__20e_c6e.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__210_86d.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__211_c2c.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(console.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(console_23d_2d3.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(string_26e_485.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(string_26f_2fd.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(ti_Ag_29f_444.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(ti_Ag_2a1_42f.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(ti_char_2b1_3ee.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(ti_void_2c4_403.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(gc.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(gcstats.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(gcx.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_10_74d.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_13_8b0.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_14_86e.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(runtime_38_76e.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_45_48b.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_48_5a0.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_49_5fc.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_4a_6f2.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_4b_681.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_4c_595.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(adi_58_20c.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(cast__148_611.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(cast__149_4a0.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(dmain2.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(dmain2_185_3b4.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(dmain2_187_62b.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1a3_482.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1a6_4df.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1ad_4f0.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1b1_497.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1b4_60d.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1b5_478.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1b6_670.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1b7_4cd.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1b8_53b.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(llmath_1c2_2ab.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(memory_1cb_5d0.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__204_69d.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__205_648.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__206_5e4.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(object__207_63c.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(ti_Ag_29d_435.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(ti_Ag_29e_436.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(ti_byte_2ad_3f4.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(ti_ubyte_2bf_3f5.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(ti_uint_2c1_3f8.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(gcbits.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_7_670.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_b_559.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_d_4d4.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_e_619.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(runtime_37_2e4.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_3a_607.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_3b_597.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_3f_469.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_42_897.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_43_826.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_44_258.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_4d_465.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_50_1e8.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(pthread_52_f32.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(pthread_57_1275.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(pthread_58_ef9.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(aaA_b_241.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(aaA_e_236.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(aaA_10_37c.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(aaA_11_3c7.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(aaA_12_2bd.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(stdarg_1d_b3c.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(stdarg_1e_bff.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(stdarg_21_bbd.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(dmain2_17d_5ba.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(dmain2_17e_69d.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(dmain2_18a_4e8.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(dmain2_18c_2f9.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(dmain2_18e_2fd.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1a4_608.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1a5_46d.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1ac_549.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1b0_815.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1b2_763.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(lifetime_1bb_2a1.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(llmath_1c1_300.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(f::object(_7, e.o)): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(ti_C_2ae_3d0.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_3_3f7.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_4_47c.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_5_53c.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_6_5e2.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_8_47c.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(exception_9_676.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_41_713.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_4e_6a3.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(thread_4f_7de.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(pthread_54_1224.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(aaA.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(aaA_a_240.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(stdarg_1a_b6c.o): bad e_ehsize (36 != 52) /usr/bin/ld: /home/luca/tesis/dmd2/linux/bin/../lib/libphobos2.a(stdarg_1b_aeb.o): bad e_ehsize (36 != 52) /usr/bin/ld: internal error in relocate_sections, at ../../gold/reloc.cc:737 collect2: ld returned 1 exit status --- errorlevel 1 [1] http://www.digitalmars.com/d/download.html
I am not familiar with this compiler. How are the object files in question being generated? Are they being generated by the GNU assembler, by some other assembler, or by the compiler directly? The error message is a sanity check on the e_ehsize field of the ELF header. That field is supposed to include the size of the ELF header itself. The value in the file is 36, and gold expects to see 52. 52 bytes is the size of the ELF header on a 32-bit system. 36 bytes is definitely too small. So it seems that there is something wrong with your object files. If you think they are correct, can you attach an object file to this bug report?
Created attachment 3929 [details] Object file example Here is an example object. I'm pretty sure the compiler generates the binary. The source code of the compiler is available (but not free/libre).
Sorry for not getting back to this sooner. Thanks for attaching the object file. 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.
Ok, thanks for taking the time to analyze this. I'll pass this information to the compiler writer. What about the internal error in Gold? Even if it's triggered by a problem in the object file, it's not a bug? If it isn't, wont be better to display a more precise error message? Thank you.
That's true, the internal error should be fixed, if it still happens. I wasn't able to recreate it with the single object file you sent, though.
Ok, I reopen the bug then. The internal error appeared in a big build, I'll try to see if I can reproduce it again and comment the steps to do it.
Seeing the original bug description, I now remember how to reproduce it (it's there =). You just have to download the DMD compiler and try to compile/link the trivial program in the bug description. The compiler is free (as in beer, but source code is available for personal use if you want to take a peek). The direct link to download the DMD 2.029 compiler is: http://ftp.digitalmars.com/dmd.2.029.zip (includes source code, Windows and Linux binaries) The compiler doesn't need installation (at least on Linux), just unpack the zip and run: dmd/linux/bin/dmd hello.d (or dmd/windows/...). This compiles hello.o and then links hello.o and libphobos.a (the D standard library) to build the executable. If you need anything else, please let me know. Thank you.
Thanks for the description. I'm not willing to download source code that is not free as in speech, especially not a compiler and tools that create object files. If you could perhaps put together a tarball of objects files and/or archives that I can use to reproduce the problem, I would appreciate it. Thanks.
You can download the zip and just extract the dmd/linux/lib/libphobos2.a file. I can successfully reproduce the bug doing: ld -o x hello.o libphobos2.a If you don't want to download the zip file at all, I can upload the library somewhere. Note that the library itself (libphobos2.a) is free as in speech (Public Domain/BSD-ish).
I apologize for my caution, but there just aren't any good endgames for me or my employer if somebody gets sticky about my looking at proprietary code. I'm not going to download the whole zip file. Can you attach the library to this bug report, or let me pick it up somewhere? Thanks.
Created attachment 4018 [details] Compressed offending library Attached is the (bzip2) compressed offending library libphobos2.a.
Thanks for attaching the library. Unfortunately, I can't recreate the problem. I get lots of "bad e_ehsize (36 != 52)" errors. However, I don't get the internal error. I'm using the current development sources. It's quite possible that this is a bug which has been fixed since the 2.19 release. If you still have trouble using the current development version of gold, then I will need some more information about how to reproduce the problem.
Ok, using 2.19.51.20090613-1 (Debian "experimental" package) I can still reproduce it, the line in the error message changes, though: /usr/bin/ld: internal error in relocate_sections, at ../../gold/reloc.cc:842 I'll try with the development version when I can...
I do confirm that this bug seems to be fixed in svn trunk as of 20090704. Thank you.