Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* ld script to make ARM Linux kernel
0003  * taken from the i386 version by Russell King
0004  * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
0005  */
0006 
0007 #ifdef CONFIG_XIP_KERNEL
0008 #include "vmlinux-xip.lds.S"
0009 #else
0010 
0011 #include <linux/pgtable.h>
0012 #include <asm/vmlinux.lds.h>
0013 #include <asm/cache.h>
0014 #include <asm/thread_info.h>
0015 #include <asm/memory.h>
0016 #include <asm/mpu.h>
0017 #include <asm/page.h>
0018 
0019 OUTPUT_ARCH(arm)
0020 ENTRY(stext)
0021 
0022 #ifndef __ARMEB__
0023 jiffies = jiffies_64;
0024 #else
0025 jiffies = jiffies_64 + 4;
0026 #endif
0027 
0028 SECTIONS
0029 {
0030     /*
0031      * XXX: The linker does not define how output sections are
0032      * assigned to input sections when there are multiple statements
0033      * matching the same input section name.  There is no documented
0034      * order of matching.
0035      *
0036      * unwind exit sections must be discarded before the rest of the
0037      * unwind sections get included.
0038      */
0039     /DISCARD/ : {
0040         ARM_DISCARD
0041 #ifndef CONFIG_SMP_ON_UP
0042         *(.alt.smp.init)
0043 #endif
0044 #ifndef CONFIG_ARM_UNWIND
0045         *(.ARM.exidx) *(.ARM.exidx.*)
0046         *(.ARM.extab) *(.ARM.extab.*)
0047 #endif
0048     }
0049 
0050     . = KERNEL_OFFSET + TEXT_OFFSET;
0051     .head.text : {
0052         _text = .;
0053         HEAD_TEXT
0054     }
0055 
0056 #ifdef CONFIG_STRICT_KERNEL_RWX
0057     . = ALIGN(1<<SECTION_SHIFT);
0058 #endif
0059 
0060 #ifdef CONFIG_ARM_MPU
0061     . = ALIGN(PMSAv8_MINALIGN);
0062 #endif
0063     .text : {           /* Real text segment        */
0064         _stext = .;     /* Text and read-only data  */
0065         ARM_TEXT
0066     }
0067 
0068 #ifdef CONFIG_DEBUG_ALIGN_RODATA
0069     . = ALIGN(1<<SECTION_SHIFT);
0070 #endif
0071     _etext = .;         /* End of text section */
0072 
0073     RO_DATA(PAGE_SIZE)
0074 
0075     . = ALIGN(4);
0076     __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
0077         __start___ex_table = .;
0078         ARM_MMU_KEEP(*(__ex_table))
0079         __stop___ex_table = .;
0080     }
0081 
0082 #ifdef CONFIG_ARM_UNWIND
0083     ARM_UNWIND_SECTIONS
0084 #endif
0085 
0086 #ifdef CONFIG_STRICT_KERNEL_RWX
0087     . = ALIGN(1<<SECTION_SHIFT);
0088 #else
0089     . = ALIGN(PAGE_SIZE);
0090 #endif
0091     __init_begin = .;
0092 
0093     ARM_VECTORS
0094     INIT_TEXT_SECTION(8)
0095     .exit.text : {
0096         ARM_EXIT_KEEP(EXIT_TEXT)
0097     }
0098     .init.proc.info : {
0099         ARM_CPU_DISCARD(PROC_INFO)
0100     }
0101     .init.arch.info : {
0102         __arch_info_begin = .;
0103         *(.arch.info.init)
0104         __arch_info_end = .;
0105     }
0106     .init.tagtable : {
0107         __tagtable_begin = .;
0108         *(.taglist.init)
0109         __tagtable_end = .;
0110     }
0111 #ifdef CONFIG_SMP_ON_UP
0112     .init.smpalt : {
0113         __smpalt_begin = .;
0114         *(.alt.smp.init)
0115         __smpalt_end = .;
0116     }
0117 #endif
0118     .init.pv_table : {
0119         __pv_table_begin = .;
0120         *(.pv_table)
0121         __pv_table_end = .;
0122     }
0123 
0124     INIT_DATA_SECTION(16)
0125 
0126     .exit.data : {
0127         ARM_EXIT_KEEP(EXIT_DATA)
0128     }
0129 
0130 #ifdef CONFIG_SMP
0131     PERCPU_SECTION(L1_CACHE_BYTES)
0132 #endif
0133 
0134 #ifdef CONFIG_HAVE_TCM
0135     ARM_TCM
0136 #endif
0137 
0138 #ifdef CONFIG_STRICT_KERNEL_RWX
0139     . = ALIGN(1<<SECTION_SHIFT);
0140 #else
0141     . = ALIGN(THREAD_ALIGN);
0142 #endif
0143     __init_end = .;
0144 
0145     _sdata = .;
0146     RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN)
0147     _edata = .;
0148 
0149     BSS_SECTION(0, 0, 0)
0150 #ifdef CONFIG_ARM_MPU
0151     . = ALIGN(PMSAv8_MINALIGN);
0152 #endif
0153     _end = .;
0154 
0155     STABS_DEBUG
0156     DWARF_DEBUG
0157     ARM_DETAILS
0158 
0159     ARM_ASSERTS
0160 }
0161 
0162 #ifdef CONFIG_STRICT_KERNEL_RWX
0163 /*
0164  * Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will
0165  * be the first section-aligned location after __start_rodata. Otherwise,
0166  * it will be equal to __start_rodata.
0167  */
0168 __start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT);
0169 #endif
0170 
0171 /*
0172  * These must never be empty
0173  * If you have to comment these two assert statements out, your
0174  * binutils is too old (for other reasons as well)
0175  */
0176 ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
0177 #ifndef CONFIG_COMPILE_TEST
0178 ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
0179 #endif
0180 
0181 #endif /* CONFIG_XIP_KERNEL */