0001-src-rtld-dl-tls.c-Fix-TLS-offsets-computation-for-s3.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 4064f77d2f550762cbf220fec7c26a8ce4219ea4 Mon Sep 17 00:00:00 2001
  2. From: Alexander Egorenkov <egorenar@linux.ibm.com>
  3. Date: Sun, 8 Aug 2021 11:19:52 +0200
  4. Subject: [PATCH] src/rtld/dl-tls.c: Fix TLS offsets computation for s390 arch
  5. rtld_determine_tlsoffsets() didn't handle s390 arch properly by falling
  6. back to the default case. If TLS_TCB_AT_TP is 1, then set offset to -1.
  7. From glibc's sysdeps/s390/nptl/tls.h:
  8. -------------------------------------
  9. /* The TCB can have any size and the memory following the address the
  10. thread pointer points to is unspecified. Allocate the TCB there. */
  11. define TLS_TCB_AT_TP 1
  12. define TLS_DTV_AT_TP 0
  13. This lead to the following error:
  14. ---------------------------------
  15. prelink-rtld: error while loading shared libraries: /lib64/libc.so.6: cannot handle TLS data
  16. Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
  17. ---
  18. src/rtld/dl-tls.c | 5 +++++
  19. 1 file changed, 5 insertions(+)
  20. diff --git a/src/rtld/dl-tls.c b/src/rtld/dl-tls.c
  21. index 280cee45f950..29422dcfd25e 100644
  22. --- a/src/rtld/dl-tls.c
  23. +++ b/src/rtld/dl-tls.c
  24. @@ -143,6 +143,11 @@ rtld_determine_tlsoffsets (int e_machine, struct r_scope_elem *search_list)
  25. tls_tcb_size = 0;
  26. break;
  27. + case EM_S390:
  28. + tls_tcb_at_tp = 1;
  29. + tls_tcb_size = -1;
  30. + break;
  31. +
  32. default:
  33. /* Hope there's no TLS! */
  34. for (i = 0; i < search_list->r_nlist; i++)
  35. --
  36. 2.31.1