2017-11-01 15:07:57 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-16 15:20:36 -07:00
|
|
|
/* ld script to make ARM Linux kernel
|
|
|
|
|
* taken from the i386 version by Russell King
|
|
|
|
|
* Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
|
|
|
|
|
*/
|
|
|
|
|
|
2016-02-03 15:58:10 +01:00
|
|
|
#ifdef CONFIG_XIP_KERNEL
|
|
|
|
|
#include "vmlinux-xip.lds.S"
|
|
|
|
|
#else
|
|
|
|
|
|
2020-06-08 21:32:42 -07:00
|
|
|
#include <linux/pgtable.h>
|
2020-08-21 12:42:56 -07:00
|
|
|
#include <asm/vmlinux.lds.h>
|
2012-01-20 11:55:54 +01:00
|
|
|
#include <asm/cache.h>
|
2005-05-05 13:11:00 +01:00
|
|
|
#include <asm/thread_info.h>
|
2009-06-24 23:38:56 +01:00
|
|
|
#include <asm/page.h>
|
2022-06-02 10:18:32 +02:00
|
|
|
#include <asm/mpu.h>
|
2015-03-23 10:52:57 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
OUTPUT_ARCH(arm)
|
|
|
|
|
ENTRY(stext)
|
2005-10-29 21:44:56 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#ifndef __ARMEB__
|
|
|
|
|
jiffies = jiffies_64;
|
|
|
|
|
#else
|
|
|
|
|
jiffies = jiffies_64 + 4;
|
|
|
|
|
#endif
|
2005-10-29 21:44:56 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
SECTIONS
|
|
|
|
|
{
|
2011-05-26 11:25:33 +01:00
|
|
|
/*
|
2011-09-20 23:35:15 +01:00
|
|
|
* XXX: The linker does not define how output sections are
|
|
|
|
|
* assigned to input sections when there are multiple statements
|
|
|
|
|
* matching the same input section name. There is no documented
|
|
|
|
|
* order of matching.
|
|
|
|
|
*
|
2011-05-26 11:25:33 +01:00
|
|
|
* unwind exit sections must be discarded before the rest of the
|
|
|
|
|
* unwind sections get included.
|
|
|
|
|
*/
|
|
|
|
|
/DISCARD/ : {
|
2018-03-05 16:34:03 -05:00
|
|
|
ARM_DISCARD
|
2011-05-26 11:25:33 +01:00
|
|
|
#ifndef CONFIG_SMP_ON_UP
|
|
|
|
|
*(.alt.smp.init)
|
2020-09-28 15:48:54 -07:00
|
|
|
#endif
|
|
|
|
|
#ifndef CONFIG_ARM_UNWIND
|
|
|
|
|
*(.ARM.exidx) *(.ARM.exidx.*)
|
|
|
|
|
*(.ARM.extab) *(.ARM.extab.*)
|
2011-05-26 11:25:33 +01:00
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-03 09:50:16 +01:00
|
|
|
. = KERNEL_OFFSET + TEXT_OFFSET;
|
2011-07-05 22:56:41 +01:00
|
|
|
.head.text : {
|
2011-07-06 10:53:22 +01:00
|
|
|
_text = .;
|
2011-07-05 22:56:41 +01:00
|
|
|
HEAD_TEXT
|
|
|
|
|
}
|
2014-04-03 17:28:11 -07:00
|
|
|
|
2017-02-06 16:31:58 -08:00
|
|
|
#ifdef CONFIG_STRICT_KERNEL_RWX
|
2014-04-03 17:28:11 -07:00
|
|
|
. = ALIGN(1<<SECTION_SHIFT);
|
|
|
|
|
#endif
|
|
|
|
|
|
2018-04-03 10:39:23 +01:00
|
|
|
#ifdef CONFIG_ARM_MPU
|
|
|
|
|
. = ALIGN(PMSAv8_MINALIGN);
|
|
|
|
|
#endif
|
2011-07-06 10:39:34 +01:00
|
|
|
.text : { /* Real text segment */
|
2011-07-06 10:53:22 +01:00
|
|
|
_stext = .; /* Text and read-only data */
|
2018-03-05 16:34:03 -05:00
|
|
|
ARM_TEXT
|
2011-07-06 10:39:34 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-26 01:19:36 +01:00
|
|
|
#ifdef CONFIG_DEBUG_ALIGN_RODATA
|
2014-04-03 13:29:50 -07:00
|
|
|
. = ALIGN(1<<SECTION_SHIFT);
|
|
|
|
|
#endif
|
2016-06-23 21:28:47 +01:00
|
|
|
_etext = .; /* End of text section */
|
|
|
|
|
|
2011-07-06 10:39:34 +01:00
|
|
|
RO_DATA(PAGE_SIZE)
|
|
|
|
|
|
2012-10-29 19:19:34 +01:00
|
|
|
. = ALIGN(4);
|
|
|
|
|
__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
|
|
|
|
|
__start___ex_table = .;
|
2025-01-14 14:45:38 +01:00
|
|
|
ARM_MMU_KEEP(*(__ex_table))
|
2012-10-29 19:19:34 +01:00
|
|
|
__stop___ex_table = .;
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-06 10:39:34 +01:00
|
|
|
#ifdef CONFIG_ARM_UNWIND
|
2018-03-01 17:32:28 -05:00
|
|
|
ARM_UNWIND_SECTIONS
|
2011-07-06 10:39:34 +01:00
|
|
|
#endif
|
|
|
|
|
|
2017-02-06 16:31:58 -08:00
|
|
|
#ifdef CONFIG_STRICT_KERNEL_RWX
|
2014-04-03 17:28:11 -07:00
|
|
|
. = ALIGN(1<<SECTION_SHIFT);
|
2016-02-03 15:58:10 +01:00
|
|
|
#else
|
2011-07-06 10:39:34 +01:00
|
|
|
. = ALIGN(PAGE_SIZE);
|
|
|
|
|
#endif
|
2016-02-03 15:58:10 +01:00
|
|
|
__init_begin = .;
|
|
|
|
|
|
2018-03-01 22:17:03 -05:00
|
|
|
ARM_VECTORS
|
2011-07-05 22:56:41 +01:00
|
|
|
INIT_TEXT_SECTION(8)
|
|
|
|
|
.exit.text : {
|
|
|
|
|
ARM_EXIT_KEEP(EXIT_TEXT)
|
|
|
|
|
}
|
|
|
|
|
.init.proc.info : {
|
2010-10-01 15:37:05 +01:00
|
|
|
ARM_CPU_DISCARD(PROC_INFO)
|
2011-07-05 22:56:41 +01:00
|
|
|
}
|
|
|
|
|
.init.arch.info : {
|
2005-04-16 15:20:36 -07:00
|
|
|
__arch_info_begin = .;
|
2024-06-03 16:37:50 +01:00
|
|
|
KEEP(*(.arch.info.init))
|
2005-04-16 15:20:36 -07:00
|
|
|
__arch_info_end = .;
|
2011-07-05 22:56:41 +01:00
|
|
|
}
|
|
|
|
|
.init.tagtable : {
|
2005-04-16 15:20:36 -07:00
|
|
|
__tagtable_begin = .;
|
2011-07-05 22:56:41 +01:00
|
|
|
*(.taglist.init)
|
2005-04-16 15:20:36 -07:00
|
|
|
__tagtable_end = .;
|
2011-07-05 22:56:41 +01:00
|
|
|
}
|
2010-09-04 10:47:48 +01:00
|
|
|
#ifdef CONFIG_SMP_ON_UP
|
2011-07-05 22:56:41 +01:00
|
|
|
.init.smpalt : {
|
2010-09-04 10:47:48 +01:00
|
|
|
__smpalt_begin = .;
|
2011-07-05 22:56:41 +01:00
|
|
|
*(.alt.smp.init)
|
2010-09-04 10:47:48 +01:00
|
|
|
__smpalt_end = .;
|
2011-07-05 22:56:41 +01:00
|
|
|
}
|
2010-09-04 10:47:48 +01:00
|
|
|
#endif
|
2011-07-05 22:56:41 +01:00
|
|
|
.init.pv_table : {
|
2011-01-04 19:09:43 +00:00
|
|
|
__pv_table_begin = .;
|
2024-06-03 16:37:50 +01:00
|
|
|
KEEP(*(.pv_table))
|
2011-01-04 19:09:43 +00:00
|
|
|
__pv_table_end = .;
|
2011-07-05 22:56:41 +01:00
|
|
|
}
|
2017-08-29 16:33:57 -04:00
|
|
|
|
|
|
|
|
INIT_DATA_SECTION(16)
|
|
|
|
|
|
2011-07-05 22:56:41 +01:00
|
|
|
.exit.data : {
|
|
|
|
|
ARM_EXIT_KEEP(EXIT_DATA)
|
|
|
|
|
}
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-06-20 22:52:24 +01:00
|
|
|
#ifdef CONFIG_SMP
|
2012-01-20 11:55:54 +01:00
|
|
|
PERCPU_SECTION(L1_CACHE_BYTES)
|
2012-06-20 22:52:24 +01:00
|
|
|
#endif
|
2009-10-02 16:32:47 -04:00
|
|
|
|
2018-03-08 21:12:04 -05:00
|
|
|
#ifdef CONFIG_HAVE_TCM
|
|
|
|
|
ARM_TCM
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-02-06 16:31:58 -08:00
|
|
|
#ifdef CONFIG_STRICT_KERNEL_RWX
|
2014-04-03 17:28:11 -07:00
|
|
|
. = ALIGN(1<<SECTION_SHIFT);
|
2005-04-16 15:20:36 -07:00
|
|
|
#else
|
2021-09-23 09:15:53 +02:00
|
|
|
. = ALIGN(THREAD_ALIGN);
|
2014-04-03 17:28:11 -07:00
|
|
|
#endif
|
2014-09-26 03:30:59 +01:00
|
|
|
__init_end = .;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-08-29 16:33:57 -04:00
|
|
|
_sdata = .;
|
2021-09-23 09:15:53 +02:00
|
|
|
RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN)
|
2017-08-29 16:33:57 -04:00
|
|
|
_edata = .;
|
2017-03-30 17:49:27 +02:00
|
|
|
|
2009-10-02 16:32:47 -04:00
|
|
|
BSS_SECTION(0, 0, 0)
|
2018-04-03 10:39:23 +01:00
|
|
|
#ifdef CONFIG_ARM_MPU
|
|
|
|
|
. = ALIGN(PMSAv8_MINALIGN);
|
|
|
|
|
#endif
|
2009-10-02 16:32:47 -04:00
|
|
|
_end = .;
|
|
|
|
|
|
|
|
|
|
STABS_DEBUG
|
2020-08-21 12:42:58 -07:00
|
|
|
DWARF_DEBUG
|
2026-02-25 15:02:51 -07:00
|
|
|
MODINFO
|
2020-08-21 12:42:57 -07:00
|
|
|
ARM_DETAILS
|
2020-08-21 12:42:59 -07:00
|
|
|
|
|
|
|
|
ARM_ASSERTS
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
|
2017-02-06 16:31:58 -08:00
|
|
|
#ifdef CONFIG_STRICT_KERNEL_RWX
|
2016-01-26 01:20:21 +01:00
|
|
|
/*
|
|
|
|
|
* Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will
|
|
|
|
|
* be the first section-aligned location after __start_rodata. Otherwise,
|
|
|
|
|
* it will be equal to __start_rodata.
|
|
|
|
|
*/
|
|
|
|
|
__start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT);
|
2016-02-19 16:41:55 +01:00
|
|
|
#endif
|
2016-01-26 01:20:21 +01:00
|
|
|
|
2005-11-17 16:43:14 +00:00
|
|
|
/*
|
|
|
|
|
* These must never be empty
|
|
|
|
|
* If you have to comment these two assert statements out, your
|
|
|
|
|
* binutils is too old (for other reasons as well)
|
|
|
|
|
*/
|
2005-04-16 15:20:36 -07:00
|
|
|
ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
|
2021-10-18 15:30:10 +01:00
|
|
|
#ifndef CONFIG_COMPILE_TEST
|
2005-04-16 15:20:36 -07:00
|
|
|
ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
|
2021-10-18 15:30:10 +01:00
|
|
|
#endif
|
2015-03-19 16:42:26 +00:00
|
|
|
|
2016-02-03 15:58:10 +01:00
|
|
|
#endif /* CONFIG_XIP_KERNEL */
|