public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H . J . Lu" <hjl@lucon.org>
To: Vassili Karpov <av1474@comtv.ru>
Cc: binutils@sources.redhat.com
Subject: Re: ld bug?
Date: Tue, 30 Oct 2001 23:42:00 -0000	[thread overview]
Message-ID: <20011030234244.A22371@lucon.org> (raw)
In-Reply-To: <20011030233309.A22170@lucon.org>

On Tue, Oct 30, 2001 at 11:33:09PM -0800, H . J . Lu wrote:
> On Tue, Oct 30, 2001 at 11:30:13PM -0800, H . J . Lu wrote:
> > On Tue, Oct 30, 2001 at 01:36:04AM +0300, Vassili Karpov wrote:
> > > LD discards ELF visibility attributes when making relocateable objects.
> > > 
> > > Example:
> > > a.s
> > > ==
> > > .protected symbol
> > > 
> > > b.s
> > > ==
> > > dummy:
> > > ---
> > > as -o a.o a.s
> > > as -o b.o b.s
> > > ld -r -o c.o a.o b.o
> > > 
> > > a.o:     4: 00000000     0 NOTYPE  GLOBAL PROTECTED  UND symbol
> > > c.o:     8: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND symbol
> > > -- 
> > 
> > It is ok since symbol is undefined. There is no such a thing as
> > protected, undefined symbol.
> 
> I take it back. It is a bug. I will fix it.
> 
> 

Here it is.


H.J.
---
2001-10-30  H.J. Lu <hjl@gnu.org>

	* elflink.h (elf_link_output_extsym): Don't clear the visibility
	field for relocateable.

Index: elflink.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elflink.h,v
retrieving revision 1.87
diff -u -p -r1.87 elflink.h
--- elflink.h	2001/10/28 17:38:27	1.87
+++ elflink.h	2001/10/31 07:40:35
@@ -5877,7 +5877,8 @@ elf_link_output_extsym (h, data)
 
   /* If a symbol is not defined locally, we clear the visibility
      field.  */
-  if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+  if (! finfo->info->relocateable
+      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
     sym.st_other ^= ELF_ST_VISIBILITY (sym.st_other);
 
   /* If this symbol should be put in the .dynsym section, then put it

  reply	other threads:[~2001-10-30 23:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-29 14:35 Vassili Karpov
2001-10-30 23:30 ` H . J . Lu
2001-10-30 23:33   ` H . J . Lu
2001-10-30 23:42     ` H . J . Lu [this message]
2001-10-31  6:27       ` Nick Clifton
     [not found]         ` <mailpost.1004538510.13276@postal.sibyte.com>
     [not found]           ` <yov5wv1bpxbb.fsf@broadcom.com>
2001-10-31 10:37             ` PATCH: Add the "ld -r" test for ELF visibility H . J . Lu
2001-10-31 11:12               ` Hans-Peter Nilsson
2001-10-31 12:07                 ` H . J . Lu
2001-10-31 13:20                 ` H . J . Lu
2001-10-31 13:31                   ` Hans-Peter Nilsson
2001-10-31 13:35                     ` cgd
2001-10-31 13:53                     ` H . J . Lu
2001-10-31 15:09                       ` Hans-Peter Nilsson
     [not found] <1060095548.9686.69.camel@brick.watson.ibm.com>
2003-08-06  1:26 ` ld bug? Alan Modra

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=20011030234244.A22371@lucon.org \
    --to=hjl@lucon.org \
    --cc=av1474@comtv.ru \
    --cc=binutils@sources.redhat.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).