[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] bfd coff back-end

From: Aurelien Chanudet
Subject: [Gcl-devel] bfd coff back-end
Date: Sun, 11 Jan 2004 15:57:39 +0100

Hi Mike,

Sorry for the delay getting back to you, I'm fairly busy at the moment. I thought I would be more helpful in looking at the matter myself, so I installed mingw, compiled binutils 2.14 and ran a sample program to test dynamic loading. While there is probably more to it than what I relate below, here is a first issue :

Basically, there are two files of interest. The first one is coffcode.h and the second one is coff-i386.c. BFD relocation entries (of type arelent) have an address field, which is not an absolute address, but a section relative offset. As can be seen, this convention is enforced at coff-i386.c:144. However, this convention is violated at coffcode.h:5037. Running objdump -r on a sample object file reveals that COFF relocation entries have an r_vaddr field which looks like a section relative offset. Apparently, this section relative offset is being considered as an absolute address in coffcode.h, which is why we later get a segmentation violation. In coffcode.h, cache_ptr->address is set at line 5002, and then incorrectly adjusted at line 5037. The fix might be to zero out the section's vma (asect->vma) prior to calling bfd_get_relocated_section_contents in bfdtest.c, but I'm not 100% sure of that. I'll continue investigating this when I have time.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]