summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2010-05-04 20:09:30 -0700
committerRoland McGrath <[email protected]>2010-05-04 20:09:30 -0700
commitb4bb301f76828bcbd84e467b736fedf44fe50317 (patch)
tree23446fa86588121de92df2212bc477dc31a05ad7
parent89bb5d3856ffb27583f96a8f9469d01e32565e3a (diff)
Use [pie] rather than [dso] for unnamed modules that are PIEs.
-rw-r--r--libdwfl/ChangeLog6
-rw-r--r--libdwfl/dwfl_segment_report_module.c8
2 files changed, 11 insertions, 3 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 5067ff7d..32ff63b2 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,7 +1,9 @@
2010-05-04 Roland McGrath <[email protected]>
- * 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
diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index c91120bb..3f77cfc7 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -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;