aboutsummaryrefslogtreecommitdiffstats
path: root/cfrontend
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@college-de-france.fr>2022-08-22 17:35:49 +0200
committerXavier Leroy <xavier.leroy@college-de-france.fr>2022-08-29 13:55:35 +0200
commit169007c52e27ce1fce6ca5fdd5fc7f43071b8841 (patch)
tree86e52680d32759cf4c78219fb245bd0467c070a1 /cfrontend
parent50836f2a04575402aa61a256fe7047c16610992f (diff)
downloadcompcert-169007c52e27ce1fce6ca5fdd5fc7f43071b8841.tar.gz
compcert-169007c52e27ce1fce6ca5fdd5fc7f43071b8841.zip
Support mergeable sections for fixed-size literals
On platforms that support them (ELF, macOS), use mergeable sections (like `.rodata.cst8`) for 4-, 8- and 16-byte wide literals. Works only if the LITERAL section is the default one. If the user provided their own LITERAL section, all literals are put in it regardless of their sizes. Support for mergeable string sections is introduced in this commit too but needs further changes in C2C.ml .
Diffstat (limited to 'cfrontend')
-rw-r--r--cfrontend/C2C.ml4
1 files changed, 2 insertions, 2 deletions
diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml
index 7c6a4994..17c0a5cd 100644
--- a/cfrontend/C2C.ml
+++ b/cfrontend/C2C.ml
@@ -304,7 +304,7 @@ let name_for_string_literal s =
{ a_storage = C.Storage_static;
a_alignment = Some 1;
a_size = Some (Int64.of_int (String.length s + 1));
- a_sections = [Sections.for_stringlit()];
+ a_sections = [Sections.for_stringlit 0];
a_access = Sections.Access_default;
a_inline = No_specifier;
a_loc = Cutil.no_loc };
@@ -337,7 +337,7 @@ let name_for_wide_string_literal s =
a_alignment = Some wchar_size;
a_size = Some (Int64.(mul (of_int (List.length s + 1))
(of_int wchar_size)));
- a_sections = [Sections.for_stringlit()];
+ a_sections = [Sections.for_stringlit 0];
a_access = Sections.Access_default;
a_inline = No_specifier;
a_loc = Cutil.no_loc };