From 3d78f2e96e29feaff7046c22fdc97aa58bee9688 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 21 May 2002 18:11:29 -0700 Subject: c-common.h (enum rid): Add RID_THREAD. * c-common.h (enum rid): Add RID_THREAD. * c-decl.c (start_decl): Do not set DECL_COMMON for tls variables. (grokdeclarator): Grok __thread. * c-parse.in (reswords): Add __thread. (rid_to_yy): Add RID_THREAD. * cp/lex.c (rid_to_yy): Add RID_THREAD. * tree.h (DECL_THREAD_LOCAL): New. (struct tree_decl): Add thread_local_flag. * print-tree.c (print_node): Dump DECL_THREAD_LOCAL. * tree.c (staticp): TLS variables are not static. * target-def.h (TARGET_HAVE_TLS): New. * target.h (have_tls): New. * output.h (SECTION_TLS): New. * varasm.c (assemble_variable): TLS variables can't be common for now. (default_section_type_flags): Handle .tdata and .tbss. (default_elf_asm_named_section): Handle SECTION_TLS. (categorize_decl_for_section): Handle DECL_THREAD_LOCAL. * flags.h (flag_tls_default): Declare. * toplev.c (flag_tls_default): Define. (display_help): Display help for it. (decode_f_option): Set it. * doc/extend.texi (Thread-Local): New node describing language-level thread-local storage. * doc/invoke.texi (-ftls-model): Document. * fixinc/inclhack.def (thread_keyword): New. * fixinc/fixincl.x: Rebuild. From-SVN: r53715 --- gcc/toplev.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'gcc/toplev.c') diff --git a/gcc/toplev.c b/gcc/toplev.c index 878cdca84c3..a7e856b2d87 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -685,12 +685,15 @@ int flag_shared_data; int flag_delayed_branch; /* Nonzero if we are compiling pure (sharable) code. - Value is 1 if we are doing reasonable (i.e. simple - offset into offset table) pic. Value is 2 if we can - only perform register offsets. */ + Value is 1 if we are doing "small" pic; value is 2 if we're doing + "large" pic. */ int flag_pic; +/* Set to the default thread-local storage (tls) model to use. */ + +enum tls_model flag_tls_default; + /* Nonzero means generate extra code for exception handling and enable exception handling. */ @@ -3547,6 +3550,7 @@ display_help () printf (_(" -finline-limit= Limits the size of inlined functions to \n")); printf (_(" -fmessage-length= Limits diagnostics messages lengths to characters per line. 0 suppresses line-wrapping\n")); printf (_(" -fdiagnostics-show-location=[once | every-line] Indicates how often source location information should be emitted, as prefix, at the beginning of diagnostics when line-wrapping\n")); + printf (_(" -ftls-model=[global-dynamic | local-dynamic | initial-exec | local-exec] Indicates the default thread-local storage code generation model\n")); for (i = ARRAY_SIZE (f_options); i--;) { @@ -3825,6 +3829,19 @@ decode_f_option (arg) MAX_INLINE_INSNS); set_param_value ("max-inline-insns", val); } + else if ((option_value = skip_leading_substring (arg, "tls-model="))) + { + if (strcmp (option_value, "global-dynamic") == 0) + flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC; + else if (strcmp (option_value, "local-dynamic") == 0) + flag_tls_default = TLS_MODEL_LOCAL_DYNAMIC; + else if (strcmp (option_value, "initial-exec") == 0) + flag_tls_default = TLS_MODEL_INITIAL_EXEC; + else if (strcmp (option_value, "local-exec") == 0) + flag_tls_default = TLS_MODEL_LOCAL_EXEC; + else + warning ("`%s': unknown tls-model option", arg - 2); + } #ifdef INSN_SCHEDULING else if ((option_value = skip_leading_substring (arg, "sched-verbose="))) fix_sched_param ("verbose", option_value); -- cgit v1.2.1