public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Øyvind Harboe" <oyvind.harboe@zylin.com>
To: Dave Korn <dave.korn@artimi.com>
Cc: binutils@sources.redhat.com
Subject: RE: Referenced symbol not present in final image?
Date: Fri, 08 Apr 2005 12:31:00 -0000	[thread overview]
Message-ID: <1112963445.23080.40.camel@localhost.localdomain> (raw)
In-Reply-To: <SERRANO5y4FypKsEgJX000000bb@SERRANO.CAM.ARTIMI.COM>

>   Umm, look, if you really want to know what kind of symbol it is, don't you
> just want to be using "nm" or "objdump --syms" on eh_alloc.o (or libsupc++),
> and it'll probably tell you something interesting like it's weak, or common,
> or somesuch ?
>
>   If it's referenced, but doesn't get pulled into the link unless you -U it
> on the linker command line, that suggests that the object that contains it
> is too early in the link order and the objects that reference it are too
> late in the link order, so by the time the linker knows it's needed, it's
> already gone by and be discarded.

The symbol in question is weak, which explains the "strange" behaviour. 

Thanks for the tip(s)!

--- a reply I got in mail directly -----


If you define a symbol as weak and do not provide a definition for the
same (as in the example below) then the linker would allow the symbol
to be undefined but still referenced in the binary.

<snip>

#include<stdio.h>

void foo() __attribute__ ((weak));

int main()
{
  int c;
  
  if(!c)
    foo();
  
  return 0;
}

</snip>

--- a reply I got in mail directly -----

-- 
Øyvind Harboe
http://www.zylin.com

  reply	other threads:[~2005-04-08 12:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-08 11:14 Øyvind Harboe
2005-04-08 12:17 ` Dave Korn
2005-04-08 12:31   ` Øyvind Harboe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-04-08 10:30 Øyvind Harboe
2005-04-08 12:23 ` Ravi Ramaseshan

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=1112963445.23080.40.camel@localhost.localdomain \
    --to=oyvind.harboe@zylin.com \
    --cc=binutils@sources.redhat.com \
    --cc=dave.korn@artimi.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).