2009-04-14 14:05:49 UTC
We had a customer report a ld crash on an x86_64 linux cross compiler
setup targetting mingw32, with some of the input libraries generated by
visual studio, some generated by the GNU tools. They had no issues with
a similar setup on i386 linux.
The crash occurred with binutils-2.18.50 and 2.19.1 here:
bfd_vma sec_vma = s->output_section->vma + s->output_offset;
#0 0x0000000000426ef8 in generate_reloc (abfd=0x618fc0, info=0x60a140) at ../../ld/pe-dll.c:1258
#1 0x000000000042b0c6 in pe_dll_fill_sections (abfd=0x618fc0, info=0x60a140) at ../../ld/pe-dll.c:2887
#2 0x000000000042230a in gld_i386pe_finish () at ei386pe.c:1540
#3 0x000000000041c5e4 in ldemul_finish () at ../../ld/ldemul.c:90
#4 0x0000000000414306 in lang_process () at ../../ld/ldlang.c:6186
#5 0x0000000000417bb1 in main (argc=35, argv=0x7fbfffbf38) at ../../ld/ldmain.c:453
s->output_section is NULL here.
gdb tells us that the bfd in question has the following sections:
This library was generated by Visual Studio 2005 SP1.
As you can see there is an issue, there are two instances of .idata$4
and 5, one with a trailing 0x04, one without. One has output_section as
a valid section, one is NULL.
This patch fixes the crash, though we are still unsure why it crashes
with an x86_64 linux build and works with an i386 linux build.
2009-04-14 Peter O'Gorman <***@thewrittenword.com>
* peXXigen.c: Ensure in->_n._n_name is NULL terminated.