xref: /openbmc/linux/arch/x86/boot/compressed/vmlinux.lds.S (revision c595db6d7c8bcf87ef42204391fa890e5950e566)
1b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */
21dc818c1STim Abbott#include <asm-generic/vmlinux.lds.h>
31dc818c1STim Abbott
4e6d7bc0bSBorislav PetkovOUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT)
551b26adaSLinus Torvalds
683c48326SSam Ravnborg#undef i386
783c48326SSam Ravnborg
8350f8f56SJan Beulich#include <asm/cache.h>
95b11f1ceSH. Peter Anvin#include <asm/page_types.h>
105b11f1ceSH. Peter Anvin
1151b26adaSLinus Torvalds#ifdef CONFIG_X86_64
1251b26adaSLinus TorvaldsOUTPUT_ARCH(i386:x86-64)
1351b26adaSLinus TorvaldsENTRY(startup_64)
1451b26adaSLinus Torvalds#else
1551b26adaSLinus TorvaldsOUTPUT_ARCH(i386)
1651b26adaSLinus TorvaldsENTRY(startup_32)
1751b26adaSLinus Torvalds#endif
1851b26adaSLinus Torvalds
1951b26adaSLinus TorvaldsSECTIONS
2051b26adaSLinus Torvalds{
2151b26adaSLinus Torvalds	/* Be careful parts of head_64.S assume startup_32 is at
2251b26adaSLinus Torvalds	 * address 0.
2351b26adaSLinus Torvalds	 */
2451b26adaSLinus Torvalds	. = 0;
251dc818c1STim Abbott	.head.text : {
2651b26adaSLinus Torvalds		_head = . ;
271dc818c1STim Abbott		HEAD_TEXT
2851b26adaSLinus Torvalds		_ehead = . ;
2951b26adaSLinus Torvalds	}
30041d5f94SDenys Vlasenko	.rodata..compressed : {
31041d5f94SDenys Vlasenko		*(.rodata..compressed)
3251b26adaSLinus Torvalds	}
3351b26adaSLinus Torvalds	.text :	{
3451b26adaSLinus Torvalds		_text = .; 	/* Text */
3551b26adaSLinus Torvalds		*(.text)
3651b26adaSLinus Torvalds		*(.text.*)
37c3982c1aSPeter Zijlstra		*(.noinstr.text)
3851b26adaSLinus Torvalds		_etext = . ;
3951b26adaSLinus Torvalds	}
4051b26adaSLinus Torvalds	.rodata : {
4151b26adaSLinus Torvalds		_rodata = . ;
4251b26adaSLinus Torvalds		*(.rodata)	 /* read-only data */
4351b26adaSLinus Torvalds		*(.rodata.*)
4451b26adaSLinus Torvalds		_erodata = . ;
4551b26adaSLinus Torvalds	}
46*686b58ceSArd Biesheuvel	.data :	ALIGN(0x1000) {
4751b26adaSLinus Torvalds		_data = . ;
4851b26adaSLinus Torvalds		*(.data)
4951b26adaSLinus Torvalds		*(.data.*)
500cf3d613SArd Biesheuvel
510cf3d613SArd Biesheuvel		/* Add 4 bytes of extra space for a CRC-32 checksum */
52*686b58ceSArd Biesheuvel		. = ALIGN(. + 4, 0x200);
5351b26adaSLinus Torvalds		_edata = . ;
5451b26adaSLinus Torvalds	}
55350f8f56SJan Beulich	. = ALIGN(L1_CACHE_BYTES);
5651b26adaSLinus Torvalds	.bss : {
5751b26adaSLinus Torvalds		_bss = . ;
5851b26adaSLinus Torvalds		*(.bss)
5951b26adaSLinus Torvalds		*(.bss.*)
6051b26adaSLinus Torvalds		*(COMMON)
615b11f1ceSH. Peter Anvin		. = ALIGN(8);	/* For convenience during zeroing */
6251b26adaSLinus Torvalds		_ebss = .;
6351b26adaSLinus Torvalds	}
645b11f1ceSH. Peter Anvin#ifdef CONFIG_X86_64
655b11f1ceSH. Peter Anvin       . = ALIGN(PAGE_SIZE);
665b11f1ceSH. Peter Anvin       .pgtable : {
675b11f1ceSH. Peter Anvin		_pgtable = . ;
685b11f1ceSH. Peter Anvin		*(.pgtable)
695b11f1ceSH. Peter Anvin		_epgtable = . ;
705b11f1ceSH. Peter Anvin	}
715b11f1ceSH. Peter Anvin#endif
72974f221cSYinghai Lu	. = ALIGN(PAGE_SIZE);	/* keep ZO size page aligned */
735b11f1ceSH. Peter Anvin	_end = .;
74d6ee6529SFangrui Song
75414d2ff5SKees Cook	STABS_DEBUG
76414d2ff5SKees Cook	DWARF_DEBUG
77c604abc3SKees Cook	ELF_DETAILS
78c604abc3SKees Cook
79d6ee6529SFangrui Song	DISCARDS
80d1c0272bSKees Cook	/DISCARD/ : {
81d1c0272bSKees Cook		*(.dynamic) *(.dynsym) *(.dynstr) *(.dynbss)
82d1c0272bSKees Cook		*(.hash) *(.gnu.hash)
83d1c0272bSKees Cook		*(.note.*)
84d1c0272bSKees Cook	}
857cf891a4SKees Cook
867cf891a4SKees Cook	.got.plt (INFO) : {
877cf891a4SKees Cook		*(.got.plt)
8851b26adaSLinus Torvalds	}
897cf891a4SKees Cook	ASSERT(SIZEOF(.got.plt) == 0 ||
90262b5caeSArd Biesheuvel#ifdef CONFIG_X86_64
917cf891a4SKees Cook	       SIZEOF(.got.plt) == 0x18,
92262b5caeSArd Biesheuvel#else
937cf891a4SKees Cook	       SIZEOF(.got.plt) == 0xc,
94262b5caeSArd Biesheuvel#endif
957cf891a4SKees Cook	       "Unexpected GOT/PLT entries detected!")
96527afc21SArvind Sankar
977cf891a4SKees Cook	/*
987cf891a4SKees Cook	 * Sections that should stay zero sized, which is safer to
997cf891a4SKees Cook	 * explicitly check instead of blindly discarding.
1007cf891a4SKees Cook	 */
1017cf891a4SKees Cook	.got : {
1027cf891a4SKees Cook		*(.got)
1037cf891a4SKees Cook	}
1047cf891a4SKees Cook	ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!")
1057cf891a4SKees Cook
106d1c0272bSKees Cook	.plt : {
107d1c0272bSKees Cook		*(.plt) *(.plt.*)
108d1c0272bSKees Cook	}
109d1c0272bSKees Cook	ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!")
110d1c0272bSKees Cook
1117cf891a4SKees Cook	.rel.dyn : {
112d1c0272bSKees Cook		*(.rel.*) *(.rel_*)
1137cf891a4SKees Cook	}
1147cf891a4SKees Cook	ASSERT(SIZEOF(.rel.dyn) == 0, "Unexpected run-time relocations (.rel) detected!")
1157cf891a4SKees Cook
1167cf891a4SKees Cook	.rela.dyn : {
117d1c0272bSKees Cook		*(.rela.*) *(.rela_*)
1187cf891a4SKees Cook	}
1197cf891a4SKees Cook	ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!")
1207cf891a4SKees Cook}
121