This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[patch] PPC small data symbols in shared libraries.
- From: Paul Brook <paul at codesourcery dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 28 Jun 2005 22:37:06 +0100
- Subject: [patch] PPC small data symbols in shared libraries.
I have some third party ppc shared libraries that export the _SDA_BASE_ and
_SDA2_BASE_. The list of offending libraries includes the vxworks libc, so
fixing the libraries isn't really an option.
With old versions of binutils ld unconditionally provided definitions of these
symbols in executables, so this didn't matter.
With newer binutils these symbols are only provided in executables if they
don't already exist. This means the definitions imported from the shared
library get used, and things break.
The attached patch fixes this by ignoring definitions of these symbols
imported from shared libraries.
Tested --enable-targets=all on ppc-linux and ppc-vxworks.
Ok?
Paul
2005-06-28 Paul Brook <paul@codesourcery.com>
* elf32-ppc.c (ppc_elf_add_symbol_hook): Ignore small data section
synbols.
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.163
diff -u -p -r1.163 elf32-ppc.c
--- bfd/elf32-ppc.c 23 May 2005 16:22:25 -0000 1.163
+++ bfd/elf32-ppc.c 28 Jun 2005 20:25:51 -0000
@@ -2617,6 +2729,15 @@ ppc_elf_add_symbol_hook (bfd *abfd,
asection **secp,
bfd_vma *valp)
{
+ /* Ignore small data symbols exported from shared libraries. */
+ if ((abfd->flags & DYNAMIC) != 0
+ && (strcmp (*namep, "_SDA_BASE_") == 0
+ || strcmp (*namep, "_SDA2_BASE_") == 0))
+ {
+ *namep = NULL;
+ return TRUE;
+ }
+
if (sym->st_shndx == SHN_COMMON
&& !info->relocatable
&& sym->st_size <= elf_gp_size (abfd)