2002-05-22 Richard Henderson * varasm.c (default_section_type_flags): Handle tls data and default sections. * gcc.dg/tls/section-1.c: New test. 2002-03-15 Jason Merrill * varasm.c (assemble_variable): Call resolve_unique_section before checking DECL_SECTION_NAME. --- gcc/testsuite/gcc.dg/tls/section-1.c.jj 2002-08-08 16:11:55.000000000 +0200 +++ gcc/testsuite/gcc.dg/tls/section-1.c 2002-08-08 16:19:08.000000000 +0200 @@ -0,0 +1,11 @@ +/* Verify that we get errors for trying to put TLS data in + sections which can't work. */ + +#define A(X) __attribute__((section(X))) + +__thread int i A("foo"); /* Ok */ + +__thread int j A(".data"); /* { dg-error "causes a section type conflict" "conflict with .data section" { xfail *-*-* } } */ + +int k A("bar"); +__thread int l A("bar"); /* { dg-error "causes a section type conflict" "conflict with user-defined section" } */ --- gcc/varasm.c.jj 2002-08-01 20:58:53.000000000 +0200 +++ gcc/varasm.c 2002-08-08 16:10:15.000000000 +0200 @@ -1599,6 +1599,13 @@ if (TREE_PUBLIC (decl)) maybe_assemble_visibility (decl); + /* Output any data that we will need to use the address of. */ + if (DECL_INITIAL (decl) == error_mark_node) + reloc = contains_pointers_p (TREE_TYPE (decl)) ? 3 : 0; + else if (DECL_INITIAL (decl)) + reloc = output_addressed_constants (DECL_INITIAL (decl)); + resolve_unique_section (decl, reloc, flag_data_sections); + /* Handle uninitialized definitions. */ /* If the decl has been given an explicit section name, then it @@ -1654,14 +1661,7 @@ if (TREE_PUBLIC (decl) && DECL_NAME (decl)) globalize_decl (decl); - /* Output any data that we will need to use the address of. */ - if (DECL_INITIAL (decl) == error_mark_node) - reloc = contains_pointers_p (TREE_TYPE (decl)) ? 3 : 0; - else if (DECL_INITIAL (decl)) - reloc = output_addressed_constants (DECL_INITIAL (decl)); - /* Switch to the appropriate section. */ - resolve_unique_section (decl, reloc, flag_data_sections); variable_section (decl, reloc); /* dbxout.c needs to know this. */ @@ -5345,11 +5345,14 @@ || strcmp (name, ".sbss") == 0 || strncmp (name, ".sbss.", 6) == 0 || strncmp (name, ".gnu.linkonce.sb.", 17) == 0 - || strcmp (name, ".tbss") == 0) + || strcmp (name, ".tbss") == 0 + || strncmp (name, ".gnu.linkonce.tb.", 17) == 0) flags |= SECTION_BSS; if (strcmp (name, ".tdata") == 0 - || strcmp (name, ".tbss") == 0) + || strcmp (name, ".tbss") == 0 + || strncmp (name, ".gnu.linkonce.td.", 17) == 0 + || strncmp (name, ".gnu.linkonce.tb.", 17) == 0) flags |= SECTION_TLS; return flags;