Просмотр исходного кода

ldso: microblaze: add missing addend to R_MICROBLAZE_TLSDTPREL32

The R_MICROBLAZE_TLSDTPREL32 dynamic relocation resolved to the bare
symbol value and dropped r_addend.  For global TLS symbols (general
dynamic) the addend is zero, so it worked; but local-dynamic access to a
module-local __thread variable carries the per-symbol offset in the
addend (the reloc references the section symbol + offset).  Dropping it
made __tls_get_addr return the start of the module's TLS block instead of
the variable, so tst-tls10/tst-tls11 read the wrong value and aborted.

Add the addend, matching the adjacent R_MICROBLAZE_TLSTPREL32 case.

Signed-off-by: Ramin Moussavi <ramin.moussavi@yacoub.de>
ramin 2 дней назад
Родитель
Сommit
f6ef0e785d
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      ldso/ldso/microblaze/elfinterp.c

+ 1 - 1
ldso/ldso/microblaze/elfinterp.c

@@ -227,7 +227,7 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope,
 			*reloc_addr = tls_tpnt->l_tls_modid;
 			*reloc_addr = tls_tpnt->l_tls_modid;
 			break;
 			break;
 		case R_MICROBLAZE_TLSDTPREL32:
 		case R_MICROBLAZE_TLSDTPREL32:
-			*reloc_addr = symbol_addr;
+			*reloc_addr = symbol_addr + rpnt->r_addend;
 			break;
 			break;
 		case R_MICROBLAZE_TLSTPREL32:
 		case R_MICROBLAZE_TLSTPREL32:
 			CHECK_STATIC_TLS ((struct link_map *) tls_tpnt);
 			CHECK_STATIC_TLS ((struct link_map *) tls_tpnt);