Add STB_GNU_UNIQUE support to elflint.
authorUlrich Drepper <drepper@redhat.com>
Tue, 14 Jul 2009 17:42:01 +0000 (10:42 -0700)
committerUlrich Drepper <drepper@redhat.com>
Tue, 14 Jul 2009 17:42:01 +0000 (10:42 -0700)
NEWS
src/ChangeLog
src/elflint.c

diff --git a/NEWS b/NEWS
index 1b73645..5d1a85a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ libelf: Add elf_getshdrnum alias for elf_getshnum and elf_getshdrstrndx alias
 
 libebl: Add support for STB_GNU_UNIQUE.
 
+elflint: Add support for STB_GNU_UNIQUE.
+
 readelf: Add -N option, speeds up DWARF printing without address->name lookups.
 
 Version 0.141:
index 51b3dd8..69f9a65 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-14  Ulrich Drepper  <drepper@redhat.com>
+
+       * elflint.c (check_elf_header): Allow Linux ABI.
+       (check_symtab): Handle STB_GNU_UNIQUE.
+
 2009-07-08  Mark Wielaard  <mjw@redhat.com>
 
        * readelf.c (attr_callback): Handle DW_Form constants for
index c04ae57..9915a54 100644 (file)
@@ -377,8 +377,9 @@ check_elf_header (Ebl *ebl, GElf_Ehdr *ehdr, size_t size)
     ERROR (gettext ("unknown ELF header version number e_ident[%d] == %d\n"),
           EI_VERSION, ehdr->e_ident[EI_VERSION]);
 
-  /* We currently don't handle any OS ABIs.  */
-  if (ehdr->e_ident[EI_OSABI] != ELFOSABI_NONE)
+  /* We currently don't handle any OS ABIs other than Linux.  */
+  if (ehdr->e_ident[EI_OSABI] != ELFOSABI_NONE
+      && ehdr->e_ident[EI_OSABI] != ELFOSABI_LINUX)
     ERROR (gettext ("unsupported OS ABI e_ident[%d] == '%s'\n"),
           EI_OSABI,
           ebl_osabi_name (ebl, ehdr->e_ident[EI_OSABI], buf, sizeof (buf)));
@@ -705,10 +706,17 @@ section [%2d] '%s': symbol %zu: invalid section index\n"),
        ERROR (gettext ("section [%2d] '%s': symbol %zu: unknown type\n"),
               idx, section_name (ebl, idx), cnt);
 
-      if (GELF_ST_BIND (sym->st_info) >= STB_NUM)
+      if (GELF_ST_BIND (sym->st_info) >= STB_NUM
+         && !ebl_symbol_binding_name (ebl, GELF_ST_BIND (sym->st_info), NULL,
+                                      0))
        ERROR (gettext ("\
 section [%2d] '%s': symbol %zu: unknown symbol binding\n"),
               idx, section_name (ebl, idx), cnt);
+      if (GELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE
+         && GELF_ST_TYPE (sym->st_info) != STT_OBJECT)
+       ERROR (gettext ("\
+section [%2d] '%s': symbol %zu: unique symbol not of object type\n"),
+              idx, section_name (ebl, idx), cnt);
 
       if (xndx == SHN_COMMON)
        {