@@ -582,9 +582,21 @@
* during second ld run in second ld pass when generating System.map
*
* TEXT_MAIN here will match .text.fixup and .text.unlikely if dead
- * code elimination is enabled, so these sections should be converted
- * to use ".." first.
+ * code elimination or function-section is enabled. Match these symbols
+ * first when in these builds.
*/
+#if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CLANG)
+#define TEXT_TEXT \
+ *(.text.asan.* .text.tsan.*) \
+ *(.text.unknown .text.unknown.*) \
+ *(.text.unlikely .text.unlikely.*) \
+ ALIGN_FUNCTION(); \
+ *(.text.hot .text.hot.*) \
+ *(TEXT_MAIN .text.fixup) \
+ NOINSTR_TEXT \
+ *(.ref.text) \
+ MEM_KEEP(init.text*)
+#else
#define TEXT_TEXT \
ALIGN_FUNCTION(); \
*(.text.hot .text.hot.*) \
@@ -594,7 +606,8 @@
NOINSTR_TEXT \
*(.ref.text) \
*(.text.asan.* .text.tsan.*) \
- MEM_KEEP(init.text*) \
+ MEM_KEEP(init.text*)
+#endif
/* sched.text is aling to function alignment to secure we have same