aboutsummaryrefslogtreecommitdiff
path: root/pw_tokenizer/pw_tokenizer_linker_rules.ld
diff options
context:
space:
mode:
authorYuval Peress <peress@google.com>2023-03-15 04:03:25 +0000
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-15 04:03:25 +0000
commit0b66b67b2406506301d4edf51fe3a2121ac9ed91 (patch)
treea0a8dc26f4510f55dd9cba75a918e470b602df87 /pw_tokenizer/pw_tokenizer_linker_rules.ld
parent9630f00b0b29c5b415d8ac79d8ab6181b53e3cc3 (diff)
downloadpigweed-0b66b67b2406506301d4edf51fe3a2121ac9ed91.tar.gz
pw_log: Enable Zephyr with pw_log_tokenized
Had to replace PIGWEED_LOG with a choice but we can't just deprecate it and select PIGWEED_LOG_ZEPHYR since you can't use the 'select' statement on a 'choice' in Kconfig. Change-Id: I18d8007e30d104ccff11f1df0c47ed61324f78a7 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/132740 Reviewed-by: Keir Mierle <keir@google.com> Pigweed-Auto-Submit: Yuval Peress <peress@google.com> Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Diffstat (limited to 'pw_tokenizer/pw_tokenizer_linker_rules.ld')
-rw-r--r--pw_tokenizer/pw_tokenizer_linker_rules.ld55
1 files changed, 55 insertions, 0 deletions
diff --git a/pw_tokenizer/pw_tokenizer_linker_rules.ld b/pw_tokenizer/pw_tokenizer_linker_rules.ld
new file mode 100644
index 000000000..d1f0aa796
--- /dev/null
+++ b/pw_tokenizer/pw_tokenizer_linker_rules.ld
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2020 The Pigweed Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+/*
+ * This file is separate from pw_tokenizer_linker_sections.ld because Zephyr
+ * already defines the top level SECTIONS label and requires new linker
+ * scripts to only add the individual sections.
+ */
+
+/*
+ * 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.*))
+}