diff options
author | Xavier Leroy <xavier.leroy@college-de-france.fr> | 2020-12-30 11:00:22 +0100 |
---|---|---|
committer | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2021-02-23 11:33:14 +0100 |
commit | ed89275cb820bb7ab283c51e461d852d1c8bec63 (patch) | |
tree | e076d92145806c6de92194dfa816e9944c2d27f2 /common/Sections.mli | |
parent | 30feb31c6d6e9235acad42ec5d09d14f3919cc36 (diff) | |
download | compcert-kvx-ed89275cb820bb7ab283c51e461d852d1c8bec63.tar.gz compcert-kvx-ed89275cb820bb7ab283c51e461d852d1c8bec63.zip |
Section handling: finer control of variable initialization
Distinguish between:
- uninitialized variables, which can go in COMM if supported
- variables initialized with fixed, numeric quantities,
which can go in a readonly section if "const"
- variables initialized with symbol addresses which may need relocation,
which cannot go in a readonly section even if "const",
but can go in a special "const_data" section.
Also: on macOS, use ".const" instead of ".literal8" for literals,
as not all literals have size 8.
Diffstat (limited to 'common/Sections.mli')
-rw-r--r-- | common/Sections.mli | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/common/Sections.mli b/common/Sections.mli index d9fd9239..a3dad3be 100644 --- a/common/Sections.mli +++ b/common/Sections.mli @@ -16,12 +16,17 @@ (* Handling of linker sections *) +type initialized = + | Uninit (* uninitialized data area *) + | Init (* initialized with fixed, non-relocatable data *) + | Init_reloc (* initialized with relocatable data (symbol addresses) *) + type section_name = | Section_text - | Section_data of bool (* true = init data, false = uninit data *) - | Section_small_data of bool - | Section_const of bool - | Section_small_const of bool + | Section_data of initialized + | Section_small_data of initialized + | Section_const of initialized + | Section_small_const of initialized | Section_string | Section_literal | Section_jumptable @@ -46,7 +51,7 @@ val define_section: -> ?writable:bool -> ?executable:bool -> ?access:access_mode -> unit -> unit val use_section_for: AST.ident -> string -> bool -val for_variable: Env.t -> C.location -> AST.ident -> C.typ -> bool -> +val for_variable: Env.t -> C.location -> AST.ident -> C.typ -> initialized -> section_name * access_mode val for_function: Env.t -> C.location -> AST.ident -> C.attributes -> section_name list val for_stringlit: unit -> section_name |