summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2011-06-21 14:55:45 +0000
committerAlan Modra <amodra@bigpond.net.au>2011-06-21 14:55:45 +0000
commit5bb637c646f477621074307ba1e9b990003974cb (patch)
tree83da8638225edbd9ff2a688cba315c89f98030c8
parent9b7a65b354abf79da3c90e05cb71cfd1e00b9228 (diff)
downloadbinutils-redhat-5bb637c646f477621074307ba1e9b990003974cb.tar.gz
* elflink.c (_bfd_elf_merge_symbol): Allow type changes for
plugin symbols. Fix segfault on linker scrip defined syms.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.c15
2 files changed, 15 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2cb0a7fa61..f75c78d100 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2011-06-22 Alan Modra <amodra@gmail.com>
+
+ * elflink.c (_bfd_elf_merge_symbol): Allow type changes for
+ plugin symbols. Fix segfault on linker scrip defined syms.
+
2011-05-29 Alan Modra <amodra@gmail.com>
Apply from mainline
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 891ce5d7df..9e69ec6b72 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -1,6 +1,6 @@
/* ELF linking support for BFD.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009, 2010
+ 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -1085,11 +1085,15 @@ _bfd_elf_merge_symbol (bfd *abfd,
return TRUE;
}
+ /* Plugin symbol type isn't currently set. Stop bogus errors. */
+ if (oldbfd != NULL && (oldbfd->flags & BFD_PLUGIN) != 0)
+ *type_change_ok = TRUE;
+
/* Check TLS symbol. We don't check undefined symbol introduced by
"ld -u". */
- if ((ELF_ST_TYPE (sym->st_info) == STT_TLS || h->type == STT_TLS)
- && ELF_ST_TYPE (sym->st_info) != h->type
- && oldbfd != NULL)
+ else if (oldbfd != NULL
+ && ELF_ST_TYPE (sym->st_info) != h->type
+ && (ELF_ST_TYPE (sym->st_info) == STT_TLS || h->type == STT_TLS))
{
bfd *ntbfd, *tbfd;
bfd_boolean ntdef, tdef;
@@ -1428,7 +1432,8 @@ _bfd_elf_merge_symbol (bfd *abfd,
if (newdef && olddef && newweak)
{
/* Don't skip new non-IR weak syms. */
- if (!((oldbfd->flags & BFD_PLUGIN) != 0
+ if (!(oldbfd != NULL
+ && (oldbfd->flags & BFD_PLUGIN) != 0
&& (abfd->flags & BFD_PLUGIN) == 0))
*skip = TRUE;