This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ld bug?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]