2 * Copyright 2020 The Pigweed Authors
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * https://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
19 * This linker script snippet declares the sections needed for string
20 * tokenization. All sections have type INFO so they are excluded from the final
23 * The contents of this script can be copied into an existing linker script.
24 * Alternately, this file can be directly included in a linker script with an
25 * include directive. For example,
27 * INCLUDE path/to/modules/pw_tokenizer/pw_tokenizer_linker_sections.ld
31 * (your existing linker sections)
38 * This section stores metadata that may be used during tokenized string
39 * decoding. This metadata describes properties that may affect how the
40 * tokenized string is encoded or decoded -- the maximum length of the hash
41 * function and the sizes of certain integer types.
43 * Metadata is declared as key-value pairs. See the metadata variable in
44 * tokenize.cc for further details.
46 .pw_tokenizer.info 0x0 (INFO) :
48 KEEP(*(.pw_tokenizer.info))
52 * Tokenized string entries are stored in this section. Each entry contains
53 * the original string literal and the calculated token that represents it. In
54 * the compiled code, the token and a compact argument list encoded in a
55 * uint32_t are used in place of the format string. The compiled code
56 * contains no references to the tokenized string entries in this section.
58 * The tokenized string entry format is specified by the
59 * pw::tokenizer::internal::Entry class in
60 * pw_tokenizer/public/pw_tokenizer/internal/tokenize_string.h.
62 * The section contents are declared with KEEP so that they are not removed
63 * from the ELF. These are never emitted in the final binary or loaded into
66 .pw_tokenizer.entries 0x0 (INFO) :
68 KEEP(*(.pw_tokenizer.entries.*))