File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -578,12 +578,18 @@ static int object_relocate(elf_t * object) {
578578 memcpy ((void * )(table -> r_offset + object -> base ), & x , sizeof (uintptr_t ));
579579 break ;
580580 case 1031 : {
581- x += * ((ssize_t * )(table -> r_offset + object -> base ));
582- if (!hashmap_has (tls_map , symname )) {
583- fprintf (stderr , "Don't know where to get %s from TLS\n" , symname );
584- exit (1 );
581+ if (symbol ) {
582+ if (!hashmap_has (tls_map , symname )) {
583+ fprintf (stderr , "Warning: Don't know where to get %s (symbol %d) from TLS\n" , symname , symbol );
584+ break ;
585+ }
586+ x += * ((ssize_t * )(table -> r_offset + object -> base ));
587+ x += (size_t )hashmap_get (tls_map , symname );
588+ } else {
589+ /* local tls descriptor? no symbol? idk what to do with this, hope it works */
590+ x = current_tls_offset ;
591+ current_tls_offset += 8 * 4 ; /* idk, alignment I guess */
585592 }
586- x += (size_t )hashmap_get (tls_map , symname );
587593 uintptr_t func = (uintptr_t )& __tlsdesc_static ;
588594 memcpy ((void * )(table -> r_offset + object -> base ), & func , sizeof (uintptr_t ));
589595 memcpy ((void * )(table -> r_offset + object -> base + sizeof (uintptr_t )), & x , sizeof (uintptr_t ));
You can’t perform that action at this time.
0 commit comments