Skip to content

Commit

Permalink
10158 sgs/rtld: cast between incompatible function types
Browse files Browse the repository at this point in the history
Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
Reviewed by: C Fraire <cfraire@me.com>
Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
  • Loading branch information
tsoome authored and hrosenfeld committed Jan 4, 2019
1 parent adc04c2 commit 5e90af2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
9 changes: 4 additions & 5 deletions usr/src/cmd/sgs/rtld/common/external.c
Expand Up @@ -202,7 +202,7 @@
* call during process execution.
*
* - _ld_libc() can also be called by libc during process execution to
* re-establish interfaces such as the locale.
* re-establish interfaces such as the locale.
*/
static void
get_lcinterface(Rt_map *lmp, Lc_interface *funcs)
Expand Down Expand Up @@ -475,14 +475,13 @@ rt_bind_clear(int flags)
void
rt_thr_init(Lm_list *lml)
{
void (*fptr)(void);
int (*fptr)(void);

if ((fptr =
(void (*)())lml->lm_lcs[CI_THRINIT].lc_un.lc_func) != NULL) {
if ((fptr = lml->lm_lcs[CI_THRINIT].lc_un.lc_func) != NULL) {
lml->lm_lcs[CI_THRINIT].lc_un.lc_func = NULL;

leave(lml, thr_flg_reenter);
(*fptr)();
(void) (*fptr)();
(void) enter(thr_flg_reenter);

/*
Expand Down
18 changes: 9 additions & 9 deletions usr/src/cmd/sgs/rtld/common/tls.c
Expand Up @@ -120,12 +120,12 @@ tls_modaddrem(Rt_map *lmp, uint_t flag)
Lm_list *lml = LIST(lmp);
TLS_modinfo tmi;
Phdr *tlsphdr;
void (*fptr)(TLS_modinfo *);
int (*fptr)(TLS_modinfo *);

if (flag & TM_FLG_MODADD) {
fptr = (void (*)())lml->lm_lcs[CI_TLS_MODADD].lc_un.lc_func;
fptr = lml->lm_lcs[CI_TLS_MODADD].lc_un.lc_func;
} else if (FLAGS1(lmp) & FL1_RT_TLSADD) {
fptr = (void (*)())lml->lm_lcs[CI_TLS_MODREM].lc_un.lc_func;
fptr = lml->lm_lcs[CI_TLS_MODREM].lc_un.lc_func;
} else {
return;
}
Expand All @@ -147,7 +147,7 @@ tls_modaddrem(Rt_map *lmp, uint_t flag)
tmi.tm_stattlsoffset = 0;

DBG_CALL(Dbg_tls_modactivity(LIST(lmp), &tmi, flag));
(*fptr)(&tmi);
(void) (*fptr)(&tmi);

/*
* Tag that this link-map has registered its TLS, and, if this object
Expand Down Expand Up @@ -258,9 +258,9 @@ tls_statmod(Lm_list *lml, Rt_map *lmp)
uint_t tlsmodndx, tlsmodcnt = lml->lm_tls;
TLS_modinfo **tlsmodlist, *tlsbuflist;
Phdr *tlsphdr;
void (*fptr)(TLS_modinfo **, ulong_t);
int (*fptr)(TLS_modinfo **, ulong_t);

fptr = (void (*)())lml->lm_lcs[CI_TLS_STATMOD].lc_un.lc_func;
fptr = lml->lm_lcs[CI_TLS_STATMOD].lc_un.lc_func;

/*
* Allocate a buffer to report the TLS modules, the buffer consists of:
Expand All @@ -285,8 +285,8 @@ tls_statmod(Lm_list *lml, Rt_map *lmp)
* If we don't have any TLS modules - report that and return.
*/
if (tlsmodcnt == 0) {
if (fptr)
(*fptr)(tlsmodlist, tls_static_resv);
if (fptr != NULL)
(void) (*fptr)(tlsmodlist, tls_static_resv);
DBG_CALL(Dbg_tls_static_block(&lml_main, 0, 0,
tls_static_resv));
return (1);
Expand Down Expand Up @@ -330,7 +330,7 @@ tls_statmod(Lm_list *lml, Rt_map *lmp)

DBG_CALL(Dbg_tls_static_block(&lml_main, (void *)tlsmodlist,
tls_static_size, tls_static_resv));
(*fptr)(tlsmodlist, (tls_static_size + tls_static_resv));
(void) (*fptr)(tlsmodlist, (tls_static_size + tls_static_resv));

/*
* We're done with the list - clean it up.
Expand Down

0 comments on commit 5e90af2

Please sign in to comment.