aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-09-27 15:30:10 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2002-09-27 15:30:10 +0200
commitdce81a1a59f9663eb72e722e17f490adc3f5a2d6 (patch)
treeb7ac095e3e844e739365675e99f4e724059e2a38 /gcc/c-common.c
parent0e9e1e0a42eff5ec265470b7e8928cb3b3ad2d70 (diff)
downloadgcc-dce81a1a59f9663eb72e722e17f490adc3f5a2d6.zip
gcc-dce81a1a59f9663eb72e722e17f490adc3f5a2d6.tar.gz
gcc-dce81a1a59f9663eb72e722e17f490adc3f5a2d6.tar.bz2
extend.texi (tls_model): Document.
* doc/extend.texi (tls_model): Document. * varasm.c (decl_tls_model): New. * c-common.c (handle_tls_model_attribute): New. (c_common_attribute_table): Add tls_model. * config/alpha/alpha.c (alpha_encode_section_info): Use decl_tls_model. * flags.h (enum tls_model, flag_tls_default): Move... * tree.h (enum tls_model, flag_tls_default): ...here. (decl_tls_model): New prototype. * config/ia64/ia64.c (ia64_encode_section_info): Likewise. * config/i386/i386.c (ix86_encode_section_info): Likewise. * config/i386/i386.md (tls_global_dynamic, tls_local_dynamic_base): Allow !flag_pic. From-SVN: r57588
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 960e4cf..b3358c2 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -749,6 +749,8 @@ static tree handle_alias_attribute PARAMS ((tree *, tree, tree, int,
bool *));
static tree handle_visibility_attribute PARAMS ((tree *, tree, tree, int,
bool *));
+static tree handle_tls_model_attribute PARAMS ((tree *, tree, tree, int,
+ bool *));
static tree handle_no_instrument_function_attribute PARAMS ((tree *, tree,
tree, int,
bool *));
@@ -847,6 +849,8 @@ const struct attribute_spec c_common_attribute_table[] =
handle_vector_size_attribute },
{ "visibility", 1, 1, true, false, false,
handle_visibility_attribute },
+ { "tls_model", 1, 1, true, false, false,
+ handle_tls_model_attribute },
{ "nonnull", 0, -1, false, true, true,
handle_nonnull_attribute },
{ "nothrow", 0, 0, true, false, false,
@@ -5895,6 +5899,49 @@ handle_visibility_attribute (node, name, args, flags, no_add_attrs)
return NULL_TREE;
}
+/* Handle an "tls_model" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_tls_model_attribute (node, name, args, flags, no_add_attrs)
+ tree *node;
+ tree name;
+ tree args;
+ int flags ATTRIBUTE_UNUSED;
+ bool *no_add_attrs;
+{
+ tree decl = *node;
+
+ if (! DECL_THREAD_LOCAL (decl))
+ {
+ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ }
+ else
+ {
+ tree id;
+
+ id = TREE_VALUE (args);
+ if (TREE_CODE (id) != STRING_CST)
+ {
+ error ("tls_model arg not a string");
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
+ if (strcmp (TREE_STRING_POINTER (id), "local-exec")
+ && strcmp (TREE_STRING_POINTER (id), "initial-exec")
+ && strcmp (TREE_STRING_POINTER (id), "local-dynamic")
+ && strcmp (TREE_STRING_POINTER (id), "global-dynamic"))
+ {
+ error ("tls_model arg must be one of \"local-exec\", \"initial-exec\", \"local-dynamic\" or \"global-dynamic\"");
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
+ }
+
+ return NULL_TREE;
+}
+
/* Handle a "no_instrument_function" attribute; arguments as in
struct attribute_spec.handler. */