2017-11-01 15:07:57 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2006-02-02 14:31:16 +00:00
|
|
|
#include <asm/asm-offsets.h>
|
2012-07-19 09:11:14 +02:00
|
|
|
#include <asm/thread_info.h>
|
2012-08-14 11:08:01 -07:00
|
|
|
|
2012-12-28 15:15:25 +01:00
|
|
|
#define PAGE_SIZE _PAGE_SIZE
|
|
|
|
|
|
2012-08-14 11:08:01 -07:00
|
|
|
/*
|
|
|
|
|
* Put .bss..swapper_pg_dir as the first thing in .bss. This will
|
|
|
|
|
* ensure that it has .bss alignment (64K).
|
|
|
|
|
*/
|
|
|
|
|
#define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir)
|
|
|
|
|
|
2019-10-29 14:13:30 -07:00
|
|
|
/* Cavium Octeon should not have a separate PT_NOTE Program Header. */
|
|
|
|
|
#ifndef CONFIG_CAVIUM_OCTEON_SOC
|
|
|
|
|
#define EMITS_PT_NOTE
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-04-08 21:33:48 +01:00
|
|
|
#define RUNTIME_DISCARD_EXIT
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#include <asm-generic/vmlinux.lds.h>
|
|
|
|
|
|
2006-04-05 09:45:45 +01:00
|
|
|
#undef mips
|
2005-04-16 15:20:36 -07:00
|
|
|
#define mips mips
|
|
|
|
|
OUTPUT_ARCH(mips)
|
|
|
|
|
ENTRY(kernel_entry)
|
2007-10-14 22:49:01 +01:00
|
|
|
PHDRS {
|
|
|
|
|
text PT_LOAD FLAGS(7); /* RWX */
|
2015-10-30 00:54:48 +02:00
|
|
|
#ifndef CONFIG_CAVIUM_OCTEON_SOC
|
2007-10-14 22:49:01 +01:00
|
|
|
note PT_NOTE FLAGS(4); /* R__ */
|
2015-10-30 00:54:48 +02:00
|
|
|
#endif /* CAVIUM_OCTEON_SOC */
|
2007-10-14 22:49:01 +01:00
|
|
|
}
|
2009-09-20 12:28:22 +02:00
|
|
|
|
2009-09-24 21:44:24 +02:00
|
|
|
#ifdef CONFIG_32BIT
|
|
|
|
|
#ifdef CONFIG_CPU_LITTLE_ENDIAN
|
2013-01-22 12:59:30 +01:00
|
|
|
jiffies = jiffies_64;
|
2009-09-24 21:44:24 +02:00
|
|
|
#else
|
2013-01-22 12:59:30 +01:00
|
|
|
jiffies = jiffies_64 + 4;
|
2009-09-24 21:44:24 +02:00
|
|
|
#endif
|
|
|
|
|
#else
|
2013-01-22 12:59:30 +01:00
|
|
|
jiffies = jiffies_64;
|
2009-09-24 21:44:24 +02:00
|
|
|
#endif
|
2007-09-15 23:35:53 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
SECTIONS
|
|
|
|
|
{
|
|
|
|
|
#ifdef CONFIG_BOOT_ELF64
|
2007-09-15 23:35:53 +02:00
|
|
|
/* Read-only sections, merged into text segment: */
|
|
|
|
|
/* . = 0xc000000000000000; */
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-09-15 23:35:53 +02:00
|
|
|
/* This is the value for an Origin kernel, taken from an IRIX kernel. */
|
|
|
|
|
/* . = 0xc00000000001c000; */
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-09-15 23:35:53 +02:00
|
|
|
/* Set the vaddr for the text segment to a value
|
|
|
|
|
* >= 0xa800 0000 0001 9000 if no symmon is going to configured
|
|
|
|
|
* >= 0xa800 0000 0030 0000 otherwise
|
|
|
|
|
*/
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-09-15 23:35:53 +02:00
|
|
|
/* . = 0xa800000000300000; */
|
|
|
|
|
. = 0xffffffff80300000;
|
2005-04-16 15:20:36 -07:00
|
|
|
#endif
|
2020-05-06 13:52:45 +08:00
|
|
|
. = LINKER_LOAD_ADDRESS;
|
2007-09-15 23:35:53 +02:00
|
|
|
/* read-only */
|
|
|
|
|
_text = .; /* Text and read-only data */
|
|
|
|
|
.text : {
|
2024-11-26 09:34:09 -08:00
|
|
|
HEAD_TEXT
|
2007-09-15 23:35:53 +02:00
|
|
|
TEXT_TEXT
|
|
|
|
|
SCHED_TEXT
|
|
|
|
|
LOCK_TEXT
|
2007-10-14 22:50:05 +01:00
|
|
|
KPROBES_TEXT
|
2009-11-20 20:34:33 +08:00
|
|
|
IRQENTRY_TEXT
|
2016-03-25 14:22:05 -07:00
|
|
|
SOFTIRQENTRY_TEXT
|
2007-09-15 23:35:53 +02:00
|
|
|
*(.fixup)
|
|
|
|
|
*(.gnu.warning)
|
2021-01-10 11:56:41 +00:00
|
|
|
. = ALIGN(16);
|
|
|
|
|
*(.got) /* Global offset table */
|
2007-10-14 22:49:01 +01:00
|
|
|
} :text = 0
|
2007-09-15 23:35:53 +02:00
|
|
|
_etext = .; /* End of text section */
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-07-31 16:58:19 -04:00
|
|
|
EXCEPTION_TABLE(16)
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-09-15 23:35:53 +02:00
|
|
|
/* Exception table for data bus errors */
|
|
|
|
|
__dbe_table : {
|
|
|
|
|
__start___dbe_table = .;
|
2018-11-21 21:56:36 +00:00
|
|
|
KEEP(*(__dbe_table))
|
2007-09-15 23:35:53 +02:00
|
|
|
__stop___dbe_table = .;
|
|
|
|
|
}
|
2007-10-14 22:49:01 +01:00
|
|
|
|
2011-05-19 21:34:58 -04:00
|
|
|
_sdata = .; /* Start of data section */
|
2019-10-29 14:13:33 -07:00
|
|
|
RO_DATA(4096)
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-09-15 23:35:53 +02:00
|
|
|
/* writeable */
|
|
|
|
|
.data : { /* Data */
|
2007-10-18 23:12:32 +02:00
|
|
|
. = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-07-19 09:11:14 +02:00
|
|
|
INIT_TASK_DATA(THREAD_SIZE)
|
2009-07-31 16:58:19 -04:00
|
|
|
NOSAVE_DATA
|
2021-01-10 11:56:08 +00:00
|
|
|
PAGE_ALIGNED_DATA(PAGE_SIZE)
|
2009-07-31 16:58:19 -04:00
|
|
|
CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
|
2011-03-29 11:40:06 +01:00
|
|
|
READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
|
2007-10-18 23:12:32 +02:00
|
|
|
DATA_DATA
|
|
|
|
|
CONSTRUCTORS
|
2007-09-15 23:35:53 +02:00
|
|
|
}
|
2017-03-30 17:49:27 +02:00
|
|
|
BUG_TABLE
|
2007-09-15 23:35:53 +02:00
|
|
|
_gp = . + 0x8000;
|
|
|
|
|
.lit8 : {
|
|
|
|
|
*(.lit8)
|
|
|
|
|
}
|
|
|
|
|
.lit4 : {
|
|
|
|
|
*(.lit4)
|
|
|
|
|
}
|
|
|
|
|
/* We want the small data sections together, so single-instruction offsets
|
|
|
|
|
can access them all, and initialized data all before uninitialized, so
|
|
|
|
|
we can shorten the on-disk segment size. */
|
|
|
|
|
.sdata : {
|
|
|
|
|
*(.sdata)
|
|
|
|
|
}
|
|
|
|
|
_edata = .; /* End of data section */
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-09-15 23:35:53 +02:00
|
|
|
/* will be freed after init */
|
2009-07-31 16:58:18 -04:00
|
|
|
. = ALIGN(PAGE_SIZE); /* Init code and data */
|
2007-09-15 23:35:53 +02:00
|
|
|
__init_begin = .;
|
2009-07-31 16:58:19 -04:00
|
|
|
INIT_TEXT_SECTION(PAGE_SIZE)
|
|
|
|
|
INIT_DATA_SECTION(16)
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-11-23 16:06:25 +01:00
|
|
|
. = ALIGN(4);
|
|
|
|
|
.mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) {
|
|
|
|
|
__mips_machines_start = .;
|
2018-11-21 21:56:36 +00:00
|
|
|
KEEP(*(.mips.machines.init))
|
2010-11-23 16:06:25 +01:00
|
|
|
__mips_machines_end = .;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-15 23:35:53 +02:00
|
|
|
/* .exit.text is discarded at runtime, not link time, to deal with
|
|
|
|
|
* references from .rodata
|
|
|
|
|
*/
|
|
|
|
|
.exit.text : {
|
2008-01-20 14:15:03 +01:00
|
|
|
EXIT_TEXT
|
2007-09-15 23:35:53 +02:00
|
|
|
}
|
|
|
|
|
.exit.data : {
|
2008-01-20 14:15:03 +01:00
|
|
|
EXIT_DATA
|
2007-09-15 23:35:53 +02:00
|
|
|
}
|
2015-04-12 12:24:58 +02:00
|
|
|
#ifdef CONFIG_SMP
|
2011-03-24 18:50:09 +01:00
|
|
|
PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
|
2015-04-12 12:24:58 +02:00
|
|
|
#endif
|
2016-03-31 10:05:34 +01:00
|
|
|
|
2021-01-10 11:56:34 +00:00
|
|
|
.rel.dyn : ALIGN(8) {
|
|
|
|
|
*(.rel)
|
|
|
|
|
*(.rel*)
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-08 14:58:51 +02:00
|
|
|
#ifdef CONFIG_MIPS_ELF_APPENDED_DTB
|
2021-03-03 19:33:05 +00:00
|
|
|
STRUCT_ALIGN();
|
2019-03-08 14:58:51 +02:00
|
|
|
.appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
|
|
|
|
|
*(.appended_dtb)
|
|
|
|
|
KEEP(*(.appended_dtb))
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-03-31 10:05:34 +01:00
|
|
|
#ifdef CONFIG_RELOCATABLE
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
|
|
|
|
|
|
.data.reloc : {
|
|
|
|
|
_relocation_start = .;
|
|
|
|
|
/*
|
|
|
|
|
* Space for relocation table
|
|
|
|
|
* This needs to be filled so that the
|
|
|
|
|
* relocs tool can overwrite the content.
|
|
|
|
|
* An invalid value is left at the start of the
|
|
|
|
|
* section to abort relocation if the table
|
|
|
|
|
* has not been filled in.
|
|
|
|
|
*/
|
|
|
|
|
LONG(0xFFFFFFFF);
|
|
|
|
|
FILL(0);
|
|
|
|
|
. += CONFIG_RELOCATION_TABLE_SIZE - 4;
|
|
|
|
|
_relocation_end = .;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2015-04-12 12:24:58 +02:00
|
|
|
#ifdef CONFIG_MIPS_RAW_APPENDED_DTB
|
2021-03-07 19:23:01 +01:00
|
|
|
.fill : {
|
|
|
|
|
FILL(0);
|
|
|
|
|
BYTE(0);
|
2021-03-16 15:45:15 +00:00
|
|
|
STRUCT_ALIGN();
|
2021-03-07 19:23:01 +01:00
|
|
|
}
|
2015-04-12 12:24:58 +02:00
|
|
|
__appended_dtb = .;
|
|
|
|
|
/* leave space for appended DTB */
|
|
|
|
|
. += 0x100000;
|
|
|
|
|
#endif
|
2012-08-14 11:08:01 -07:00
|
|
|
/*
|
|
|
|
|
* Align to 64K in attempt to eliminate holes before the
|
|
|
|
|
* .bss..swapper_pg_dir section at the start of .bss. This
|
|
|
|
|
* also satisfies PAGE_SIZE alignment as the largest page size
|
|
|
|
|
* allowed is 64K.
|
|
|
|
|
*/
|
|
|
|
|
. = ALIGN(0x10000);
|
2007-09-15 23:35:53 +02:00
|
|
|
__init_end = .;
|
|
|
|
|
/* freed after init ends here */
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-08-14 11:08:01 -07:00
|
|
|
/*
|
|
|
|
|
* Force .bss to 64K alignment so that .bss..swapper_pg_dir
|
2013-01-22 12:59:30 +01:00
|
|
|
* gets that alignment. .sbss should be empty, so there will be
|
2012-08-14 11:08:01 -07:00
|
|
|
* no holes after __init_end. */
|
2016-11-07 11:52:19 +00:00
|
|
|
BSS_SECTION(0, 0x10000, 8)
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-09-15 23:35:53 +02:00
|
|
|
_end = . ;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-09-15 23:35:53 +02:00
|
|
|
/* These mark the ABI of the kernel for debuggers. */
|
|
|
|
|
.mdebug.abi32 : {
|
|
|
|
|
KEEP(*(.mdebug.abi32))
|
|
|
|
|
}
|
|
|
|
|
.mdebug.abi64 : {
|
|
|
|
|
KEEP(*(.mdebug.abi64))
|
|
|
|
|
}
|
2007-08-03 11:43:01 -04:00
|
|
|
|
2007-09-15 23:35:53 +02:00
|
|
|
/* This is the MIPS specific mdebug section. */
|
|
|
|
|
.mdebug : {
|
|
|
|
|
*(.mdebug)
|
|
|
|
|
}
|
2006-05-11 00:41:26 +09:00
|
|
|
|
2007-09-15 23:35:53 +02:00
|
|
|
STABS_DEBUG
|
|
|
|
|
DWARF_DEBUG
|
2026-02-25 15:02:51 -07:00
|
|
|
MODINFO
|
2020-08-21 12:42:45 -07:00
|
|
|
ELF_DETAILS
|
2006-05-10 15:36:04 +09:00
|
|
|
|
2007-09-15 23:35:53 +02:00
|
|
|
/* These must appear regardless of . */
|
|
|
|
|
.gptab.sdata : {
|
|
|
|
|
*(.gptab.data)
|
|
|
|
|
*(.gptab.sdata)
|
|
|
|
|
}
|
|
|
|
|
.gptab.sbss : {
|
|
|
|
|
*(.gptab.bss)
|
|
|
|
|
*(.gptab.sbss)
|
|
|
|
|
}
|
2009-07-09 11:27:40 +09:00
|
|
|
|
|
|
|
|
/* Sections to be discarded */
|
|
|
|
|
DISCARDS
|
|
|
|
|
/DISCARD/ : {
|
|
|
|
|
/* ABI crap starts here */
|
2015-10-30 00:54:47 +02:00
|
|
|
*(.MIPS.abiflags)
|
2009-07-09 11:27:40 +09:00
|
|
|
*(.MIPS.options)
|
2021-01-10 11:56:22 +00:00
|
|
|
*(.gnu.attributes)
|
2009-07-09 11:27:40 +09:00
|
|
|
*(.options)
|
|
|
|
|
*(.pdr)
|
|
|
|
|
*(.reginfo)
|
|
|
|
|
}
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|