]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* elflink.c (_bfd_elf_merge_symbol): Allow type changes for
authorAlan Modra <amodra@gmail.com>
Tue, 21 Jun 2011 14:55:46 +0000 (14:55 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 21 Jun 2011 14:55:46 +0000 (14:55 +0000)
plugin symbols.  Fix segfault on linker scrip defined syms.

bfd/ChangeLog
bfd/elflink.c

index 2cb0a7fa61befcf8a246be8f2fc9d4710c867e23..f75c78d10094174f8d1e55718fab106be3287283 100644 (file)
@@ -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
index 891ce5d7df4411f3a3e3dc90919e190b90fc21b9..9e69ec6b72f047c3a09ec31601d4ec7545b0b19f 100644 (file)
@@ -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;