[PATCH] D11724: COFF: Add test for ld/section created import library

Martell Malone martellmalone at gmail.com
Mon Aug 3 22:36:13 PDT 2015


>From my reading on how gnuld handles PE/COFF
It uses a linker script that describes how it lays out its idata section.
>From i386pe.x

  .idata BLOCK(__section_alignment__) :
  {
    /* This cannot currently be handled with grouped sections.
	See pe.em:sort_sections.  */
    SORT(*)(.idata$2)
    SORT(*)(.idata$3)
    /* These zeroes mark the end of the import list.  */
    LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
    SORT(*)(.idata$4)
    SORT(*)(.idata$5)
    SORT(*)(.idata$6)
    SORT(*)(.idata$7)
  }

Under ld/emultempl/pep.em in binutils it describes how it converts the
MS import library to its format.
see here http://github.com/bminor/binutils-gdb/blob/master/ld/emultempl/pep.em#L1625
>From the code in this function and the rest of pep.em we can see how
it handles it.
I'm sure this will make more sense to you however as you know what the
MS format is.

I assume the conversion will have to go the other way for us
I think the most notable thing is the use of idata7 instead of idata6
for the dll name
We could use that as a check?
Then hijack it pulling out the function names once we see this being
used and insert it into the sections like a MS generated one

You might have a much cleaner solution however. :)

If this isn't enough insight into what you need I can do more digging.
Just ping me and let me know


On Tue, Aug 4, 2015 at 3:15 AM, Rui Ueyama <ruiu at google.com> wrote:

> ruiu added a comment.
>
> Do you know anything about how GNU ld handles these import libraries? My
> linker is able to read it and construct .idata section, but the resulting
> .idata section is not going to be in correct format. If GNU linker is able
> to generate a correct .idata section from this type of import libraries,
> there must be something I'm missing in my linker.
>
>
> http://reviews.llvm.org/D11724
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150804/a6c8ae8f/attachment.html>


More information about the llvm-commits mailing list