summaryrefslogtreecommitdiff
path: root/ldso/ldso/dl-hash.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-10-15 16:15:59 -0400
committerMike Frysinger <vapier@gentoo.org>2009-10-15 17:09:23 -0400
commit1f5e333a158f4398437287b8b64260371422194f (patch)
tree93d3ccf85cd0e03d9d534a615af1646123e433ec /ldso/ldso/dl-hash.c
parent21cec43543081b47f9f7d5860af44d04c92746cd (diff)
ldso: clean up breakage in tls merge
The TLS merge 534661b91c9849 introduced multiple style problems as well as random breakage: - missing _dl_free - incomplete parametrization of _dl_lookup_hash - restore FDPIC handling in _dl_lookup_hash Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'ldso/ldso/dl-hash.c')
-rw-r--r--ldso/ldso/dl-hash.c69
1 files changed, 37 insertions, 32 deletions
diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c
index 3103d9f0b..1ac5b948d 100644
--- a/ldso/ldso/dl-hash.c
+++ b/ldso/ldso/dl-hash.c
@@ -159,27 +159,27 @@ check_match (const ElfW(Sym) *sym, char *strtab, const char* undef_name, int typ
{
#if USE_TLS
- if((sym->st_value == 0 && (ELF_ST_TYPE(sym->st_info) != STT_TLS))
- || (type_class & (sym->st_shndx == SHN_UNDEF)))
- /* No value or undefined symbol itself */
- return NULL;
-
- if(ELF_ST_TYPE(sym->st_info) > STT_FUNC
- && ELF_ST_TYPE(sym->st_info) != STT_COMMON
- && ELF_ST_TYPE(sym->st_info) != STT_TLS)
- /* Ignore all but STT_NOTYPE, STT_OBJECT, STT_FUNC and STT_COMMON
- * entries (and STT_TLS if TLS is supported) since these
- * are no code/data definitions.
- */
- return NULL;
-#else
- if (type_class & (sym->st_shndx == SHN_UNDEF))
- /* undefined symbol itself */
- return NULL;
-
- if (sym->st_value == 0)
- /* No value */
- return NULL;
+ if ((sym->st_value == 0 && (ELF_ST_TYPE(sym->st_info) != STT_TLS))
+ || (type_class & (sym->st_shndx == SHN_UNDEF)))
+ /* No value or undefined symbol itself */
+ return NULL;
+
+ if (ELF_ST_TYPE(sym->st_info) > STT_FUNC
+ && ELF_ST_TYPE(sym->st_info) != STT_COMMON
+ && ELF_ST_TYPE(sym->st_info) != STT_TLS)
+ /* Ignore all but STT_NOTYPE, STT_OBJECT, STT_FUNC and STT_COMMON
+ * entries (and STT_TLS if TLS is supported) since these
+ * are no code/data definitions.
+ */
+ return NULL;
+#else
+ if (type_class & (sym->st_shndx == SHN_UNDEF))
+ /* undefined symbol itself */
+ return NULL;
+
+ if (sym->st_value == 0)
+ /* No value */
+ return NULL;
if (ELF_ST_TYPE(sym->st_info) > STT_FUNC
&& ELF_ST_TYPE(sym->st_info) != STT_COMMON)
@@ -268,11 +268,8 @@ _dl_lookup_sysv_hash(struct elf_resolve *tpnt, ElfW(Sym) *symtab, unsigned long
* This function resolves externals, and this is either called when we process
* relocations or when we call an entry in the PLT table for the first time.
*/
-char *_dl_lookup_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve *mytpnt, int type_class
-#if USE_TLS
-,struct elf_resolve **tls_tpnt
-#endif
-)
+char *_dl_lookup_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve *mytpnt,
+ int type_class _DL_LOOKUP_HASH_EXTRA_TPNT)
{
struct elf_resolve *tpnt = NULL;
ElfW(Sym) *symtab;
@@ -338,12 +335,12 @@ char *_dl_lookup_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve
if (sym) {
/* At this point we have found the requested symbol, do binding */
-#if USE_TLS
- if(ELF_ST_TYPE(sym->st_info) == STT_TLS) {
- _dl_assert((tls_tpnt != NULL));
+#if USE_TLS
+ if (ELF_ST_TYPE(sym->st_info) == STT_TLS) {
+ _dl_assert(tls_tpnt != NULL);
*tls_tpnt = tpnt;
- return (char*)sym->st_value;
+ return (char *)sym->st_value;
}
#endif
@@ -353,14 +350,22 @@ char *_dl_lookup_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve
/* Perhaps we should support old style weak symbol handling
* per what glibc does when you export LD_DYNAMIC_WEAK */
if (!weak_result)
- weak_result = (char *)tpnt->loadaddr + sym->st_value;
+ weak_result = (char *)DL_FIND_HASH_VALUE(tpnt, type_class, sym);
break;
#endif
case STB_GLOBAL:
- return (char*)tpnt->loadaddr + sym->st_value;
+#ifdef __FDPIC__
+ if (tpntp)
+ *tpntp = tpnt;
+#endif
+ return (char *)DL_FIND_HASH_VALUE(tpnt, type_class, sym);
default: /* Local symbols not handled here */
break;
}
}
+#ifdef __FDPIC__
+ if (tpntp)
+ *tpntp = tpnt;
+#endif
return weak_result;
}