vmlinux.lds.h (eff8728fe69880d3f7983bec3fb6cea4c306261f) | vmlinux.lds.h (9183c3f9ed710a8edf1a61e8a96d497258d26e08) |
---|---|
1/* 2 * Helper macros to support writing architecture specific 3 * linker scripts. 4 * 5 * A minimal linker scripts has following content: 6 * [This is a sample, architectures may have special requiriements] 7 * 8 * OUTPUT_FORMAT(...) --- 20 unchanged lines hidden (view full) --- 29 * 30 * EXCEPTION_TABLE(...) 31 * 32 * BSS_SECTION(0, 0, 0) 33 * _end = .; 34 * 35 * STABS_DEBUG 36 * DWARF_DEBUG | 1/* 2 * Helper macros to support writing architecture specific 3 * linker scripts. 4 * 5 * A minimal linker scripts has following content: 6 * [This is a sample, architectures may have special requiriements] 7 * 8 * OUTPUT_FORMAT(...) --- 20 unchanged lines hidden (view full) --- 29 * 30 * EXCEPTION_TABLE(...) 31 * 32 * BSS_SECTION(0, 0, 0) 33 * _end = .; 34 * 35 * STABS_DEBUG 36 * DWARF_DEBUG |
37 * ELF_DETAILS | |
38 * 39 * DISCARDS // must be the last 40 * } 41 * 42 * [__init_begin, __init_end] is the init section that may be freed after init 43 * // __init_begin and __init_end should be page aligned, so that we can 44 * // free the whole .init memory 45 * [_stext, _etext] is the text section --- 338 unchanged lines hidden (view full) --- 384 __end_init_task = .; 385 386#define JUMP_TABLE_DATA \ 387 . = ALIGN(8); \ 388 __start___jump_table = .; \ 389 KEEP(*(__jump_table)) \ 390 __stop___jump_table = .; 391 | 37 * 38 * DISCARDS // must be the last 39 * } 40 * 41 * [__init_begin, __init_end] is the init section that may be freed after init 42 * // __init_begin and __init_end should be page aligned, so that we can 43 * // free the whole .init memory 44 * [_stext, _etext] is the text section --- 338 unchanged lines hidden (view full) --- 383 __end_init_task = .; 384 385#define JUMP_TABLE_DATA \ 386 . = ALIGN(8); \ 387 __start___jump_table = .; \ 388 KEEP(*(__jump_table)) \ 389 __stop___jump_table = .; 390 |
391#define STATIC_CALL_DATA \ 392 . = ALIGN(8); \ 393 __start_static_call_sites = .; \ 394 KEEP(*(.static_call_sites)) \ 395 __stop_static_call_sites = .; 396 |
|
392/* 393 * Allow architectures to handle ro_after_init data on their 394 * own by defining an empty RO_AFTER_INIT_DATA. 395 */ 396#ifndef RO_AFTER_INIT_DATA 397#define RO_AFTER_INIT_DATA \ | 397/* 398 * Allow architectures to handle ro_after_init data on their 399 * own by defining an empty RO_AFTER_INIT_DATA. 400 */ 401#ifndef RO_AFTER_INIT_DATA 402#define RO_AFTER_INIT_DATA \ |
403 . = ALIGN(8); \ |
|
398 __start_ro_after_init = .; \ 399 *(.data..ro_after_init) \ 400 JUMP_TABLE_DATA \ | 404 __start_ro_after_init = .; \ 405 *(.data..ro_after_init) \ 406 JUMP_TABLE_DATA \ |
407 STATIC_CALL_DATA \ |
|
401 __end_ro_after_init = .; 402#endif 403 404/* 405 * Read only Data 406 */ 407#define RO_DATA(align) \ 408 . = ALIGN((align)); \ --- 167 unchanged lines hidden (view full) --- 576 * during second ld run in second ld pass when generating System.map 577 * 578 * TEXT_MAIN here will match .text.fixup and .text.unlikely if dead 579 * code elimination is enabled, so these sections should be converted 580 * to use ".." first. 581 */ 582#define TEXT_TEXT \ 583 ALIGN_FUNCTION(); \ | 408 __end_ro_after_init = .; 409#endif 410 411/* 412 * Read only Data 413 */ 414#define RO_DATA(align) \ 415 . = ALIGN((align)); \ --- 167 unchanged lines hidden (view full) --- 583 * during second ld run in second ld pass when generating System.map 584 * 585 * TEXT_MAIN here will match .text.fixup and .text.unlikely if dead 586 * code elimination is enabled, so these sections should be converted 587 * to use ".." first. 588 */ 589#define TEXT_TEXT \ 590 ALIGN_FUNCTION(); \ |
584 *(.text.hot .text.hot.*) \ 585 *(TEXT_MAIN .text.fixup) \ 586 *(.text.unlikely .text.unlikely.*) \ 587 *(.text.unknown .text.unknown.*) \ | 591 *(.text.hot TEXT_MAIN .text.fixup .text.unlikely) \ |
588 NOINSTR_TEXT \ 589 *(.text..refcount) \ 590 *(.ref.text) \ 591 MEM_KEEP(init.text*) \ 592 MEM_KEEP(exit.text*) \ 593 594 595/* sched.text is aling to function alignment to secure we have same --- 214 unchanged lines hidden (view full) --- 810 .debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) } \ 811 .debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) } \ 812 /* DWARF 4 */ \ 813 .debug_types 0 : { *(.debug_types) } \ 814 /* DWARF 5 */ \ 815 .debug_macro 0 : { *(.debug_macro) } \ 816 .debug_addr 0 : { *(.debug_addr) } 817 | 592 NOINSTR_TEXT \ 593 *(.text..refcount) \ 594 *(.ref.text) \ 595 MEM_KEEP(init.text*) \ 596 MEM_KEEP(exit.text*) \ 597 598 599/* sched.text is aling to function alignment to secure we have same --- 214 unchanged lines hidden (view full) --- 814 .debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) } \ 815 .debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) } \ 816 /* DWARF 4 */ \ 817 .debug_types 0 : { *(.debug_types) } \ 818 /* DWARF 5 */ \ 819 .debug_macro 0 : { *(.debug_macro) } \ 820 .debug_addr 0 : { *(.debug_addr) } 821 |
818/* Stabs debugging sections. */ | 822 /* Stabs debugging sections. */ |
819#define STABS_DEBUG \ 820 .stab 0 : { *(.stab) } \ 821 .stabstr 0 : { *(.stabstr) } \ 822 .stab.excl 0 : { *(.stab.excl) } \ 823 .stab.exclstr 0 : { *(.stab.exclstr) } \ 824 .stab.index 0 : { *(.stab.index) } \ | 823#define STABS_DEBUG \ 824 .stab 0 : { *(.stab) } \ 825 .stabstr 0 : { *(.stabstr) } \ 826 .stab.excl 0 : { *(.stab.excl) } \ 827 .stab.exclstr 0 : { *(.stab.exclstr) } \ 828 .stab.index 0 : { *(.stab.index) } \ |
825 .stab.indexstr 0 : { *(.stab.indexstr) } | 829 .stab.indexstr 0 : { *(.stab.indexstr) } \ 830 .comment 0 : { *(.comment) } |
826 | 831 |
827/* Required sections not related to debugging. */ 828#define ELF_DETAILS \ 829 .comment 0 : { *(.comment) } \ 830 .symtab 0 : { *(.symtab) } \ 831 .strtab 0 : { *(.strtab) } \ 832 .shstrtab 0 : { *(.shstrtab) } 833 | |
834#ifdef CONFIG_GENERIC_BUG 835#define BUG_TABLE \ 836 . = ALIGN(8); \ 837 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \ 838 __start___bug_table = .; \ 839 KEEP(*(__bug_table)) \ 840 __stop___bug_table = .; \ 841 } --- 117 unchanged lines hidden (view full) --- 959#ifdef RUNTIME_DISCARD_EXIT 960#define EXIT_DISCARDS 961#else 962#define EXIT_DISCARDS \ 963 EXIT_TEXT \ 964 EXIT_DATA 965#endif 966 | 832#ifdef CONFIG_GENERIC_BUG 833#define BUG_TABLE \ 834 . = ALIGN(8); \ 835 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \ 836 __start___bug_table = .; \ 837 KEEP(*(__bug_table)) \ 838 __stop___bug_table = .; \ 839 } --- 117 unchanged lines hidden (view full) --- 957#ifdef RUNTIME_DISCARD_EXIT 958#define EXIT_DISCARDS 959#else 960#define EXIT_DISCARDS \ 961 EXIT_TEXT \ 962 EXIT_DATA 963#endif 964 |
967/* 968 * Clang's -fsanitize=kernel-address and -fsanitize=thread produce 969 * unwanted sections (.eh_frame and .init_array.*), but 970 * CONFIG_CONSTRUCTORS wants to keep any .init_array.* sections. 971 * https://bugs.llvm.org/show_bug.cgi?id=46478 972 */ 973#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KCSAN) 974# ifdef CONFIG_CONSTRUCTORS 975# define SANITIZER_DISCARDS \ 976 *(.eh_frame) 977# else 978# define SANITIZER_DISCARDS \ 979 *(.init_array) *(.init_array.*) \ 980 *(.eh_frame) 981# endif 982#else 983# define SANITIZER_DISCARDS 984#endif 985 986#define COMMON_DISCARDS \ 987 SANITIZER_DISCARDS \ 988 *(.discard) \ 989 *(.discard.*) \ 990 *(.modinfo) \ 991 /* ld.bfd warns about .gnu.version* even when not emitted */ \ 992 *(.gnu.version*) \ 993 | |
994#define DISCARDS \ 995 /DISCARD/ : { \ 996 EXIT_DISCARDS \ 997 EXIT_CALL \ | 965#define DISCARDS \ 966 /DISCARD/ : { \ 967 EXIT_DISCARDS \ 968 EXIT_CALL \ |
998 COMMON_DISCARDS \ | 969 *(.discard) \ 970 *(.discard.*) \ 971 *(.modinfo) \ |
999 } 1000 1001/** 1002 * PERCPU_INPUT - the percpu input sections 1003 * @cacheline: cacheline size 1004 * 1005 * The core percpu section names and core symbols which do not rely 1006 * directly upon load addresses. --- 123 unchanged lines hidden --- | 972 } 973 974/** 975 * PERCPU_INPUT - the percpu input sections 976 * @cacheline: cacheline size 977 * 978 * The core percpu section names and core symbols which do not rely 979 * directly upon load addresses. --- 123 unchanged lines hidden --- |