Ask Your Question

Revision history [back]

I found an entry at https://sourceware.org/bugzilla/show_bug.cgi?id=16598 that specifically addresses this problem: Bug 16598 - Microsoft import libraries not correctly handled for x64

It was reported (with a fix) on 17 Feb 2014. An extract from the entry:

.... the bug is pretty serious - the way I first encountered the problem was to use the GNU linker to attempt to link a 64-bit executable using the same import library. When you run the program it will crash because the operand to the jmpq was relocated incorrectly.

The fix turns out to be trivial. In bfd/peicode.h, there is code to create a BFD section from a Microsoft import library stub, and for AMD64 it is using the wrong relocation type when it adds the relocation. Thus this simple conditional addresses the problem.

[* The code snippet does not display properly in this box, so I refer the reader to the Bugzilla posting to see it. *]