This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Re: PATCH: PR ld/12975: --gc-sections doesn't remove symbols hidden with version scripts


On Wed, Sep 14, 2011 at 02:32:45PM -0700, H.J. Lu wrote:
> @@ -11907,14 +11909,24 @@ bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf)
>  {
>    struct bfd_link_info *info = (struct bfd_link_info *) inf;
>  
> -  if ((h->root.type == bfd_link_hash_defined
> -       || h->root.type == bfd_link_hash_defweak)
> -      && (h->ref_dynamic
> -	  || (!info->executable
> -	      && h->def_regular
> -	      && ELF_ST_VISIBILITY (h->other) != STV_INTERNAL
> -	      && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN)))
> -    h->root.u.def.section->flags |= SEC_KEEP;
> +  if (h->root.type == bfd_link_hash_defined
> +      || h->root.type == bfd_link_hash_defweak)
> +    {
> +      if (h->ref_dynamic)
> +	h->root.u.def.section->flags |= SEC_KEEP;
> +      else if (!info->executable
> +	       && h->def_regular
> +	       && ELF_ST_VISIBILITY (h->other) != STV_INTERNAL
> +	       && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN)
> +	{
> +	  bfd_boolean hide;
> +	  if (info->version_info == NULL
> +	      || (bfd_find_version_for_sym (info->version_info,
> +					    h->root.root.string, &hide)
> +		  && !hide))

Is this correct?  Seems to me this should be
	  if (info->version_info == NULL
	      || !bfd_find_version_for_sym (info->version_info,
					    h->root.root.string, &hide)
	      || !hide)

> +	    h->root.u.def.section->flags |= SEC_KEEP;
> +	}
> +    }
>  
>    return TRUE;
>  }

-- 
Alan Modra
Australia Development Lab, IBM


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