From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8217 invoked by alias); 19 May 2003 22:19:33 -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 8138 invoked from network); 19 May 2003 22:19:29 -0000 Received: from unknown (HELO localhost.localdomain) (195.113.19.66) by sources.redhat.com with SMTP; 19 May 2003 22:19:29 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h4JMJKqO019033; Tue, 20 May 2003 00:19:20 +0200 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id h4JMJJ3o019029; Tue, 20 May 2003 00:19:19 +0200 Date: Mon, 19 May 2003 22:19:00 -0000 From: Jakub Jelinek To: "H. J. Lu" Cc: binutils@sources.redhat.com, amodra@bigpond.net.au Subject: Re: PATCH: Fix ELF visibility handling Message-ID: <20030519221919.GC16629@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek References: <20030401121958.A6545@lucon.org> <20030409092252.A6924@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030409092252.A6924@lucon.org> User-Agent: Mutt/1.4i X-SW-Source: 2003-05/txt/msg00545.txt.bz2 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). Any reason why you use h->root.type != bfd_link_hash_undefweak which can well be a normal bfd_link_hash_defined symbol? 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