[RFC,v5,4/6] Handle DT_GNU_FLAGS_1 in readelf

Message ID 4ec7f3fa36e7f3c0809d2c8d54d868234d40ae13.1594396647.git.vivek@collabora.com
State New
Headers show
Series
  • binutils patches for DT_GNU_FLAGS_1/DF_GNU_1_UNIQUE
Related show

Commit Message

Alan Modra via Binutils July 10, 2020, 4:01 p.m.
---
 binutils/ChangeLog |  5 +++++
 binutils/readelf.c | 23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+)

-- 
2.11.0

Patch

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index df8b90e095..db7e87c357 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@ 
+2020-07-10  Vivek Das Mohapatra  <vivek@collabora.com>
+
+	* readelf.c (get_dynamic_type): Handle DT_GNU_FLAGS_1.
+	(process_dynamic_section): Likewise.
+
 2020-07-10  Tom de Vries  <tdevries@suse.de>
 
 	* dwarf.c (display_debug_lines_decoded): Don't emit meaningless
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 0feeed9831..1c26de5726 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -2229,6 +2229,7 @@  get_dynamic_type (Filedata * filedata, unsigned long type)
     case DT_GNU_LIBLIST: return "GNU_LIBLIST";
     case DT_GNU_LIBLISTSZ: return "GNU_LIBLISTSZ";
     case DT_GNU_HASH:	return "GNU_HASH";
+    case DT_GNU_FLAGS_1: return "GNU_FLAGS_1";
 
     default:
       if ((type >= DT_LOPROC) && (type <= DT_HIPROC))
@@ -10941,6 +10942,28 @@  the .dynstr section doesn't match the DT_STRTAB and DT_STRSZ tags\n"));
 	    }
 	  break;
 
+        case DT_GNU_FLAGS_1:
+	  if (do_dynamic)
+	    {
+	      printf (_("Flags:"));
+	      if (entry->d_un.d_val == 0)
+		printf (_(" None\n"));
+	      else
+		{
+		  unsigned long int val = entry->d_un.d_val;
+
+		  if (val & DF_GNU_1_UNIQUE)
+		    {
+		      printf (" UNIQUE");
+		      val ^= DF_GNU_1_UNIQUE;
+		    }
+		  if (val != 0)
+		    printf (" %lx", val);
+		  puts ("");
+		}
+	    }
+          break;
+
 	default:
 	  if ((entry->d_tag >= DT_VERSYM) && (entry->d_tag <= DT_VERNEEDNUM))
 	    filedata->version_info[DT_VERSIONTAGIDX (entry->d_tag)]