From: Roland McGrath Date: Wed, 5 May 2010 03:09:30 +0000 (-0700) Subject: Use [pie] rather than [dso] for unnamed modules that are PIEs. X-Git-Tag: elfutils-0.148~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b4bb301f76828bcbd84e467b736fedf44fe50317;p=thirdparty%2Felfutils.git Use [pie] rather than [dso] for unnamed modules that are PIEs. --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 5067ff7d4..32ff63b29 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,7 +1,9 @@ 2010-05-04 Roland McGrath - * 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 c91120bb8..3f77cfc73 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;