Skip to content

Commit

Permalink
rtld: rename tls_done to tls_static
Browse files Browse the repository at this point in the history
The meaning of the flag is that static TLS allocation was done.

Taken from NetBSD Joerg Sonnenberger change for src/libexec/ld.elf_so/tls.c
rev. 1.18.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
  • Loading branch information
kostikbel committed Jun 5, 2023
1 parent a7bca69 commit 283a4f4
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion libexec/rtld-elf/aarch64/reloc.c
Expand Up @@ -470,7 +470,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
* modules. If we run out of space, we generate an
* error.
*/
if (!defobj->tls_done) {
if (!defobj->tls_static) {
if (!allocate_tls_offset(
__DECONST(Obj_Entry *, defobj))) {
_rtld_error(
Expand Down
4 changes: 2 additions & 2 deletions libexec/rtld-elf/amd64/reloc.c
Expand Up @@ -258,7 +258,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
* dynamically loaded modules. If we run out
* of space, we generate an error.
*/
if (!defobj->tls_done) {
if (!defobj->tls_static) {
if (!allocate_tls_offset(
__DECONST(Obj_Entry *, defobj))) {
_rtld_error("%s: No space available "
Expand All @@ -279,7 +279,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
* dynamically loaded modules. If we run out
* of space, we generate an error.
*/
if (!defobj->tls_done) {
if (!defobj->tls_static) {
if (!allocate_tls_offset(
__DECONST(Obj_Entry *, defobj))) {
_rtld_error("%s: No space available "
Expand Down
2 changes: 1 addition & 1 deletion libexec/rtld-elf/arm/reloc.c
Expand Up @@ -279,7 +279,7 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rel *rel, SymCache *cache,
if (def == NULL)
return -1;

if (!defobj->tls_done && !allocate_tls_offset(obj))
if (!defobj->tls_static && !allocate_tls_offset(obj))
return -1;

tmp = (Elf_Addr)def->st_value + defobj->tlsoffset;
Expand Down
2 changes: 1 addition & 1 deletion libexec/rtld-elf/i386/reloc.c
Expand Up @@ -242,7 +242,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
* dynamically loaded modules. If we run out
* of space, we generate an error.
*/
if (!defobj->tls_done) {
if (!defobj->tls_static) {
if (!allocate_tls_offset(
__DECONST(Obj_Entry *, defobj))) {
_rtld_error("%s: No space available "
Expand Down
2 changes: 1 addition & 1 deletion libexec/rtld-elf/map_object.c
Expand Up @@ -433,7 +433,7 @@ obj_free(Obj_Entry *obj)
{
Objlist_Entry *elm;

if (obj->tls_done)
if (obj->tls_static)
free_tls_offset(obj);
while (obj->needed != NULL) {
Needed_Entry *needed = obj->needed;
Expand Down
2 changes: 1 addition & 1 deletion libexec/rtld-elf/powerpc/reloc.c
Expand Up @@ -252,7 +252,7 @@ reloc_nonplt_object(Obj_Entry *obj_rtld __unused, Obj_Entry *obj,
* modules. If we run out of space, we generate an
* error.
*/
if (!defobj->tls_done) {
if (!defobj->tls_static) {
if (!allocate_tls_offset(
__DECONST(Obj_Entry *, defobj))) {
_rtld_error("%s: No space available for static "
Expand Down
2 changes: 1 addition & 1 deletion libexec/rtld-elf/powerpc64/reloc.c
Expand Up @@ -247,7 +247,7 @@ reloc_nonplt_object(Obj_Entry *obj_rtld __unused, Obj_Entry *obj,
* modules. If we run out of space, we generate an
* error.
*/
if (!defobj->tls_done) {
if (!defobj->tls_static) {
if (!allocate_tls_offset(
__DECONST(Obj_Entry *, defobj))) {
_rtld_error("%s: No space available for static "
Expand Down
4 changes: 2 additions & 2 deletions libexec/rtld-elf/riscv/reloc.c
Expand Up @@ -325,7 +325,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
* modules. If we run out of space, we generate an
* error.
*/
if (!defobj->tls_done) {
if (!defobj->tls_static) {
if (!allocate_tls_offset(
__DECONST(Obj_Entry *, defobj))) {
_rtld_error(
Expand All @@ -352,7 +352,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
* modules. If we run out of space, we generate an
* error.
*/
if (!defobj->tls_done) {
if (!defobj->tls_static) {
if (!allocate_tls_offset(
__DECONST(Obj_Entry *, defobj))) {
_rtld_error(
Expand Down
8 changes: 4 additions & 4 deletions libexec/rtld-elf/rtld.c
Expand Up @@ -5474,11 +5474,11 @@ allocate_tls_offset(Obj_Entry *obj)
{
size_t off;

if (obj->tls_done)
if (obj->tls_static)
return (true);

if (obj->tlssize == 0) {
obj->tls_done = true;
obj->tls_static = true;
return (true);
}

Expand Down Expand Up @@ -5509,7 +5509,7 @@ allocate_tls_offset(Obj_Entry *obj)

tls_last_offset = off;
tls_last_size = obj->tlssize;
obj->tls_done = true;
obj->tls_static = true;

return (true);
}
Expand Down Expand Up @@ -5885,7 +5885,7 @@ distribute_static_tls(Objlist *list, RtldLockState *lockstate)
return;
STAILQ_FOREACH(elm, list, link) {
obj = elm->obj;
if (obj->marker || !obj->tls_done || obj->static_tls_copied)
if (obj->marker || !obj->tls_static || obj->static_tls_copied)
continue;
distrib(obj->tlsoffset, obj->tlsinit, obj->tlsinitsize,
obj->tlssize);
Expand Down
2 changes: 1 addition & 1 deletion libexec/rtld-elf/rtld.h
Expand Up @@ -245,7 +245,7 @@ typedef struct Struct_Obj_Entry {
bool traced : 1; /* Already printed in ldd trace output */
bool jmpslots_done : 1; /* Already have relocated the jump slots */
bool init_done : 1; /* Already have added object to init list */
bool tls_done : 1; /* Already allocated offset for static TLS */
bool tls_static : 1; /* Already allocated offset for static TLS */
bool phdr_alloc : 1; /* Phdr is allocated and needs to be freed. */
bool z_origin : 1; /* Process rpath and soname tokens */
bool z_nodelete : 1; /* Do not unload the object and dependencies */
Expand Down

0 comments on commit 283a4f4

Please sign in to comment.