Skip to contentSkip to conversation

tile: support static_key usage in non-module __exit sections

PATCH New [email protected] 1 participant 1 message Aug 3, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 15/18 tile: support static_key usage in non-module __exit sections

From: Chris Metcalf <[email protected]>
Subject: tile: support static_key usage in non-module __exit sections

Previously, all the __exit sections were just dropped by the link phase. However, if there are static_key (jump label) constructs in __exit sections that are not modules, the link fails with the message:

.exit.text' referenced in section __jump_table' of xxx.o:
defined in discarded section `.exit.text' of xxx.o

Support this usage by keeping the .exit.text sections in the final image if JUMP_LABEL is defined, then discarding them once initialization is complete.

---

 arch/tile/kernel/vmlinux.lds.S |   12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/tile/kernel/vmlinux.lds.S renamed from arch/tile/kernel/vmlinux.lds.S~tile-support-static_key-usage-in-non-module-__exit-sections +12 -0
diff -puN arch/tile/kernel/vmlinux.lds.S~tile-support-static_key-usage-in-non-module-__exit-sections arch/tile/kernel/vmlinux.lds.S
@@ -60,6 +60,18 @@ SECTIONS
   /* "Init" is divided into two areas with very different virtual addresses. */
   INIT_TEXT_SECTION(PAGE_SIZE)
 
+  /*
+   * Some things, like the __jump_table, may contain symbol references
+   * to __exit text, so include such text in the final image if so.
+   * In that case we also override the _einittext from INIT_TEXT_SECTION.
+   */
+#ifdef CONFIG_JUMP_LABEL
+  .exit.text : {
+    EXIT_TEXT
+    _einittext = .;
+  }
+#endif
+
   /* Now we skip back to PAGE_OFFSET for the data. */
   . = (. - TEXT_OFFSET + PAGE_OFFSET);
   #undef LOAD_OFFSET

_