Skip to content

Commit

Permalink
i#1569 AArch64: Make ELF_R_TLS_DESC fail at run time, not load time.
Browse files Browse the repository at this point in the history
A TLS descriptor contains a pointer to a function that is invoked
lazily to resolve the relocation. Rather than fail when loading a
shared object it is more helpful to fail only if there is an attempt
to resolve the relocation at run time. Sometimes there is no such
attempt.

Review-URL: https://codereview.appspot.com/296650043
  • Loading branch information
egrimley-arm committed Jul 4, 2016
1 parent f038052 commit b86fc3a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/unix/module_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,14 @@ dr_symbol_export_iterator_stop(dr_symbol_export_iterator_t *dr_iter)

#endif /* CLIENT_INTERFACE */

static size_t
tlsdesc_resolver(void *arg)
{
/* FIXME i#1961: TLS descriptors are not implemented */
ASSERT_NOT_IMPLEMENTED(false);
return 0;
}

/* This routine is duplicated in privload_relocate_symbol for relocating
* dynamorio symbols in a bootstrap stage. Any update here should be also
* updated in privload_relocate_symbol.
Expand Down Expand Up @@ -1745,8 +1753,8 @@ module_relocate_symbol(ELF_REL_TYPE *rel,
break;
#ifndef ANDROID
case ELF_R_TLS_DESC:
/* FIXME: TLS descriptor, not implemented */
ASSERT_NOT_IMPLEMENTED(false);
/* FIXME i#1961: TLS descriptors are not implemented */
*((size_t (**)(void *))r_addr) = tlsdesc_resolver;
break;
# ifndef X64
case R_386_TLS_TPOFF32:
Expand Down

0 comments on commit b86fc3a

Please sign in to comment.