aboutsummaryrefslogtreecommitdiff
path: root/pw_tokenizer/pw_tokenizer_linker_sections.ld
diff options
context:
space:
mode:
Diffstat (limited to 'pw_tokenizer/pw_tokenizer_linker_sections.ld')
-rw-r--r--pw_tokenizer/pw_tokenizer_linker_sections.ld34
1 files changed, 33 insertions, 1 deletions
diff --git a/pw_tokenizer/pw_tokenizer_linker_sections.ld b/pw_tokenizer/pw_tokenizer_linker_sections.ld
index a48a804cc..ae17f47cd 100644
--- a/pw_tokenizer/pw_tokenizer_linker_sections.ld
+++ b/pw_tokenizer/pw_tokenizer_linker_sections.ld
@@ -34,5 +34,37 @@
SECTIONS
{
- INCLUDE pw_tokenizer_linker_rules.ld
+ /*
+ * This section stores metadata that may be used during tokenized string
+ * decoding. This metadata describes properties that may affect how the
+ * tokenized string is encoded or decoded -- the maximum length of the hash
+ * function and the sizes of certain integer types.
+ *
+ * Metadata is declared as key-value pairs. See the metadata variable in
+ * tokenize.cc for further details.
+ */
+ .pw_tokenizer.info 0x0 (INFO) :
+ {
+ KEEP(*(.pw_tokenizer.info))
+ }
+
+ /*
+ * Tokenized string entries are stored in this section. Each entry contains
+ * the original string literal and the calculated token that represents it. In
+ * the compiled code, the token and a compact argument list encoded in a
+ * uint32_t are used in place of the format string. The compiled code
+ * contains no references to the tokenized string entries in this section.
+ *
+ * The tokenized string entry format is specified by the
+ * pw::tokenizer::internal::Entry class in
+ * pw_tokenizer/public/pw_tokenizer/internal/tokenize_string.h.
+ *
+ * The section contents are declared with KEEP so that they are not removed
+ * from the ELF. These are never emitted in the final binary or loaded into
+ * memory.
+ */
+ .pw_tokenizer.entries 0x0 (INFO) :
+ {
+ KEEP(*(.pw_tokenizer.entries.*))
+ }
}