This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] Skip STT_FUNC symbols when looking for common definitions
- To: Nick Clifton <nickc at redhat dot com>
- Subject: Re: [PATCH] Skip STT_FUNC symbols when looking for common definitions
- From: Alfredo Ferrari <alfredo dot ferrari at cern dot ch>
- Date: Thu, 8 Feb 2001 09:09:46 +0100 (CET)
- cc: <jakub at redhat dot com>, <binutils at sources dot redhat dot com>, <alfredo dot ferrari at cern dot ch>
- Reply-To: Alfredo Ferrari <Alfredo dot Ferrari at cern dot ch>
Dear Nick, Jakub
I applied the original patch from Jakub to the binutils package as
found in Fisher and it worked nice, at least it solved all the issues
we had up to now here at CERN linking against our standard set of
mathematical libraries. Can I apply Nick's patch to the fisher binutils as
well? If so I'll do this evening (I still have RH7 on my home
machines only, until all problems are fixed we decided it is unsafe for
real production) and let you know if everything is still ok.
Thanks
Alfredo Ferrari
On Wed, 7 Feb 2001, Nick Clifton wrote:
> Hi Jakub,
>
> : If one has a common symbol in the link, none of AIX, DU, Solaris
> : and HP-UX native linkers considers including an archive member
> : containing global symbol with the same name if it is a function
> : (unless there is some other reason why to include that member).
>
> There can be common function symbols ? Ugg.
>
> : This patch makes GNU ld behaviour consistent with it.
> : Ok to commit?
>
> The patch is OK, but I think that it is cleaner to change the
> is_global_symbol_definition function so that it rejects function
> symbols, instead of changing elf_link_is_defined_archive_symbol to
> ignore them. So I have applied this variant of your patch.
>
> Cheers
> Nick
>
>
> 2001-02-07 Jakub Jelinek <jakub@redhat.com>
>
> * elflink.h (is_global_symbol_definition): Rename to
> is_global_data_symbol_definition and have it reject function
> symbols.
> (elf_link_is_defined_archive_symbol): Use renamed function.
>
> Index: bfd/elflink.h
> ===================================================================
> RCS file: /cvs/src//src/bfd/elflink.h,v
> retrieving revision 1.78
> diff -p -r1.78 elflink.h
> *** elflink.h 2001/01/23 11:45:53 1.78
> --- elflink.h 2001/02/07 23:36:17
> *************** elf_bfd_link_add_symbols (abfd, info)
> *** 80,88 ****
> }
> }
>
> ! /* Return true iff this is a non-common definition of a symbol. */
> static boolean
> ! is_global_symbol_definition (abfd, sym)
> bfd * abfd ATTRIBUTE_UNUSED;
> Elf_Internal_Sym * sym;
> {
> --- 80,88 ----
> }
> }
>
> ! /* Return true iff this is a non-common, definition of a non-function symbol. */
> static boolean
> ! is_global_data_symbol_definition (abfd, sym)
> bfd * abfd ATTRIBUTE_UNUSED;
> Elf_Internal_Sym * sym;
> {
> *************** is_global_symbol_definition (abfd, sym)
> *** 91,96 ****
> --- 91,100 ----
> && ELF_ST_BIND (sym->st_info) < STB_LOOS)
> return false;
>
> + /* Function symbols do not count. */
> + if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
> + return false;
> +
> /* If the section is undefined, then so is the symbol. */
> if (sym->st_shndx == SHN_UNDEF)
> return false;
> *************** elf_link_is_defined_archive_symbol (abfd
> *** 201,207 ****
>
> if (strcmp (name, symdef->name) == 0)
> {
> ! result = is_global_symbol_definition (abfd, & sym);
> break;
> }
> }
> --- 205,211 ----
>
> if (strcmp (name, symdef->name) == 0)
> {
> ! result = is_global_data_symbol_definition (abfd, & sym);
> break;
> }
> }
>
--
+----------------------------------------------------------------------------+
| Alfredo Ferrari || Tel.: +41.22.767.6119 |
| CERN-SL || Fax.: +41.22.767.7555 |
| 1211 Geneva 23 || e-mail: Alfredo.Ferrari@cern.ch |
| Switzerland || Alfredo.Ferrari@mi.infn.it |
+----------------------------------------------------------------------------+