Import DragonFly BSD commit

From: Sascha Wildner <saw@online.de>
  Date: Fri, 2 Mar 2012 09:15:56 +0000 (+0100)
  Subject: rtld: Add a special case in do_dlsym() for TLS stored symbols.
  X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/1388aaafe730c85693936aaf9bc6d83fc2d981be?hp=bca4412595a8979ab9f1bf36068c806ce88a667a

  rtld: Add a special case in do_dlsym() for TLS stored symbols.

  Submitted-by: Markus Pfeiffer <markus.pfeiffer@morphism.de>

Discussed with:	kan
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2012-03-29 10:32:34 +00:00
parent ba289b84b0
commit 5ceeeba90c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=233655

View File

@ -2618,6 +2618,7 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve,
const Elf_Sym *def;
SymLook req;
RtldLockState lockstate;
tls_index ti;
int res;
def = NULL;
@ -2732,7 +2733,11 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve,
return (make_function_pointer(def, defobj));
else if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC)
return (rtld_resolve_ifunc(defobj, def));
else
else if (ELF_ST_TYPE(def->st_info) == STT_TLS) {
ti.ti_module = defobj->tlsindex;
ti.ti_offset = def->st_value;
return (__tls_get_addr(&ti));
} else
return (defobj->relocbase + def->st_value);
}