include/asm-generic/vmlinux.lds.h

Source file repositories/reference/linux-study-clean/include/asm-generic/vmlinux.lds.h

File Facts

System
Linux kernel
Corpus path
include/asm-generic/vmlinux.lds.h
Extension
.h
Size
34304 bytes
Lines
1179
Domain
Repository Root And Misc
Bucket
include
Inferred role
Repository Root And Misc: implementation source
Status
source implementation candidate

Why This File Exists

Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.

Dependency Surface

Detected Declarations

Annotated Snippet

#include <asm-generic/codetag.lds.h>

#ifndef LOAD_OFFSET
#define LOAD_OFFSET 0
#endif

/*
 * Only some architectures want to have the .notes segment visible in
 * a separate PT_NOTE ELF Program Header. When this happens, it needs
 * to be visible in both the kernel text's PT_LOAD and the PT_NOTE
 * Program Headers. In this case, though, the PT_LOAD needs to be made
 * the default again so that all the following sections don't also end
 * up in the PT_NOTE Program Header.
 */
#ifdef EMITS_PT_NOTE
#define NOTES_HEADERS		:text :note
#define NOTES_HEADERS_RESTORE	__restore_ph : { *(.__restore_ph) } :text
#else
#define NOTES_HEADERS
#define NOTES_HEADERS_RESTORE
#endif

/*
 * Some architectures have non-executable read-only exception tables.
 * They can be added to the RO_DATA segment by specifying their desired
 * alignment.
 */
#ifdef RO_EXCEPTION_TABLE_ALIGN
#define RO_EXCEPTION_TABLE	EXCEPTION_TABLE(RO_EXCEPTION_TABLE_ALIGN)
#else
#define RO_EXCEPTION_TABLE
#endif

/* Align . function alignment. */
#define ALIGN_FUNCTION()  . = ALIGN(CONFIG_FUNCTION_ALIGNMENT)

/*
 * Support -ffunction-sections by matching .text and .text.*,
 * but exclude '.text..*', .text.startup[.*], and .text.exit[.*].
 *
 * .text.startup and .text.startup.* are matched later by INIT_TEXT, and
 * .text.exit and .text.exit.* are matched later by EXIT_TEXT, so they must be
 * explicitly excluded here.
 *
 * Other .text.* sections that are typically grouped separately, such as
 * .text.unlikely or .text.hot, must be matched explicitly before using
 * TEXT_MAIN.
 *
 * NOTE: builds *with* and *without* -ffunction-sections are both supported by
 * this single macro.  Even with -ffunction-sections, there may be some objects
 * NOT compiled with the flag due to the use of a specific Makefile override
 * like cflags-y or AUTOFDO_PROFILE_foo.o.  So this single catchall rule is
 * needed to support mixed object builds.
 *
 * One implication is that functions named startup(), exit(), split(),
 * unlikely(), hot(), and unknown() are not allowed in the kernel due to the
 * ambiguity of their section names with -ffunction-sections.  For example,
 * .text.startup could be __attribute__((constructor)) code in a *non*
 * ffunction-sections object, which should be placed in .init.text; or it could
 * be an actual function named startup() in an ffunction-sections object, which
 * should be placed in .text.  The build will detect and complain about any such
 * ambiguously named functions.
 */
#define TEXT_MAIN							\
	.text								\
	.text.[_0-9A-Za-df-rt-z]*					\
	.text.s[_0-9A-Za-su-z]*		.text.s		.text.s.*	\
	.text.st[_0-9A-Zb-z]*		.text.st	.text.st.*	\
	.text.sta[_0-9A-Za-qs-z]*	.text.sta	.text.sta.*	\
	.text.star[_0-9A-Za-su-z]*	.text.star	.text.star.*	\
	.text.start[_0-9A-Za-tv-z]*	.text.start	.text.start.*	\
	.text.startu[_0-9A-Za-oq-z]*	.text.startu	.text.startu.*	\
	.text.startup[_0-9A-Za-z]*					\
	.text.e[_0-9A-Za-wy-z]*		.text.e		.text.e.*	\
	.text.ex[_0-9A-Za-hj-z]*	.text.ex	.text.ex.*	\
	.text.exi[_0-9A-Za-su-z]*	.text.exi	.text.exi.*	\
	.text.exit[_0-9A-Za-z]*

/*
 * Support -fdata-sections by matching .data, .data.*, and others,
 * but exclude '.data..*'.
 */
#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data.rel.* .data..L* .data..compoundliteral* .data.$__unnamed_* .data.$L*
#define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* .rodata..L*
#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..L* .bss..compoundliteral*
#define SBSS_MAIN .sbss .sbss.[0-9a-zA-Z_]*

/*
 * GCC 4.5 and later have a 32 bytes section alignment for structures.

Annotation

Implementation Notes