summaryrefslogtreecommitdiff
path: root/ldso/include/dl-defs.h
diff options
context:
space:
mode:
authorFilippo Arcidiacono <filippo.arcidiacono@st.com>2011-05-06 16:49:28 +0200
committerCarmelo Amoroso <carmelo.amoroso@st.com>2011-05-10 11:53:41 +0200
commit974d3140577ac740c8db2f1ad9635c4ba591361e (patch)
tree0bf1224803cd5d7e87bd03dabdb3694885e49871 /ldso/include/dl-defs.h
parent3e68c52b941636714d2599ea8adda9520ec2de23 (diff)
libdl: fix local symbol's address handling in dladdr
Fix dladdr to correctly handle local function's address so backtrace_symbols print only the function address for these function, instead of showing the name of nearest one. Indeed the dladdr walk through the hash table to find the nearest symbol, that doesn't contain local symbols. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'ldso/include/dl-defs.h')
-rw-r--r--ldso/include/dl-defs.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h
index be0a81da3..88ff81593 100644
--- a/ldso/include/dl-defs.h
+++ b/ldso/include/dl-defs.h
@@ -179,6 +179,14 @@ typedef struct {
#define DL_LOOKUP_ADDRESS(ADDRESS) (ADDRESS)
#endif
+/* On some architectures dladdr can't use st_size of all symbols this way. */
+#define DL_ADDR_SYM_MATCH(SYM_ADDR, SYM, MATCHSYM, ADDR) \
+ ((ADDR) >= (SYM_ADDR) \
+ && ((((SYM)->st_shndx == SHN_UNDEF || (SYM)->st_size == 0) \
+ && (ADDR) == (SYM_ADDR)) \
+ || (ADDR) < (SYM_ADDR) + (SYM)->st_size) \
+ && (!(MATCHSYM) || MATCHSYM < (SYM_ADDR)))
+
/* Use this macro to convert a pointer to a function's entry point to
* a pointer to function. The pointer is assumed to have already been
* relocated. LOADADDR is passed because it may contain additional