]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Kludge for multiple .rodata sections on Solaris introduced by BZ#353802
authorIvo Raisr <ivosh@ivosh.net>
Fri, 8 Apr 2016 20:38:30 +0000 (20:38 +0000)
committerIvo Raisr <ivosh@ivosh.net>
Fri, 8 Apr 2016 20:38:30 +0000 (20:38 +0000)
is no longer needed. The situation with multiple ".rodata" sections existed
only between dozens of builds of Solaris 12.
Fixes BZ#360749

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15853

NEWS
coregrind/m_debuginfo/readelf.c

diff --git a/NEWS b/NEWS
index cffdd87cfae9210bab9c15ac43d0f588f24324a9..b4d7859c401b94796710875d243608a5f36543ab 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -88,6 +88,7 @@ where XXXXXX is the bug number as listed below.
 359871  Incorrect mask handling in ppoll
 360425  arm64 unsupported instruction ldpsw
 360519  none/tests/arm64/memory.vgtest might fail with newer gcc
+360749  kludge for multiple .rodata sections on Solaris no longer needed
 360752  raise the number of reserved fds in m_main.c from 10 to 12
 361354  ppc64[le]: wire up separate socketcalls system calls
 361226  s390x: risbgn (EC59) not implemented
index 38209656bd730fb5ccd613dfc71050616c06c32e..9629e3f8359a3e8c012a6416fc0d3c6d7dc29af0 100644 (file)
@@ -1520,11 +1520,6 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
 
    XArray* /* of RangeAndBias */ svma_ranges = NULL;
 
-#  if defined(VGO_solaris)
-   Word *rodata_sects = NULL;
-   Word rodata_shndx = -1;
-#  endif /* VGO_solaris */
-
    vg_assert(di);
    vg_assert(di->fsm.have_rx_map == True);
    vg_assert(di->fsm.have_rw_map == True);
@@ -1854,81 +1849,6 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
                       reg->svma_base, reg->svma_limit - 1, (UWord)reg->bias );
    }
 
-   /* TOPLEVEL */
-#  if defined(VGO_solaris)
-   /* Quick pre-scan of sections headers. Check if multiple .rodata sections
-      are present. See https://bugs.kde.org/show_bug.cgi?id=353802 */
-   rodata_sects = ML_(dinfo_zalloc)("di.redi_name.1",
-                                    shdr_mnent * sizeof(Word));
-   Word   rodata_nsects = 0;
-   Word   symtab_shndx = -1;
-   DiOffT symtab_sz = DiOffT_INVALID;
-   DiOffT symtab_ioff = DiOffT_INVALID;
-   for (i = 0; i < shdr_mnent; i++) {
-      ElfXX_Shdr a_shdr;
-      ML_(img_get)(&a_shdr, mimg,
-                   INDEX_BIS(shdr_mioff, i, shdr_ment_szB), sizeof(a_shdr));
-      DiOffT name_mioff = shdr_strtab_mioff + a_shdr.sh_name;
-      if (ML_(img_strcmp_c)(mimg, name_mioff, ".rodata") == 0) {
-         rodata_sects[i] = True;
-         rodata_nsects += 1;
-      } else if (ML_(img_strcmp_c)(mimg, name_mioff, ".symtab") == 0) {
-         symtab_shndx = i;
-         symtab_sz = a_shdr.sh_size;
-         symtab_ioff = a_shdr.sh_offset;
-      }
-   }
-
-   if ((rodata_nsects > 1) && (symtab_shndx != -1)) {
-      TRACE_SYMTAB("Multiple (%ld) .rodata sections present.\n", rodata_nsects);
-
-      /* Multiple .rodata sections present. Which one the symbols point to? */
-      for (i = 1; i < (Word) (symtab_sz/sizeof(ElfXX_Sym)); i++) {
-         ElfXX_Sym sym;
-         ML_(img_get)(&sym, mimg,
-                      symtab_ioff + i * sizeof(ElfXX_Sym), sizeof(sym));
-         /* Consider only object symbols with size > 0. */
-         if ((sym.st_size > 0) && (ELFXX_ST_TYPE(sym.st_info) == STT_OBJECT)) {
-            HChar buf[100];   // large enough
-            if (sym.st_shndx >= shdr_mnent) {
-               VG_(snprintf)(buf, sizeof(buf), "Symbol %ld points to a "
-                             "non-existent section %d.\n", i, sym.st_shndx);
-               ML_(symerr)(di, True, buf);
-               goto out;
-            }
-            if (rodata_sects[sym.st_shndx] == True) {
-               if (rodata_shndx == -1)
-                  rodata_shndx = sym.st_shndx;
-
-               if (rodata_shndx != sym.st_shndx) {
-                  VG_(snprintf)(buf, sizeof(buf), "Object symbols point to "
-                                "multiple .rodata sections (%lu and %d). "
-                                "Giving up.\n", rodata_shndx, sym.st_shndx);
-                  ML_(symerr)(di, True, buf);
-                  goto out;
-               }
-            }
-         }
-      }
-   }
-
-   if (rodata_shndx == -1) {
-      if (rodata_nsects >= 1) {
-         for (i = 0; i < shdr_mnent; i++) {
-            if (rodata_sects[i] == True)
-               rodata_shndx = i;
-         }
-      }
-
-      if (rodata_nsects > 1)
-         TRACE_SYMTAB("Symbols do not point to any .rodata section. Section "
-                      "#%ld was chosen.\n", rodata_shndx);
-   } else {
-      TRACE_SYMTAB("Symbols point only to .rodata section #%ld. Good.\n",
-                   rodata_shndx);
-   }
-#  endif /* VGO_solaris */
-
    /* TOPLEVEL */
    /* Iterate over section headers */
    for (i = 0; i < shdr_mnent; i++) {
@@ -2071,11 +1991,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
 
       /* Accept .rodata where mapped as rx (data), even if zero-sized */
       if (0 == VG_(strcmp)(name, ".rodata")) {
-         if (inrx && !di->rodata_present
-#        if defined(VGO_solaris)
-             && i == rodata_shndx
-#        endif
-            ) {
+         if (inrx && !di->rodata_present) {
             di->rodata_present = True;
             di->rodata_svma = svma;
             di->rodata_avma = svma + inrx->bias;
@@ -2092,11 +2008,6 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
                          di->rodata_avma + di->rodata_size - 1);
             TRACE_SYMTAB("acquiring .rodata bias = %#lx\n",
                          (UWord)di->rodata_bias);
-#        if defined(VGO_solaris)
-         } else if (i != rodata_shndx) {
-            /* Skip this section. It is of no use to us.
-               See https://bugs.kde.org/show_bug.cgi?id=353802 */
-#        endif
          } else {
             BAD(".rodata");
          }
@@ -3133,10 +3044,6 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
 
       if (svma_ranges) VG_(deleteXA)(svma_ranges);
 
-#     if defined(VGO_solaris)
-      if (rodata_sects != NULL) ML_(dinfo_free)(rodata_sects);
-#     endif
-
       return res;
    } /* out: */