aboutsummaryrefslogtreecommitdiffstats
path: root/common/Sections.ml
diff options
context:
space:
mode:
Diffstat (limited to 'common/Sections.ml')
-rw-r--r--common/Sections.ml25
1 files changed, 16 insertions, 9 deletions
diff --git a/common/Sections.ml b/common/Sections.ml
index 794b8470..c256628e 100644
--- a/common/Sections.ml
+++ b/common/Sections.ml
@@ -23,7 +23,7 @@ type initialized =
type section_name =
| Section_text
- | Section_data of initialized
+ | Section_data of initialized * bool (* true = thread local ? *)
| Section_small_data of initialized
| Section_const of initialized
| Section_small_const of initialized
@@ -54,9 +54,9 @@ type section_info = {
}
let default_section_info = {
- sec_name_init = Section_data Init;
- sec_name_init_reloc = Section_data Init_reloc;
- sec_name_uninit = Section_data Uninit;
+ sec_name_init = Section_data (Init, false);
+ sec_name_init_reloc = Section_data (Init_reloc, false);
+ sec_name_uninit = Section_data (Uninit, false);
sec_writable = true;
sec_executable = false;
sec_access = Access_default
@@ -72,9 +72,15 @@ let builtin_sections = [
sec_writable = false; sec_executable = true;
sec_access = Access_default};
"DATA",
- {sec_name_init = Section_data Init;
- sec_name_init_reloc = Section_data Init_reloc;
- sec_name_uninit = Section_data Uninit;
+ {sec_name_init = Section_data (Init, false);
+ sec_name_init_reloc = Section_data (Init_reloc, false);
+ sec_name_uninit = Section_data (Uninit, false);
+ sec_writable = true; sec_executable = false;
+ sec_access = Access_default};
+ "TDATA",
+ {sec_name_init = Section_data (Init, true);
+ sec_name_init_reloc = Section_data (Init_reloc, true);
+ sec_name_uninit = Section_data (Uninit, true);
sec_writable = true; sec_executable = false;
sec_access = Access_default};
"SDATA",
@@ -195,7 +201,7 @@ let get_attr_section loc attr =
(* Determine section for a variable definition *)
-let for_variable env loc id ty init =
+let for_variable env loc id ty init thrl =
let attr = Cutil.attributes_of_type env ty in
let readonly = List.mem C.AConst attr && not(List.mem C.AVolatile attr) in
let si =
@@ -214,7 +220,8 @@ let for_variable env loc id ty init =
let name =
if readonly
then if size <= !Clflags.option_small_const then "SCONST" else "CONST"
- else if size <= !Clflags.option_small_data then "SDATA" else "DATA" in
+ else if size <= !Clflags.option_small_data then "SDATA" else
+ if thrl then "TDATA" else "DATA" in
try
Hashtbl.find current_section_table name
with Not_found ->