varasm.c (default_section_type_flags): Handle tls data and default sections.
* varasm.c (default_section_type_flags): Handle tls data and default sections. (default_unique_section): Handle tls sections. From-SVN: r53753
This commit is contained in:
parent
343f59d980
commit
c711ba8e2e
@ -1,3 +1,9 @@
|
||||
2002-05-22 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* varasm.c (default_section_type_flags): Handle tls data and
|
||||
default sections.
|
||||
(default_unique_section): Handle tls sections.
|
||||
|
||||
2002-05-23 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* configure.in (CROSS): Define NATIVE_CROSS.
|
||||
|
11
gcc/testsuite/gcc.dg/tls/section-1.c
Normal file
11
gcc/testsuite/gcc.dg/tls/section-1.c
Normal file
@ -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" } */
|
14
gcc/varasm.c
14
gcc/varasm.c
@ -5105,17 +5105,23 @@ default_section_type_flags (decl, name, reloc)
|
||||
if (decl && DECL_ONE_ONLY (decl))
|
||||
flags |= SECTION_LINKONCE;
|
||||
|
||||
if (decl && DECL_THREAD_LOCAL (decl))
|
||||
flags |= SECTION_TLS | SECTION_WRITE;
|
||||
|
||||
if (strcmp (name, ".bss") == 0
|
||||
|| strncmp (name, ".bss.", 5) == 0
|
||||
|| strncmp (name, ".gnu.linkonce.b.", 16) == 0
|
||||
|| 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;
|
||||
@ -5495,7 +5501,11 @@ default_unique_section (decl, reloc)
|
||||
prefix = one_only ? ".gnu.linkonce.sb." : ".sbss.";
|
||||
break;
|
||||
case SECCAT_TDATA:
|
||||
prefix = one_only ? ".gnu.linkonce.td." : ".tdata.";
|
||||
break;
|
||||
case SECCAT_TBSS:
|
||||
prefix = one_only ? ".gnu.linkonce.tb." : ".tbss.";
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user