Skip to content

Commit 04b114c

Browse files
xur-llvmmasahir0y
authored andcommitted
vmlinux.lds.h: Add markers for text_unlikely and text_hot sections
Add markers like __hot_text_start, __hot_text_end, __unlikely_text_start, and __unlikely_text_end which will be included in System.map. These markers indicate how the compiler groups functions, providing valuable information to developers about the layout and optimization of the code. Co-developed-by: Han Shen <[email protected]> Signed-off-by: Han Shen <[email protected]> Signed-off-by: Rong Xu <[email protected]> Suggested-by: Sriraman Tallam <[email protected]> Tested-by: Yonghong Song <[email protected]> Tested-by: Yabin Cui <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent d4a7f25 commit 04b114c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

include/asm-generic/vmlinux.lds.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,16 @@
549549
__cpuidle_text_end = .; \
550550
__noinstr_text_end = .;
551551

552+
#define TEXT_UNLIKELY \
553+
__unlikely_text_start = .; \
554+
*(.text.unlikely .text.unlikely.*) \
555+
__unlikely_text_end = .;
556+
557+
#define TEXT_HOT \
558+
__hot_text_start = .; \
559+
*(.text.hot .text.hot.*) \
560+
__hot_text_end = .;
561+
552562
/*
553563
* .text section. Map to function alignment to avoid address changes
554564
* during second ld run in second ld pass when generating System.map
@@ -565,9 +575,9 @@
565575
ALIGN_FUNCTION(); \
566576
*(.text.asan.* .text.tsan.*) \
567577
*(.text.unknown .text.unknown.*) \
568-
*(.text.unlikely .text.unlikely.*) \
578+
TEXT_UNLIKELY \
569579
. = ALIGN(PAGE_SIZE); \
570-
*(.text.hot .text.hot.*) \
580+
TEXT_HOT \
571581
*(TEXT_MAIN .text.fixup) \
572582
NOINSTR_TEXT \
573583
*(.ref.text)

0 commit comments

Comments
 (0)