Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Update.
2003-07-24 Ulrich Drepper <drepper@redhat.com> * include/link.h (struct link_map): Add l_tls_firstbyte_offset field. * sysdeps/generic/dl-tls.c [TLS_TCB_AT_TP] (_dl_determine_tlsoffset): Fix calculation of offsets to take misalignment of first byte in file into account. * elf/dl-load.c (_dl_map_object_from_fd): Initialize l_tls_firstbyte_offset field. * elf/rtld.c (_dl_start_final, _dl_start, dl_main): Likewise. * elf/dl-reloc.c (_dl_allocate_static_tls): Change return type to int. Take l_tls_firstbyte_offset information into account. (CHECK_STATIS_TLS): _dl_allocate_static_tls can fail now. * sysdeps/generic/ldsodefs.h: Adjust _dl_allocate_static_tls prototype. * elf/Makefile: Add rules to build and run tst-tls14. * elf/tst-tls14.c: New file. * elf/tst-tlsmod14a.c: New file. * elf/tst-tlsmod14b.c: New file.
- Loading branch information
Ulrich Drepper
committed
Jul 24, 2003
1 parent
6bc0b95
commit 99fe3b0
Showing
11 changed files
with
231 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* Check alignment of TLS variable. */ | ||
#include <dlfcn.h> | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
|
||
#define AL 4096 | ||
struct foo | ||
{ | ||
int i; | ||
} __attribute ((aligned (AL))); | ||
|
||
static __thread struct foo f; | ||
static struct foo g; | ||
|
||
|
||
extern int in_dso1 (void); | ||
|
||
|
||
static int | ||
do_test (void) | ||
{ | ||
int result = 0; | ||
|
||
int fail = (((uintptr_t) &f) & (AL - 1)) != 0; | ||
printf ("&f = %p %s\n", &f, fail ? "FAIL" : "OK"); | ||
result |= fail; | ||
|
||
fail = (((uintptr_t) &g) & (AL - 1)) != 0; | ||
printf ("&g = %p %s\n", &g, fail ? "FAIL" : "OK"); | ||
result |= fail; | ||
|
||
result |= in_dso1 (); | ||
|
||
void *h = dlopen ("tst-tlsmod14b.so", RTLD_LAZY); | ||
if (h == NULL) | ||
{ | ||
printf ("cannot open tst-tlsmod14b.so: %m\n"); | ||
exit (1); | ||
} | ||
|
||
int (*fp) (void) = (int (*) (void)) dlsym (h, "in_dso2"); | ||
if (fp == NULL) | ||
{ | ||
puts ("cannot find in_dso2"); | ||
exit (1); | ||
} | ||
|
||
result |= fp (); | ||
|
||
return result; | ||
} | ||
|
||
#define TEST_FUNCTION do_test () | ||
#include "../test-skeleton.c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
|
||
|
||
#define AL 4096 | ||
struct foo | ||
{ | ||
int i; | ||
} __attribute ((aligned (AL))); | ||
|
||
static __thread struct foo f; | ||
static struct foo g; | ||
|
||
|
||
#ifndef FCT | ||
# define FCT in_dso1 | ||
#endif | ||
|
||
|
||
int | ||
FCT (void) | ||
{ | ||
puts (__func__); | ||
|
||
int result = 0; | ||
|
||
int fail = (((uintptr_t) &f) & (AL - 1)) != 0; | ||
printf ("&f = %p %s\n", &f, fail ? "FAIL" : "OK"); | ||
result |= fail; | ||
|
||
fail = (((uintptr_t) &g) & (AL - 1)) != 0; | ||
printf ("&g = %p %s\n", &g, fail ? "FAIL" : "OK"); | ||
result |= fail; | ||
|
||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#define FCT in_dso2 | ||
#include "tst-tlsmod14a.c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.