public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix handling of symbols with non-default visibility in discarded COMDAT group sections
@ 2005-02-23 19:41 Julian Brown
  2005-02-24  0:28 ` Julian Brown
  2005-02-24 10:08 ` Alan Modra
  0 siblings, 2 replies; 3+ messages in thread
From: Julian Brown @ 2005-02-23 19:41 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]

Hi,

This patch fixes a problem with hidden symbols in sections which are 
discarded through being part of a COMDAT group. It does this by forcing 
their visibility to be STV_DEFAULT (AIUI, other values are fairly 
meaningless in this context anyway). This fixes some interoperability 
problems with another compiler.

It prevents the error condition in elflink.c:elf_link_output_extsym from 
triggering ("If a non-weak symbol with non-default visibility is not 
defined locally, it is a fatal error"), and henceforth lets linking work 
correctly -- that is, that error condition seems to be the only thing 
preventing linking working in the first place. Changing the condition to 
allow hidden visibility too definitely seems like the wrong solution though.

References:

   http://sources.redhat.com/ml/binutils/2003-04/msg00055.html
   http://sources.redhat.com/ml/binutils/2004-12/msg00007.html

ChangeLog:

	* bfd/elflink.c (elf_link_add_object_symbols): Force symbols in
	discarded COMDAT group sections to have default visibility.

-- 
Julian Brown
CodeSourcery, LLC

[-- Attachment #2: patch-1 --]
[-- Type: text/plain, Size: 1174 bytes --]

? bfd/.elflink.c.swp
? bfd/doc/bfd.info
? bfd/doc/bfd.info-1
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.134
diff -c -p -r1.134 elflink.c
*** bfd/elflink.c	11 Feb 2005 16:41:09 -0000	1.134
--- bfd/elflink.c	23 Feb 2005 15:45:59 -0000
*************** elf_link_add_object_symbols (bfd *abfd, 
*** 3575,3583 ****
  	    sec = bfd_abs_section_ptr;
  	  else if (sec->kept_section)
  	    {
! 	      /* Symbols from discarded section are undefined.  */
  	      sec = bfd_und_section_ptr;
  	      isym->st_shndx = SHN_UNDEF;
  	    }
  	  else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
  	    value -= sec->vma;
--- 3575,3586 ----
  	    sec = bfd_abs_section_ptr;
  	  else if (sec->kept_section)
  	    {
! 	      /* Symbols from discarded section are undefined, and have
! 	         default visibility.  */
  	      sec = bfd_und_section_ptr;
  	      isym->st_shndx = SHN_UNDEF;
+ 	      isym->st_other = STV_DEFAULT
+ 			       | (isym->st_other & ~ ELF_ST_VISIBILITY(-1));
  	    }
  	  else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
  	    value -= sec->vma;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix handling of symbols with non-default visibility in discarded COMDAT group sections
  2005-02-23 19:41 [PATCH] Fix handling of symbols with non-default visibility in discarded COMDAT group sections Julian Brown
@ 2005-02-24  0:28 ` Julian Brown
  2005-02-24 10:08 ` Alan Modra
  1 sibling, 0 replies; 3+ messages in thread
From: Julian Brown @ 2005-02-24  0:28 UTC (permalink / raw)
  To: binutils

On 2005-02-23, Julian Brown <julian@codesourcery.com> wrote:
> This is a multi-part message in MIME format.
> --------------000602080904060105000704
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Content-Transfer-Encoding: 7bit
>
> Hi,
>
> This patch fixes a problem with hidden symbols in sections which are 
> discarded through being part of a COMDAT group. It does this by forcing 
> their visibility to be STV_DEFAULT (AIUI, other values are fairly 
> meaningless in this context anyway). This fixes some interoperability 
> problems with another compiler.

Forgot to say: tested without regressions with cross to arm-none-eabi,
and with --enable-targets=all on i686 linux.

Julian

-- 
Julian Brown
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix handling of symbols with non-default visibility in discarded COMDAT group sections
  2005-02-23 19:41 [PATCH] Fix handling of symbols with non-default visibility in discarded COMDAT group sections Julian Brown
  2005-02-24  0:28 ` Julian Brown
@ 2005-02-24 10:08 ` Alan Modra
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Modra @ 2005-02-24 10:08 UTC (permalink / raw)
  To: Julian Brown; +Cc: binutils

On Wed, Feb 23, 2005 at 04:11:11PM +0000, Julian Brown wrote:
> 	* bfd/elflink.c (elf_link_add_object_symbols): Force symbols in
> 	discarded COMDAT group sections to have default visibility.

OK.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-02-24  0:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-23 19:41 [PATCH] Fix handling of symbols with non-default visibility in discarded COMDAT group sections Julian Brown
2005-02-24  0:28 ` Julian Brown
2005-02-24 10:08 ` Alan Modra

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).