diff mbox series

[uclibc-ng-devel] aarch64: Apply relocations to use TLS GD access model.

Message ID 20240417112040.1066963-1-dm.chestnykh@gmail.com
State Accepted
Headers show
Series [uclibc-ng-devel] aarch64: Apply relocations to use TLS GD access model. | expand

Commit Message

Dmitry Chestnykh April 17, 2024, 11:20 a.m. UTC
In aarch64 when the general dynamic access model is used for tls data
the linker emits two dynamic relocs (R_AARCH64_TLS_DTPMOD(64) and
R_AARCH64_TLS_DTPREL(64)) that must be applied by ld.so during object
loading.

Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
---
 ldso/ldso/aarch64/elfinterp.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Waldemar Brodkorb April 18, 2024, 12:59 p.m. UTC | #1
Hi Dmitry,
Dmitry Chestnykh wrote,

> In aarch64 when the general dynamic access model is used for tls data
> the linker emits two dynamic relocs (R_AARCH64_TLS_DTPMOD(64) and
> R_AARCH64_TLS_DTPREL(64)) that must be applied by ld.so during object
> loading.
> 
> Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>

Great! 0 test failures for aarch64!

Committed and pushed,
 Thanks
  Waldemar
diff mbox series

Patch

diff --git a/ldso/ldso/aarch64/elfinterp.c b/ldso/ldso/aarch64/elfinterp.c
index 717a76980..9365569cc 100644
--- a/ldso/ldso/aarch64/elfinterp.c
+++ b/ldso/ldso/aarch64/elfinterp.c
@@ -238,6 +238,12 @@  _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
 					}
 				}
 			break;
+		case R_AARCH64_TLS_DTPMOD:
+			*reloc_addr = tls_tpnt->l_tls_modid;
+			break;
+		case R_AARCH64_TLS_DTPREL:
+			*reloc_addr = symbol_addr + rpnt->r_addend;
+			break;
 #endif
 		default:
 			return -1; /*call _dl_exit(1) */