Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Dec 2025 18:18:54 +0000
From:      Jessica Clarke <jrtc27@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a85ba2eca4d6 - stable/13 - rtld-elf/riscv: Don't allocate static TLS for dynamic TLS relocations
Message-ID:  <6940510e.237e5.4f8fdc14@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/13 has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=a85ba2eca4d6f7a958e3d4b139723e5116e0a623

commit a85ba2eca4d6f7a958e3d4b139723e5116e0a623
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2025-05-28 20:22:15 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2025-12-15 17:56:36 +0000

    rtld-elf/riscv: Don't allocate static TLS for dynamic TLS relocations
    
    Provided you don't run out of extra static TLS space this should work,
    but it's wholly unnecessary and not how things are supposed to be done.
    Only static TLS relocations should allocate static TLS.
    
    Reviewed by:    kib
    Fixes:          4b1859c0e943 ("Add support for RISC-V architecture.")
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D50563
    
    (cherry picked from commit 03801d449a3731cb643a51625c8c4d5d07b2e54c)
---
 libexec/rtld-elf/riscv/reloc.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/libexec/rtld-elf/riscv/reloc.c b/libexec/rtld-elf/riscv/reloc.c
index 8dd225e5a920..03d3c2d0c9ba 100644
--- a/libexec/rtld-elf/riscv/reloc.c
+++ b/libexec/rtld-elf/riscv/reloc.c
@@ -405,23 +405,6 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
 			    lockstate);
 			if (def == NULL)
 				return (-1);
-			/*
-			 * We lazily allocate offsets for static TLS as we
-			 * see the first relocation that references the
-			 * TLS block. This allows us to support (small
-			 * amounts of) static TLS in dynamically loaded
-			 * modules. If we run out of space, we generate an
-			 * error.
-			 */
-			if (!defobj->tls_static) {
-				if (!allocate_tls_offset(
-				    __DECONST(Obj_Entry *, defobj))) {
-					_rtld_error(
-					    "%s: No space available for static "
-					    "Thread Local Storage", obj->path);
-					return (-1);
-				}
-			}
 
 			*where += (Elf_Addr)(def->st_value + rela->r_addend
 			    - TLS_DTV_OFFSET);


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6940510e.237e5.4f8fdc14>