Subject: Re: ld and microsoft libraries
From: [email-masked] (Ian Lance Taylor)

2 May 1998 05:39:09 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
To: [email-masked]
Cc: [email-masked]

   Date: Fri, 1 May 1998 10:06:41 -0700 (PDT)
   From: Larry Meadows <[email-masked]>

   > I was not aware of that feature of comdat sections.  I thought comdat
   > sections mainly worked to eliminate duplicate sections, which the GNU
   > linker does support.  Does the MS linker really pull specific sections
   > out of an object file based on symbol references?  I don't see any
   > reference to that in the PE documentation, although that doesn't mean
   > it doesn't happen.  That would imply that the MS linker can treat an
   > object file like an archive.

   That is exactly what happens. If you're familiar with VMS, a similar thing
   went (goes?) on there. There's a magic switch to the compilers that puts
   each function into its own text section (and, I suppose, data section
   if that function has static data).

gcc has that option for functions: -ffunction-sections.  I don't know
if there is one for variables.

   Any ideas on implementation?

We have patches to add garbage collection to the linker which have not
been integrated into the main sources (but soon, I hope).  It sounds
like those might help address this problem in a different manner.

   Also, unfortunately, I can't send you the MS libraries. But I could send
   you a .obj that shows the issues.

It would help if you could send me source code, a .obj file, and a
..exe file, which show the Microsoft linker behaviour.  That will let
me look at the source code to see what is happening, and the .exe will
give me something to try to recreate with the GNU linker.

No promises on when this work would get done, of course.

Ian
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".