public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@cygnus.com>
To: law@cygnus.com
Cc: hjl@lucon.org, svivanov@pdmi.ras.ru, egcs@cygnus.com
Subject: Re: Why link C with crtstuff? [patch]
Date: Sun, 26 Apr 1998 12:08:00 -0000	[thread overview]
Message-ID: <199804261903.PAA04748@subrogation.cygnus.com> (raw)
In-Reply-To: <19451.893610286@hurl.cygnus.com>

   Date: Sun, 26 Apr 1998 11:04:46 -0600
   From: Jeffrey A Law <law@cygnus.com>

     In message < m0yTKUE-000598C@ocean.lucon.org >you write:
     > BTW, Jim, I cannot get__ attribute__((weak)) to work on extern.
   I don't think it should work on a function declaration.

   Seems to me you have to have it on the function defintion or
   there's no way for it to actually mark the function in question
   as weak.

There are two kinds of weak symbols: weak defined symbols, which
clearly must be associated with a function definition, and weak
undefined symbols, which clearly can not be associated with a function
definition.

I don't know how to make a weak undefined symbol, except by using
#pragma weak.  Here is an example that will make a weak defined symbol
bar and a weak undefined symbol foo.  The attribute on foo has no
effect.  If you remove the pragma, foo will not be weak.

Ian

extern int foo (int) __attribute__((__weak__));
#pragma weak foo

int bar (int) __attribute__ ((__weak__));

int
bar (int i)
{
  if (foo)
    return foo (i);
  return i;
}

  parent reply	other threads:[~1998-04-26 12:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-25 17:40 Sergei Ivanov
1998-04-26  0:01 ` Jeffrey A Law
1998-04-26  0:19 ` H.J. Lu
1998-04-26 10:05   ` Jeffrey A Law
1998-04-26 10:26     ` H.J. Lu
1998-04-26 12:08     ` Ian Lance Taylor [this message]
1998-04-26 12:45   ` Sergei Ivanov
     [not found] <m0yTYbl-000598C@ocean.lucon.org>
1998-04-26 17:15 ` Sergei Ivanov
1998-04-26 21:56   ` H.J. Lu
1998-04-27 13:59     ` Sergei Ivanov
     [not found] <m0yU6e1-000B93C@svivano.pdmi.ras.ru>
1998-04-28 14:10 ` H.J. Lu
1998-04-28 10:26   ` Ian Lance Taylor
1998-04-28 10:47     ` H.J. Lu

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=199804261903.PAA04748@subrogation.cygnus.com \
    --to=ian@cygnus.com \
    --cc=egcs@cygnus.com \
    --cc=hjl@lucon.org \
    --cc=law@cygnus.com \
    --cc=svivanov@pdmi.ras.ru \
    /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).