delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/06/24/13:53:22

From: ian AT cygnus DOT com (Ian Lance Taylor)
Subject: Re: .init, .fini etc sections -- do these work?
24 Jun 1998 13:53:22 -0700 :
Message-ID: <199806242036.QAA03988.cygnus.cygwin32.developers@subrogation.cygnus.com>
References: <Pine DOT HPP DOT 3 DOT 96 DOT 980624152809 DOT 125B-100000 AT hp2 DOT xraylith DOT wisc DOT edu>
To: khan AT xraylith DOT wisc DOT edu
Cc: sos AT prospect DOT com DOT ru, cygwin32-developers AT cygnus DOT com

   Date: Wed, 24 Jun 1998 15:30:11 -0500 (CDT)
   From: Mumit Khan <khan AT xraylith DOT wisc DOT edu>

   >> Sergey wrote:
   >> 
   >>    If objects contains some sections not defined in linker's script, ld generates invalid executable :-(
   > 
   > This can be fixed for particular sections in ld/scripttempl/pe.sc.  It
   > can be fixed in general in ld/emultempl/pe.em in the function
   > gld_${EMULATION_NAME}_place_orphan.  That function can arrange for the
   > section to be properly aligned, or whatever.
   > 

   But this shouldn't be an issue here since both .init and .fini *are*
   mentioned in the linker script. There is a also the issue of readonly 
   data section I want to turn (.rdata is also in the script).

   Hopefully I'm not missing the point here.

Both .init and .fini wind up in .text in the default linker script, so
the loader won't see them.

   btw, does the .init and .fini sections in PE work the same way as on SVR4?

Not as far as I know.  We could probably make cygwin32 implement this
if we wanted to.  However, I don't think Windows will do it for us.

Windows implements a different mechanism: it calls the DLL entry point
when it is loaded and unloaded.  That entry point can do whatever you
like.

Ian

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019