public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@cygnus.com>
To: hjl@nynexst.com
Cc: gas2@cygnus.com
Subject: Re: A weak symbol bug in gas-950819
Date: Mon, 21 Aug 1995 08:14:00 -0000	[thread overview]
Message-ID: <199508211514.LAA17943@sanguine.cygnus.com> (raw)
In-Reply-To: <m0skM0o-00011FC@didi.nynexst.com>

   From: hjl@nynexst.com (H.J. Lu)
   Date: Sun, 20 Aug 1995 21:50:49 -0400 (EDT)

   There is a weak symbol bug in gas-950819. The old snapshots failed to
   pick up the real definition under certain circumstances. gas-950819
   failed to set the weak symbol to zero.

I'm not sure what you mean when you say that it failed to set the weak
symbol to zero.

I do see from your test case that the linker has a bug in the way it
handles an undefined weak reference followed by a weak reference.
I've checked in the appended patch, which should fix the problem.

   BTW, what an ELF linker should do with the symbol "xxx" in

   ld .... -lfoo -lbar

   where a real "xxx" is defined in libfoo.a, a weak one is defined in
   libbar.a and "xxx" is referenced in libbar.a only?

The linker processes libraries sequentially.  Assuming that there is
no mention of "xxx" before libfoo.a, and assuming that the definition
of "xxx" is not brought in from libfoo.a for some other reason,
libfoo.a is irrelevant to this case.

Ian

Index: linker.c
===================================================================
RCS file: /rel/cvsfiles/devo/bfd/linker.c,v
retrieving revision 1.58
diff -p -r1.58 linker.c
*** linker.c	1995/07/13 18:14:17	1.58
--- linker.c	1995/08/21 15:09:20
*************** enum link_action
*** 1321,1327 ****
  static const enum link_action link_action[8][8] =
  {
    /* current\prev    new    undef  undefw def    defw   com    indr   warn  */
!   /* UNDEF_ROW 	*/  {UND,   NOACT, NOACT, REF,   REF,   NOACT, REFC,  WARNC },
    /* UNDEFW_ROW	*/  {WEAK,  NOACT, NOACT, REF,   REF,   NOACT, REFC,  WARNC },
    /* DEF_ROW 	*/  {DEF,   DEF,   DEF,   MDEF,  DEF,   CDEF,  MDEF,  CYCLE },
    /* DEFW_ROW 	*/  {DEFW,  DEFW,  DEFW,  NOACT, NOACT, NOACT, NOACT, CYCLE },
--- 1321,1327 ----
  static const enum link_action link_action[8][8] =
  {
    /* current\prev    new    undef  undefw def    defw   com    indr   warn  */
!   /* UNDEF_ROW 	*/  {UND,   NOACT, UND,   REF,   REF,   NOACT, REFC,  WARNC },
    /* UNDEFW_ROW	*/  {WEAK,  NOACT, NOACT, REF,   REF,   NOACT, REFC,  WARNC },
    /* DEF_ROW 	*/  {DEF,   DEF,   DEF,   MDEF,  DEF,   CDEF,  MDEF,  CYCLE },
    /* DEFW_ROW 	*/  {DEFW,  DEFW,  DEFW,  NOACT, NOACT, NOACT, NOACT, CYCLE },
Index: elflink.h
===================================================================
RCS file: /rel/cvsfiles/devo/bfd/elflink.h,v
retrieving revision 1.9
diff -p -r1.9 elflink.h
*** elflink.h	1995/08/14 15:57:17	1.9
--- elflink.h	1995/08/21 15:09:22
*************** elf_link_add_archive_symbols (abfd, info
*** 155,161 ****
  	    continue;
  	  if (h->root.type != bfd_link_hash_undefined)
  	    {
! 	      defined[i] = true;
  	      continue;
  	    }
  
--- 155,162 ----
  	    continue;
  	  if (h->root.type != bfd_link_hash_undefined)
  	    {
! 	      if (h->root.type != bfd_link_hash_undefweak)
! 		defined[i] = true;
  	      continue;
  	    }
  


      reply	other threads:[~1995-08-21  8:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-08-20 18:51 H.J. Lu
1995-08-21  8:14 ` Ian Lance Taylor [this message]

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=199508211514.LAA17943@sanguine.cygnus.com \
    --to=ian@cygnus.com \
    --cc=gas2@cygnus.com \
    --cc=hjl@nynexst.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).