]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Use [pie] rather than [dso] for unnamed modules that are PIEs.
authorRoland McGrath <roland@redhat.com>
Wed, 5 May 2010 03:09:30 +0000 (20:09 -0700)
committerRoland McGrath <roland@redhat.com>
Wed, 5 May 2010 03:09:30 +0000 (20:09 -0700)
libdwfl/ChangeLog
libdwfl/dwfl_segment_report_module.c

index 5067ff7d46931507523fc9e5c47940f74eabc95b..32ff63b29f2942ed805e550214f459f7eb2831b1 100644 (file)
@@ -1,7 +1,9 @@
 2010-05-04  Roland McGrath  <roland@redhat.com>
 
-       * dwfl_segment_report_module.c (dwfl_segment_report_module):
-       Fix jump-start of NDX-finding loop.
+       * dwfl_segment_report_module.c: Use "[pie]" rather than "[dso]" for an
+       ET_DYN that has a DT_DEBUG.
+
+       * dwfl_segment_report_module.c: Fix jump-start of NDX-finding loop.
 
        * segment.c (insert): Fix moving of values following insertion.
        (reify_segments): Fix up MOD->segment backpointer indices after
index c91120bb853354b5d4148ece82ac0b2e434dd853..3f77cfc73f0cb36298e95160cef01b152a787889 100644 (file)
@@ -453,12 +453,14 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
 
   /* Examine its .dynamic section to get more interesting details.
      If it has DT_SONAME, we'll use that as the module name.
+     If it has a DT_DEBUG, then it's actually a PIE rather than a DSO.
      We need its DT_STRTAB and DT_STRSZ to decipher DT_SONAME,
      and they also tell us the essential portion of the file
      for fetching symbols.  */
   GElf_Addr soname_stroff = 0;
   GElf_Addr dynstr_vaddr = 0;
   GElf_Xword dynstrsz = 0;
+  bool execlike = false;
   inline bool consider_dyn (GElf_Sxword tag, GElf_Xword val)
   {
     switch (tag)
@@ -466,6 +468,10 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
       default:
        return false;
 
+      case DT_DEBUG:
+       execlike = true;
+       break;
+
       case DT_SONAME:
        soname_stroff = val;
        break;
@@ -522,7 +528,7 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
 
   /* We'll use the name passed in or a stupid default if not DT_SONAME.  */
   if (name == NULL)
-    name = ehdr.e32.e_type == ET_EXEC ? "[exe]" : "[dso]";
+    name = ehdr.e32.e_type == ET_EXEC ? "[exe]" : execlike ? "[pie]" : "[dso]";
 
   void *soname = NULL;
   size_t soname_size = 0;