summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-10-07 06:40:20 +0000
committerMike Frysinger <vapier@gentoo.org>2006-10-07 06:40:20 +0000
commit442bfab4b43daf68984e8bec8989a351a2811fdd (patch)
tree67c305bbe610bf1a710813fa4d07c841590dc399
parentcd5c2f7718e4c53954ed8afe91e455b60c5b35b9 (diff)
fixup from Bernd Schmidt to properly document DL_ADDR_TO_FUNC_PTR
-rw-r--r--ldso/include/dl-defs.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h
index d0c61d44e..18eff43c1 100644
--- a/ldso/include/dl-defs.h
+++ b/ldso/include/dl-defs.h
@@ -140,13 +140,19 @@ typedef struct {
&& (!(TFROM) || (TFROM)->loadaddr < (TPNT)->loadaddr))
#endif
+/* 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
+ * information needed to compute the pointer to function.
+ */
+#ifndef DL_ADDR_TO_FUNC_PTR
+# define DL_ADDR_TO_FUNC_PTR(ADDR, LOADADDR) ((void(*)(void))(ADDR))
+#endif
+
/* On some platforms, computing a pointer to function is more
expensive than calling a function at a given address, so this
alternative is provided. The function signature must be given
within parentheses, as in a type cast. */
-#ifndef DL_ADDR_TO_FUNC_PTR
-# define DL_ADDR_TO_FUNC_PTR(ADDR, LOADADDR) (ADDR)
-#endif
#ifndef DL_CALL_FUNC_AT_ADDR
# define DL_CALL_FUNC_AT_ADDR(ADDR, LOADADDR, SIGNATURE, ...) \
((*SIGNATURE DL_ADDR_TO_FUNC_PTR ((ADDR), (LOADADDR)))(__VA_ARGS__))