]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PowerPC64 st_other decoding in readelf
authorAlan Modra <amodra@gmail.com>
Thu, 23 Aug 2018 08:04:13 +0000 (17:34 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 23 Aug 2018 14:53:27 +0000 (00:23 +0930)
localentry:1 is a valid encoding, so display it.  The patch also bails
out of get_ppc64_symbol_other when st_other bits besides the three
used for localentry offsets are set, to avoid hiding any such values.

* readelf.c (get_ppc64_symbol_other): Return NULL if st_other
field contains unrecognised or reserved values.  Handle
localentry:1 value.

binutils/ChangeLog
binutils/readelf.c

index 600f326769c7df12b8a69db1f5295695a2626554..673bd904dc801d339a11bc6382f776ffe1598481 100644 (file)
@@ -1,3 +1,9 @@
+2018-08-23  Alan Modra  <amodra@gmail.com>
+
+       * readelf.c (get_ppc64_symbol_other): Return NULL if st_other
+       field contains unrecognised or reserved values.  Handle
+       localentry:1 value.
+
 2018-08-23  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/23536
index a936ff375876408d70005ea6fb69060895bd8120..2d9d48d002b0a43785125e9ff61bbc450f839f9e 100644 (file)
@@ -11088,11 +11088,16 @@ get_ia64_symbol_other (Filedata * filedata, unsigned int other)
 static const char *
 get_ppc64_symbol_other (unsigned int other)
 {
-  if (PPC64_LOCAL_ENTRY_OFFSET (other) != 0)
+  if ((other & ~STO_PPC64_LOCAL_MASK) != 0)
+    return NULL;
+
+  other >>= STO_PPC64_LOCAL_BIT;
+  if (other <= 6)
     {
       static char buf[32];
-      snprintf (buf, sizeof buf, _("<localentry>: %d"),
-               PPC64_LOCAL_ENTRY_OFFSET (other));
+      if (other >= 2)
+       other = ppc64_decode_local_entry (other);
+      snprintf (buf, sizeof buf, _("<localentry>: %d"), other);
       return buf;
     }
   return NULL;