pw_tokenizer: Add the linker sections automatically

- Add the pw_tokenizer linker script using linker flags.
- Apply --gc-sections to host builds, since the pw_tokenizer sections
  are now preserved without it.

Change-Id: I8cbd087d808cb75492c6113411618f2c079189c1
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/23303
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
diff --git a/pw_tokenizer/add_tokenizer_sections_to_default_script.ld b/pw_tokenizer/add_tokenizer_sections_to_default_script.ld
new file mode 100644
index 0000000..41cc0c1
--- /dev/null
+++ b/pw_tokenizer/add_tokenizer_sections_to_default_script.ld
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+INCLUDE pw_tokenizer_linker_sections.ld
+
+/*
+ * The INSERT directive instructs the linker to append the directives in this
+ * script to the default linker script, rather than replace the default with
+ * this script. It doesn't matter where the tokenizer sections are inserted, so
+ * insert them after the standard .strtab section.
+ */
+INSERT AFTER .strtab