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: jakub at redhat dot com
- Subject: Re: [PATCH] Skip STT_FUNC symbols when looking for common definitions
- From: Nick Clifton <nickc at redhat dot com>
- Date: Wed, 7 Feb 2001 15:42:43 -0800
- CC: binutils at sources dot redhat dot com, alfredo dot ferrari at cern dot ch
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;
}
}