From 5621b0947f362f74f04dabeb3ac09969ec9d1ded Mon Sep 17 00:00:00 2001 From: midipix Date: Thu, 19 Mar 2015 23:26:00 -0400 Subject: emutls: + add support for platform-provided __emutls_get_address(); + add support for .emutlsv and .emutlst as named sections storing tls variable definitions and default values, respectively. According to the documentation, this could have also been achieved by assigning a value to TARGET_EMUTLS_VAR_SECTION; doing so, however, resulted in a compiler crash, so for now we are using a designated conditional macro instead. signed-off by Z. Gilboa; see copying.midipix (9cd0746c) for additional information. --- gcc/emutls.c | 4 ++++ gcc/tree-emutls.c | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'gcc') diff --git a/gcc/emutls.c b/gcc/emutls.c index fcf6eb56f..92a3deae7 100644 --- a/gcc/emutls.c +++ b/gcc/emutls.c @@ -29,6 +29,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "tm.h" #include "gthr.h" +#ifndef EMUTLS_PROVIDED_BY_PLATFORM + typedef unsigned int word __attribute__((mode(word))); typedef unsigned int pointer __attribute__((mode(pointer))); @@ -203,3 +205,5 @@ __emutls_register_common (struct __emutls_object *obj, if (templ && size == obj->size) obj->templ = templ; } + +#endif /* EMUTLS_PROVIDED_BY_PLATFORM */ diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c index 899888dfb..7bade9f49 100644 --- a/gcc/tree-emutls.c +++ b/gcc/tree-emutls.c @@ -257,6 +257,10 @@ get_emutls_init_templ_addr (tree decl) targetm.emutls.tmpl_section); } + #ifdef TARGET_EMUTLS_VAR_SECTION_EMUTLS + DECL_SECTION_NAME (to) = build_string(strlen(".emutlst"),".emutlst"); + #endif + /* Create varpool node for the new variable and finalize it if it is not external one. */ if (DECL_EXTERNAL (to)) @@ -316,6 +320,10 @@ new_emutls_decl (tree decl) targetm.emutls.tmpl_section); } + #ifdef TARGET_EMUTLS_VAR_SECTION_EMUTLS + DECL_SECTION_NAME (to) = build_string(strlen(".emutlsv"),".emutlsv"); + #endif + /* If this variable is defined locally, then we need to initialize the control structure with size and alignment information. Initialization of COMMON block variables happens elsewhere via a constructor. */ -- cgit v1.2.3