Skip to content

Commit 44379d0

Browse files
xur-llvmopsiff
authored andcommitted
vmlinux.lds.h: Add markers for text_unlikely and text_hot sections
[ Upstream commit db0b299 ] 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]> [ Backport from v6.13 ] Signed-off-by: WangYuli <[email protected]>
1 parent 70e2373 commit 44379d0

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
@@ -544,6 +544,16 @@
544544
__cpuidle_text_end = .; \
545545
__noinstr_text_end = .;
546546

547+
#define TEXT_UNLIKELY \
548+
__unlikely_text_start = .; \
549+
*(.text.unlikely .text.unlikely.*) \
550+
__unlikely_text_end = .;
551+
552+
#define TEXT_HOT \
553+
__hot_text_start = .; \
554+
*(.text.hot .text.hot.*) \
555+
__hot_text_end = .;
556+
547557
/*
548558
* .text section. Map to function alignment to avoid address changes
549559
* during second ld run in second ld pass when generating System.map
@@ -560,9 +570,9 @@
560570
ALIGN_FUNCTION(); \
561571
*(.text.asan.* .text.tsan.*) \
562572
*(.text.unknown .text.unknown.*) \
563-
*(.text.unlikely .text.unlikely.*) \
573+
TEXT_UNLIKELY \
564574
. = ALIGN(PAGE_SIZE); \
565-
*(.text.hot .text.hot.*) \
575+
TEXT_HOT \
566576
*(TEXT_MAIN .text.fixup) \
567577
NOINSTR_TEXT \
568578
*(.ref.text)

0 commit comments

Comments
 (0)