aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2008-04-27 15:35:19 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2008-04-27 15:35:19 +0000
commitfeb60f0328c33740a09678e40a6f27e655e43b91 (patch)
tree2fa1779872e1658a836ad7c6225a1303bfacea23 /gcc/dwarf2out.c
parentf509e2962970850d4b6cb465a7ceaa4af9c5f8d0 (diff)
downloadgcc-feb60f0328c33740a09678e40a6f27e655e43b91.zip
gcc-feb60f0328c33740a09678e40a6f27e655e43b91.tar.gz
gcc-feb60f0328c33740a09678e40a6f27e655e43b91.tar.bz2
targhooks.h (default_emutls_var_fields, [...]): Declare.
* targhooks.h (default_emutls_var_fields, default_emutls_var_init): Declare. * tree.h (DECL_THREAD_LOCAL): Compare against TLS_MODEL_REAL. * target.h (struct gcc_target): Add struct emutls member. * target-def.h (TARGET_EMUTLS_GET_ADDRESS, TARGET_EMUTLS_REGISTER_COMMON, TARGET_EMUTLS_VAR_SECTION, TARGET_EMUTLS_TMPL_SECTION, TARGET_EMUTLS_VAR_PREFIX, TARGET_EMUTLS_TMPL_PREFIX, TARGET_EMUTLS_VAR_FIELDS, TARGET_EMUTLS_VAR_INIT, TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESS, TARGET_EMUTLS_VAR_ALIGN_FIXED, TARGET_EMUTLS): New. (TARGET_INITIALIZER): Add TARGET_EMUTLS. * builtins.def (BUILT_IN_EMUTLS_GET_ADDRESS, BUILT_IN_EMUTLS_REGISTER_COMMON): Get name from targetm structure. * dwarf2out.c (loc_descriptor_from_tree_1): Check if emutls can emit debug information. * coretypes.h (tls_model): Add TLS_MODEL_EMULATED, TLS_MODEL_REAL. * varasm.c: Include targhooks.h. (emutls_object_section, emutls_tmpl_section): New. (EMUTLS_VAR_PREFIX, EMUTLS_TMPL_PREFIX): Remove. (EMUTLS_SEPARATOR): New. (prefix_name): New. (get_emutls_object_name): New. (default_emutls_var_fields): New, broken out of ... (get_emutls_object_type): ... here. Adjust to use target hooks. (get_emutls_init_templ_addr): Adjust to use target hooks. (emutls_decl): Adjust to use target hooks. (emutls_finish): Likewise. (default_emutls_var_init): New, broken out of ... (assemble_variable): ... here. Adjust to use target hooks. * output.h (enum section_category): Add SECCAT_EMUTLS_VAR, SECCAT_EMUTLS_TMPL. * c-common.c (handle_section_attribute): Prevent overriding sections for emulated tls with special sections. * config/i386/i386.c (x86_64_elf_select_section): Add SECCAT_EMUTLS_VAR and SECCAT_EMUTLS_TMPL. (x86_64_elf_unique_section): Likewise. * config/vxworks.c: Include tree.h. (vxworks_emutls_var_fields, vxworks_emutls_var_init): New. (vxworks_override_options): Set TLS scheme. * gcc/doc/tm.texi (Emulated TLS): New node. gcc/testsuite/ * gcc.dg/tls/section-2.c: New. * gcc.dg/tls/emutls-1.c: New. * lib/target-supports.exp (check_effective_target_tls_native): Exclude vxworks. From-SVN: r134729
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7625947..83b3fb5 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -9494,16 +9494,33 @@ loc_descriptor_from_tree_1 (tree loc, int want_address)
if (DECL_THREAD_LOCAL_P (loc))
{
rtx rtl;
+ unsigned first_op;
+ unsigned second_op;
- /* If this is not defined, we have no way to emit the data. */
- if (!targetm.have_tls || !targetm.asm_out.output_dwarf_dtprel)
- return 0;
-
- /* The way DW_OP_GNU_push_tls_address is specified, we can only
- look up addresses of objects in the current module. */
- if (DECL_EXTERNAL (loc))
- return 0;
-
+ if (targetm.have_tls)
+ {
+ /* If this is not defined, we have no way to emit the
+ data. */
+ if (!targetm.asm_out.output_dwarf_dtprel)
+ return 0;
+
+ /* The way DW_OP_GNU_push_tls_address is specified, we
+ can only look up addresses of objects in the current
+ module. */
+ if (DECL_EXTERNAL (loc))
+ return 0;
+ first_op = INTERNAL_DW_OP_tls_addr;
+ second_op = DW_OP_GNU_push_tls_address;
+ }
+ else
+ {
+ if (!targetm.emutls.debug_form_tls_address)
+ return 0;
+ loc = emutls_decl (loc);
+ first_op = DW_OP_addr;
+ second_op = DW_OP_form_tls_address;
+ }
+
rtl = rtl_for_decl_location (loc);
if (rtl == NULL_RTX)
return 0;
@@ -9514,11 +9531,11 @@ loc_descriptor_from_tree_1 (tree loc, int want_address)
if (! CONSTANT_P (rtl))
return 0;
- ret = new_loc_descr (INTERNAL_DW_OP_tls_addr, 0, 0);
+ ret = new_loc_descr (first_op, 0, 0);
ret->dw_loc_oprnd1.val_class = dw_val_class_addr;
ret->dw_loc_oprnd1.v.val_addr = rtl;
-
- ret1 = new_loc_descr (DW_OP_GNU_push_tls_address, 0, 0);
+
+ ret1 = new_loc_descr (second_op, 0, 0);
add_loc_descr (&ret, ret1);
have_address = 1;