From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11113 invoked by alias); 20 May 2003 00:38:10 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 11100 invoked from network); 20 May 2003 00:38:10 -0000 Received: from unknown (HELO rwcrmhc51.attbi.com) (204.127.198.38) by sources.redhat.com with SMTP; 20 May 2003 00:38:10 -0000 Received: from lucon.org (12-234-88-5.client.attbi.com[12.234.88.5]) by attbi.com (rwcrmhc51) with ESMTP id <20030520003809051007fet6e>; Tue, 20 May 2003 00:38:09 +0000 Received: by lucon.org (Postfix, from userid 1000) id 199252C683; Mon, 19 May 2003 17:38:02 -0700 (PDT) Date: Tue, 20 May 2003 00:38:00 -0000 From: "H. J. Lu" To: Jakub Jelinek Cc: binutils@sources.redhat.com, amodra@bigpond.net.au Subject: Re: PATCH: Fix ELF visibility handling Message-ID: <20030519173801.A25707@lucon.org> References: <20030401121958.A6545@lucon.org> <20030409092252.A6924@lucon.org> <20030519221919.GC16629@sunsite.ms.mff.cuni.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030519221919.GC16629@sunsite.ms.mff.cuni.cz>; from jakub@redhat.com on Tue, May 20, 2003 at 12:19:19AM +0200 X-SW-Source: 2003-05/txt/msg00552.txt.bz2 On Tue, May 20, 2003 at 12:19:19AM +0200, Jakub Jelinek wrote: > On Wed, Apr 09, 2003 at 09:22:52AM -0700, H. J. Lu wrote: > > 2003-04-01 H.J. Lu > > > > (elf_link_output_extsym): Warn if a forced local symbol is > > referenced from dynamic objects. Make non-weak undefined symbol > > with non-default visibility a fatal error. > > This change broke static linking with hidden common symbols > (testcase included in the patch below). I don't think it works with dynamic linking either. I found another bug. I will post a testcase and a patch later. > Any reason why you use h->root.type != bfd_link_hash_undefweak > which can well be a normal bfd_link_hash_defined symbol? I have an old patch to fix a related problem: http://sources.redhat.com/ml/binutils/2003-03/msg00080.html in a different way. Then I changed it and forgot to update another patch. That is what happened when you had so many patches on top of each other. > > 2003-05-20 Jakub Jelinek > > * elflink.h (elf_link_output_extsym): Only issue error about != > STV_DEFAULT symbols if they are bfd_link_hash_undefined. > > * ld-elfvsb/sh3.c: New test. > * ld-elfvsb/elfvsb.exp: Add sh3. > > --- bfd/elflink.h.jj 2003-05-19 17:12:39.000000000 -0400 > +++ bfd/elflink.h 2003-05-19 17:43:12.000000000 -0400 > @@ -4622,7 +4622,7 @@ elf_link_output_extsym (h, data) > if (! finfo->info->relocateable > && ELF_ST_VISIBILITY (sym.st_other) != STV_DEFAULT > && ELF_ST_BIND (sym.st_info) != STB_WEAK > - && h->root.type != bfd_link_hash_undefweak > + && h->root.type == bfd_link_hash_undefined > && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) > { > (*_bfd_error_handler) > --- ld/testsuite/ld-elfvsb/sh3.c.jj 2003-05-19 17:51:14.000000000 -0400 > +++ ld/testsuite/ld-elfvsb/sh3.c 2003-05-19 17:51:08.000000000 -0400 > @@ -0,0 +1,7 @@ > +int foo; > +asm (".hidden foo"); > + > +int main (void) > +{ > + return foo; > +} > --- ld/testsuite/ld-elfvsb/elfvsb.exp.jj 2003-05-19 17:12:47.000000000 -0400 > +++ ld/testsuite/ld-elfvsb/elfvsb.exp 2003-05-19 18:08:22.000000000 -0400 > @@ -412,6 +412,16 @@ visibility_run protected_undef_def > visibility_run protected_weak > visibility_run normal > > +if { ![ld_compile "$CC -g $CFLAGS $SHCFLAG" $srcdir/$subdir/sh3.c $tmpdir/sh3.o] } { > + unresolved "static visibility" > +} else { > + if ![ld_simple_link $CC $tmpdir/sh3 "-static $tmpdir/sh3.o"] { > + fail "static visibility" > + } else { > + pass "static visibility" > + } > +} > + > if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } { > # Remove the temporary directory. > catch "exec rm -rf $tmpdir" exec_status > > > Jakub