public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@zembu.com>
To: mark@codesourcery.com
Cc: binutils@sourceware.cygnus.com
Subject: Re: GNU ld and -init/-fini
Date: Thu, 01 Jul 1999 00:00:00 -0000	[thread overview]
Message-ID: <19990622182003.600.qmail@daffy.airs.com> (raw)
In-Reply-To: <19990621160957T.mitchell@codesourcery.com>

   From: mark@codesourcery.com
   Date: Mon, 21 Jun 1999 16:09:57 -0700

   The IRIX 6 linker provdides -init and -fini switches.  These switches
   set DT_INIT and DT_FINI flags in the dynamic table, which cause the
   named functions to be executed at initialization/finalization time.
   GCC uses these to call global constructors when a shared library is
   loaded.

   There do not seem to be equivalent GNU ld switches.  What is the
   method used on Linux, etc. in order to make the same sort of thing
   happen?

As Richard said, the GNU linker recognizes _init and _fini specially.
It sets DT_INIT to the value of the _init symbol, and sets DT_FINI to
the value of the _fini symbol.  This convention was taken from SVR4,
and indeed it is required in order to work on SVR4 and Solaris.

I think it would be appropriate to add -init and -fini options to work
for any ELF target, and permit them to override the default of _init
and _fini.

Ian

  reply	other threads:[~1999-07-01  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-01  0:00 mark
1999-07-01  0:00 ` Ian Lance Taylor [this message]
1999-07-01  0:00   ` mark
1999-07-01  0:00 ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19990622182003.600.qmail@daffy.airs.com \
    --to=ian@zembu.com \
    --cc=binutils@sourceware.cygnus.com \
    --cc=mark@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).