summaryrefslogtreecommitdiff
path: root/ports/sysdeps/hppa/dl-lookupcfg.h
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2013-12-20 09:29:29 +0100
committerThomas Schwinge <thomas@codesourcery.com>2013-12-20 09:29:29 +0100
commita65dd355fb80a05215e15ae97649de52aec885e3 (patch)
tree81701bb0c6b648630f2bf1729a85d7f5eb49e67b /ports/sysdeps/hppa/dl-lookupcfg.h
parent296a5732f94abe4d5699dc981e4ccfb950b48cee (diff)
parentb4578bab30f72cddd2cf38abfb39f9c8dc892249 (diff)
Merge branch 'baseline' into refs/top-bases/tschwinge/Roger_Whittaker
Diffstat (limited to 'ports/sysdeps/hppa/dl-lookupcfg.h')
-rw-r--r--ports/sysdeps/hppa/dl-lookupcfg.h56
1 files changed, 30 insertions, 26 deletions
diff --git a/ports/sysdeps/hppa/dl-lookupcfg.h b/ports/sysdeps/hppa/dl-lookupcfg.h
index f3125e5ec6..feea320789 100644
--- a/ports/sysdeps/hppa/dl-lookupcfg.h
+++ b/ports/sysdeps/hppa/dl-lookupcfg.h
@@ -38,32 +38,36 @@ void _dl_unmap (struct link_map *map);
#define DL_UNMAP(map) _dl_unmap (map)
-#define DL_AUTO_FUNCTION_ADDRESS(map, addr) \
-({ \
- unsigned int fptr[2]; \
- fptr[0] = (unsigned int) (addr); \
- fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr; \
- /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */ \
- (ElfW(Addr))((unsigned int)fptr | 2); \
-})
-
-#define DL_STATIC_FUNCTION_ADDRESS(map, addr) \
-({ \
- static unsigned int fptr[2]; \
- fptr[0] = (unsigned int) (addr); \
- fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr; \
- /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */ \
- (ElfW(Addr))((unsigned int)fptr | 2); \
-})
-
-
-/* The test for "addr & 2" below is to accommodate old binaries which
- violated the ELF ABI by pointing DT_INIT and DT_FINI at a function
- descriptor. */
-#define DL_DT_INIT_ADDRESS(map, addr) \
- ((Elf32_Addr)(addr) & 2 ? (addr) : DL_AUTO_FUNCTION_ADDRESS (map, addr))
-#define DL_DT_FINI_ADDRESS(map, addr) \
- ((Elf32_Addr)(addr) & 2 ? (addr) : DL_AUTO_FUNCTION_ADDRESS (map, addr))
+#define DL_DT_FUNCTION_ADDRESS(map, start, attr, addr) \
+ attr volatile unsigned int fptr[2]; \
+ /* The test for "start & 2" below is to accommodate old binaries which \
+ violated the ELF ABI by pointing DT_INIT and DT_FINI at a function \
+ descriptor. */ \
+ if ((ElfW(Addr)) (start) & 2) \
+ addr = (ElfW(Addr)) start; \
+ else \
+ { \
+ fptr[0] = (unsigned int) (start); \
+ fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr; \
+ /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */ \
+ addr = (ElfW(Addr))((unsigned int)fptr | 2); \
+ } \
+
+#define DL_CALL_DT_INIT(map, start, argc, argv, env) \
+{ \
+ ElfW(Addr) addr; \
+ DL_DT_FUNCTION_ADDRESS(map, start, , addr) \
+ init_t init = (init_t) addr; \
+ init (argc, argv, env); \
+}
+
+#define DL_CALL_DT_FINI(map, start) \
+{ \
+ ElfW(Addr) addr; \
+ DL_DT_FUNCTION_ADDRESS(map, start, , addr) \
+ fini_t fini = (fini_t) addr; \
+ fini (); \
+}
/* The type of the return value of fixup/profile_fixup */
#define DL_FIXUP_VALUE_TYPE struct fdesc