Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #include <asm/asm-offsets.h>
0003 #include <asm/thread_info.h>
0004 
0005 #define PAGE_SIZE _PAGE_SIZE
0006 
0007 /*
0008  * Put .bss..swapper_pg_dir as the first thing in .bss. This will
0009  * ensure that it has .bss alignment (64K).
0010  */
0011 #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir)
0012 
0013 /* Cavium Octeon should not have a separate PT_NOTE Program Header. */
0014 #ifndef CONFIG_CAVIUM_OCTEON_SOC
0015 #define EMITS_PT_NOTE
0016 #endif
0017 
0018 #include <asm-generic/vmlinux.lds.h>
0019 
0020 #undef mips
0021 #define mips mips
0022 OUTPUT_ARCH(mips)
0023 ENTRY(kernel_entry)
0024 PHDRS {
0025     text PT_LOAD FLAGS(7);  /* RWX */
0026 #ifndef CONFIG_CAVIUM_OCTEON_SOC
0027     note PT_NOTE FLAGS(4);  /* R__ */
0028 #endif /* CAVIUM_OCTEON_SOC */
0029 }
0030 
0031 #ifdef CONFIG_32BIT
0032     #ifdef CONFIG_CPU_LITTLE_ENDIAN
0033         jiffies  = jiffies_64;
0034     #else
0035         jiffies  = jiffies_64 + 4;
0036     #endif
0037 #else
0038     jiffies  = jiffies_64;
0039 #endif
0040 
0041 SECTIONS
0042 {
0043 #ifdef CONFIG_BOOT_ELF64
0044     /* Read-only sections, merged into text segment: */
0045     /* . = 0xc000000000000000; */
0046 
0047     /* This is the value for an Origin kernel, taken from an IRIX kernel.  */
0048     /* . = 0xc00000000001c000; */
0049 
0050     /* Set the vaddr for the text segment to a value
0051      *   >= 0xa800 0000 0001 9000 if no symmon is going to configured
0052      *   >= 0xa800 0000 0030 0000 otherwise
0053      */
0054 
0055     /* . = 0xa800000000300000; */
0056     . = 0xffffffff80300000;
0057 #endif
0058     . = LINKER_LOAD_ADDRESS;
0059     /* read-only */
0060     _text = .;  /* Text and read-only data */
0061     .text : {
0062         TEXT_TEXT
0063         SCHED_TEXT
0064         CPUIDLE_TEXT
0065         LOCK_TEXT
0066         KPROBES_TEXT
0067         IRQENTRY_TEXT
0068         SOFTIRQENTRY_TEXT
0069         *(.fixup)
0070         *(.gnu.warning)
0071         . = ALIGN(16);
0072         *(.got) /* Global offset table */
0073     } :text = 0
0074     _etext = .; /* End of text section */
0075 
0076     EXCEPTION_TABLE(16)
0077 
0078     /* Exception table for data bus errors */
0079     __dbe_table : {
0080         __start___dbe_table = .;
0081         KEEP(*(__dbe_table))
0082         __stop___dbe_table = .;
0083     }
0084 
0085     _sdata = .;         /* Start of data section */
0086     RO_DATA(4096)
0087 
0088     /* writeable */
0089     .data : {   /* Data */
0090         . = . + DATAOFFSET;     /* for CONFIG_MAPPED_KERNEL */
0091 
0092         INIT_TASK_DATA(THREAD_SIZE)
0093         NOSAVE_DATA
0094         PAGE_ALIGNED_DATA(PAGE_SIZE)
0095         CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
0096         READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
0097         DATA_DATA
0098         CONSTRUCTORS
0099     }
0100     BUG_TABLE
0101     _gp = . + 0x8000;
0102     .lit8 : {
0103         *(.lit8)
0104     }
0105     .lit4 : {
0106         *(.lit4)
0107     }
0108     /* We want the small data sections together, so single-instruction offsets
0109        can access them all, and initialized data all before uninitialized, so
0110        we can shorten the on-disk segment size.  */
0111     .sdata : {
0112         *(.sdata)
0113     }
0114     _edata =  .;            /* End of data section */
0115 
0116     /* will be freed after init */
0117     . = ALIGN(PAGE_SIZE);       /* Init code and data */
0118     __init_begin = .;
0119     INIT_TEXT_SECTION(PAGE_SIZE)
0120     INIT_DATA_SECTION(16)
0121 
0122     . = ALIGN(4);
0123     .mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) {
0124         __mips_machines_start = .;
0125         KEEP(*(.mips.machines.init))
0126         __mips_machines_end = .;
0127     }
0128 
0129     /* .exit.text is discarded at runtime, not link time, to deal with
0130      * references from .rodata
0131      */
0132     .exit.text : {
0133         EXIT_TEXT
0134     }
0135     .exit.data : {
0136         EXIT_DATA
0137     }
0138 #ifdef CONFIG_SMP
0139     PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
0140 #endif
0141 
0142     .rel.dyn : ALIGN(8) {
0143         *(.rel)
0144         *(.rel*)
0145     }
0146 
0147 #ifdef CONFIG_MIPS_ELF_APPENDED_DTB
0148     STRUCT_ALIGN();
0149     .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
0150         *(.appended_dtb)
0151         KEEP(*(.appended_dtb))
0152     }
0153 #endif
0154 
0155 #ifdef CONFIG_RELOCATABLE
0156     . = ALIGN(4);
0157 
0158     .data.reloc : {
0159         _relocation_start = .;
0160         /*
0161          * Space for relocation table
0162          * This needs to be filled so that the
0163          * relocs tool can overwrite the content.
0164          * An invalid value is left at the start of the
0165          * section to abort relocation if the table
0166          * has not been filled in.
0167          */
0168         LONG(0xFFFFFFFF);
0169         FILL(0);
0170         . += CONFIG_RELOCATION_TABLE_SIZE - 4;
0171         _relocation_end = .;
0172     }
0173 #endif
0174 
0175 #ifdef CONFIG_MIPS_RAW_APPENDED_DTB
0176     .fill : {
0177         FILL(0);
0178         BYTE(0);
0179         STRUCT_ALIGN();
0180     }
0181     __appended_dtb = .;
0182     /* leave space for appended DTB */
0183     . += 0x100000;
0184 #endif
0185     /*
0186      * Align to 64K in attempt to eliminate holes before the
0187      * .bss..swapper_pg_dir section at the start of .bss.  This
0188      * also satisfies PAGE_SIZE alignment as the largest page size
0189      * allowed is 64K.
0190      */
0191     . = ALIGN(0x10000);
0192     __init_end = .;
0193     /* freed after init ends here */
0194 
0195     /*
0196      * Force .bss to 64K alignment so that .bss..swapper_pg_dir
0197      * gets that alignment.  .sbss should be empty, so there will be
0198      * no holes after __init_end. */
0199     BSS_SECTION(0, 0x10000, 8)
0200 
0201     _end = . ;
0202 
0203     /* These mark the ABI of the kernel for debuggers.  */
0204     .mdebug.abi32 : {
0205         KEEP(*(.mdebug.abi32))
0206     }
0207     .mdebug.abi64 : {
0208         KEEP(*(.mdebug.abi64))
0209     }
0210 
0211     /* This is the MIPS specific mdebug section.  */
0212     .mdebug : {
0213         *(.mdebug)
0214     }
0215 
0216     STABS_DEBUG
0217     DWARF_DEBUG
0218     ELF_DETAILS
0219 
0220     /* These must appear regardless of  .  */
0221     .gptab.sdata : {
0222         *(.gptab.data)
0223         *(.gptab.sdata)
0224     }
0225     .gptab.sbss : {
0226         *(.gptab.bss)
0227         *(.gptab.sbss)
0228     }
0229 
0230     /* Sections to be discarded */
0231     DISCARDS
0232     /DISCARD/ : {
0233         /* ABI crap starts here */
0234         *(.MIPS.abiflags)
0235         *(.MIPS.options)
0236         *(.gnu.attributes)
0237         *(.options)
0238         *(.pdr)
0239         *(.reginfo)
0240     }
0241 }