]>
Commit | Line | Data |
---|---|---|
5384b728 | 1 | 2002-05-22 Richard Henderson <rth@redhat.com> |
2 | ||
3 | * varasm.c (default_section_type_flags): Handle tls data and | |
4 | default sections. | |
5 | ||
6 | * gcc.dg/tls/section-1.c: New test. | |
7 | ||
8 | 2002-03-15 Jason Merrill <jason@redhat.com> | |
9 | ||
10 | * varasm.c (assemble_variable): Call resolve_unique_section before | |
11 | checking DECL_SECTION_NAME. | |
12 | ||
13 | --- gcc/testsuite/gcc.dg/tls/section-1.c.jj 2002-08-08 16:11:55.000000000 +0200 | |
14 | +++ gcc/testsuite/gcc.dg/tls/section-1.c 2002-08-08 16:19:08.000000000 +0200 | |
15 | @@ -0,0 +1,11 @@ | |
16 | +/* Verify that we get errors for trying to put TLS data in | |
17 | + sections which can't work. */ | |
18 | + | |
19 | +#define A(X) __attribute__((section(X))) | |
20 | + | |
21 | +__thread int i A("foo"); /* Ok */ | |
22 | + | |
23 | +__thread int j A(".data"); /* { dg-error "causes a section type conflict" "conflict with .data section" { xfail *-*-* } } */ | |
24 | + | |
25 | +int k A("bar"); | |
26 | +__thread int l A("bar"); /* { dg-error "causes a section type conflict" "conflict with user-defined section" } */ | |
27 | --- gcc/varasm.c.jj 2002-08-01 20:58:53.000000000 +0200 | |
28 | +++ gcc/varasm.c 2002-08-08 16:10:15.000000000 +0200 | |
2ee7d7b3 | 29 | @@ -1599,6 +1599,13 @@ |
5384b728 | 30 | if (TREE_PUBLIC (decl)) |
31 | maybe_assemble_visibility (decl); | |
32 | ||
33 | + /* Output any data that we will need to use the address of. */ | |
34 | + if (DECL_INITIAL (decl) == error_mark_node) | |
35 | + reloc = contains_pointers_p (TREE_TYPE (decl)) ? 3 : 0; | |
36 | + else if (DECL_INITIAL (decl)) | |
37 | + reloc = output_addressed_constants (DECL_INITIAL (decl)); | |
38 | + resolve_unique_section (decl, reloc, flag_data_sections); | |
39 | + | |
40 | /* Handle uninitialized definitions. */ | |
41 | ||
42 | /* If the decl has been given an explicit section name, then it | |
2ee7d7b3 | 43 | @@ -1654,14 +1661,7 @@ |
5384b728 | 44 | if (TREE_PUBLIC (decl) && DECL_NAME (decl)) |
45 | globalize_decl (decl); | |
46 | ||
47 | - /* Output any data that we will need to use the address of. */ | |
48 | - if (DECL_INITIAL (decl) == error_mark_node) | |
49 | - reloc = contains_pointers_p (TREE_TYPE (decl)) ? 3 : 0; | |
50 | - else if (DECL_INITIAL (decl)) | |
51 | - reloc = output_addressed_constants (DECL_INITIAL (decl)); | |
52 | - | |
53 | /* Switch to the appropriate section. */ | |
54 | - resolve_unique_section (decl, reloc, flag_data_sections); | |
55 | variable_section (decl, reloc); | |
56 | ||
57 | /* dbxout.c needs to know this. */ | |
2ee7d7b3 | 58 | @@ -5345,11 +5345,14 @@ |
5384b728 | 59 | || strcmp (name, ".sbss") == 0 |
60 | || strncmp (name, ".sbss.", 6) == 0 | |
61 | || strncmp (name, ".gnu.linkonce.sb.", 17) == 0 | |
62 | - || strcmp (name, ".tbss") == 0) | |
63 | + || strcmp (name, ".tbss") == 0 | |
64 | + || strncmp (name, ".gnu.linkonce.tb.", 17) == 0) | |
65 | flags |= SECTION_BSS; | |
66 | ||
67 | if (strcmp (name, ".tdata") == 0 | |
68 | - || strcmp (name, ".tbss") == 0) | |
69 | + || strcmp (name, ".tbss") == 0 | |
70 | + || strncmp (name, ".gnu.linkonce.td.", 17) == 0 | |
71 | + || strncmp (name, ".gnu.linkonce.tb.", 17) == 0) | |
72 | flags |= SECTION_TLS; | |
73 | ||
74 | return flags; |