ldso: remove redundant runtime checks in static TLS logic

as a result of commit ffab43602b,
static_tls_cnt is now valid during relocations at program startup, so
it's no longer necessary to condition the check against static_tls_cnt
on this being a runtime (dlopen) relocation.
This commit is contained in:
Rich Felker 2019-08-11 11:57:38 -04:00
parent ffab43602b
commit 71af530987
1 changed files with 2 additions and 2 deletions

View File

@ -390,7 +390,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
tls_val = def.sym ? def.sym->st_value : 0; tls_val = def.sym ? def.sym->st_value : 0;
if ((type == REL_TPOFF || type == REL_TPOFF_NEG) if ((type == REL_TPOFF || type == REL_TPOFF_NEG)
&& runtime && def.dso->tls_id > static_tls_cnt) { && def.dso->tls_id > static_tls_cnt) {
error("Error relocating %s: %s: initial-exec TLS " error("Error relocating %s: %s: initial-exec TLS "
"resolves to dynamic definition in %s", "resolves to dynamic definition in %s",
dso->name, name, def.dso->name); dso->name, name, def.dso->name);
@ -450,7 +450,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
#endif #endif
case REL_TLSDESC: case REL_TLSDESC:
if (stride<3) addend = reloc_addr[1]; if (stride<3) addend = reloc_addr[1];
if (runtime && def.dso->tls_id > static_tls_cnt) { if (def.dso->tls_id > static_tls_cnt) {
struct td_index *new = malloc(sizeof *new); struct td_index *new = malloc(sizeof *new);
if (!new) { if (!new) {
error( error(