This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: linker problem with WinCE exe's


   Date: Fri, 04 Jun 1999 21:43:19 +0200
   From: wisi <richard.wisenoecker@gmx.at>

   Actually I have an error in the linker with the "import information"
   section of WinCE exe files.
   This stuff is in the .idata section. This section has subsections as
   .idata$2, .idata$3,...,idata$6. The interesting thing is that symbols
   are reallocated correctly.
   I have just an error when the address of the start of .idata$4 is needed

   (In detail: the error occurs at the .idata section offset 0x0 where the

   address of the beginning of .idata$4 should be and at offset 0x10 where
   the address of .idata$5 should be).
   After reallocation I always found the start address of .idata.
   In the function bfd_perform_relocation (in reloc.c) the variables
   symbol->value and  symbol->section->output_offset are always 0.

   It seems to me, that one of these two values (value or output_offset)
   should hold the offset of the subsection inside the section.
   The problem I have is, that I didn't found the function which is
   responsible for this (I spent already some hours with debugging and
   analyzing the code).

I have no idea what the actual problem is here.  However, I can tell
you how this stuff is supposed to work.

You call .idata$2, etc., subsections, but BFD does not have that
concept.  I would describe .idata$2, etc., as input sections which are
(I believe) placed into an output section named .idata.

There is an input BFD and an output BFD.  Similarly, there is an input
section and an output section.

In bfd_perform_relocation, the following should be true:

symbol->value is the offset of the symbol within the input section.

symbol->section->output_section->vma is the VMA of the output section
symbol->in the output BFD.

symbol->section->output_offset is the offset of the input section
symbol->within the output section.

The linker map file generated by the -M option should show you how and
where the linker puts input sections into output sections.

As a side note, I don't think the i386 PE support should be going
through bfd_perform_relocation.  I believe it should be using
_bfd_coff_generic_relocate_section instead.  See bfd/doc/bfdint.texi
for a partial description of linker relocation handling.

Ian

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]