Like for other FDPIC targets, add defined(__FDPIC__) where needed.
* include/link.h: Include bits/elf-fdpic.h if __FDPIC__ is defined.
(link_map): Use elf32_fdpic_loadaddr if __FDPIC__ is defined.
(dl_phdr_info): Likewise.
* ldso/include/dl-elf.h (__dl_parse_dynamic_info): Support
__FDPIC__.
* ldso/include/dl-hash.h (elf_resolve): Add funcdesc_ht field if
__FDPIC__ is defined.
* ldso/ldso/dl-hash.c (_dl_find_hash): Support __FDPIC__.
* libc/misc/elf/dl-iterate-phdr.c (dl_iterate_phdr): Support __FDPIC__.
Signed-off-by: Mickaël Guêné <mickael.guene(a)st.com>
Signed-off-by: Christophe Lyon <christophe.lyon(a)st.com>
diff --git a/include/link.h b/include/link.h
index 711777b..ef4a016 100644
--- a/include/link.h
+++ b/include/link.h
@@ -79,7 +79,7 @@ extern struct r_debug _r_debug;
*/
extern ElfW(Dyn) _DYNAMIC[];
-#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__)
+#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__) || defined(__FDPIC__)
# include <bits/elf-fdpic.h>
#endif
#ifdef __DSBT__
@@ -97,7 +97,7 @@ struct link_map
/* These first few members are part of the protocol with the debugger.
This is the same format used in SVR4. */
-#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__)
+#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__) || defined(__FDPIC__)
struct elf32_fdpic_loadaddr l_addr;
#else
#ifdef __DSBT__
@@ -184,7 +184,7 @@ enum
struct dl_phdr_info
{
-#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__)
+#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__) || defined(__FDPIC__)
struct elf32_fdpic_loadaddr dlpi_addr;
#else
#ifdef __DSBT__
diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h
index a827b8d..2b99958 100644
--- a/ldso/include/dl-elf.h
+++ b/ldso/include/dl-elf.h
@@ -202,7 +202,7 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long
dynamic_info
/* Don't adjust .dynamic unnecessarily. For FDPIC targets,
we'd have to walk all the loadsegs to find out if it was
actually unnecessary, so skip this optimization. */
-#if !defined __FRV_FDPIC__ && !defined __BFIN_FDPIC__ && !defined
__DSBT__
+#if !defined __FRV_FDPIC__ && !defined __BFIN_FDPIC__ && !defined
__DSBT__ && !defined __FDPIC__
if (load_off != 0)
#endif
{
diff --git a/ldso/include/dl-hash.h b/ldso/include/dl-hash.h
index cb46bec..d1deea9 100644
--- a/ldso/include/dl-hash.h
+++ b/ldso/include/dl-hash.h
@@ -134,7 +134,7 @@ struct elf_resolve {
unsigned long data_words;
#endif
-#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__)
+#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__) || defined(__FDPIC__)
/* Every loaded module holds a hashtable of function descriptors of
functions defined in it, such that it's easy to release the
memory when the module is dlclose()d. */
diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c
index 18b3045..0fede84 100644
--- a/ldso/ldso/dl-hash.c
+++ b/ldso/ldso/dl-hash.c
@@ -377,7 +377,7 @@ char *_dl_find_hash(const char *name, struct r_scope_elem *scope,
struct elf_res
break;
#endif
case STB_GLOBAL:
-#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__)
+#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__) || defined(__FDPIC__)
if (sym_ref)
sym_ref->tpnt = tpnt;
#endif
@@ -386,7 +386,7 @@ char *_dl_find_hash(const char *name, struct r_scope_elem *scope,
struct elf_res
break;
}
}
-#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__)
+#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__) || defined(__FDPIC__)
if (sym_ref)
sym_ref->tpnt = tpnt;
#endif
diff --git a/libc/misc/elf/dl-iterate-phdr.c b/libc/misc/elf/dl-iterate-phdr.c
index 27a9254..e21e88c 100644
--- a/libc/misc/elf/dl-iterate-phdr.c
+++ b/libc/misc/elf/dl-iterate-phdr.c
@@ -58,7 +58,7 @@ dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
/* This entry describes this statically-linked program itself. */
struct dl_phdr_info info;
int ret;
-#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__)
+#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__) || defined(__FDPIC__)
info.dlpi_addr.map = NULL;
info.dlpi_addr.got_value = NULL;
#elif defined(__DSBT__)
--
2.6.3