Skip to content

Commit

Permalink
ldso: fix TLSDESC addend processing on archs with backwards descriptors
Browse files Browse the repository at this point in the history
presently this only affects 32-bit arm. despite correctly reversing
the function pointer and argument fields based on the
TLSDESC_BACKWARDS macro, we did not read the addend from the
swapped-order argument field, so nonzero addends were lost, producing
wrong runtime addresses for TLS objects needing an addend.

based on report and patch by Rui Ueyama.
  • Loading branch information
richfelker committed Nov 7, 2023
1 parent 039d3c3 commit e17b9d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ldso/dynlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
break;
#endif
case REL_TLSDESC:
if (stride<3) addend = reloc_addr[1];
if (stride<3) addend = reloc_addr[!TLSDESC_BACKWARDS];
if (def.dso->tls_id > static_tls_cnt) {
struct td_index *new = malloc(sizeof *new);
if (!new) {
Expand Down

0 comments on commit e17b9d7

Please sign in to comment.