Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* ld script to make s390 Linux kernel
0003  * Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
0004  */
0005 
0006 #include <asm/thread_info.h>
0007 #include <asm/page.h>
0008 #include <asm/ftrace.lds.h>
0009 
0010 /*
0011  * Put .bss..swapper_pg_dir as the first thing in .bss. This will
0012  * make sure it has 16k alignment.
0013  */
0014 #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir) \
0015                *(.bss..invalid_pg_dir)
0016 
0017 /* Handle ro_after_init data on our own. */
0018 #define RO_AFTER_INIT_DATA
0019 
0020 #define EMITS_PT_NOTE
0021 
0022 #include <asm-generic/vmlinux.lds.h>
0023 #include <asm/vmlinux.lds.h>
0024 
0025 OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
0026 OUTPUT_ARCH(s390:64-bit)
0027 ENTRY(startup_continue)
0028 jiffies = jiffies_64;
0029 
0030 PHDRS {
0031     text PT_LOAD FLAGS(5);  /* R_E */
0032     data PT_LOAD FLAGS(7);  /* RWE */
0033     note PT_NOTE FLAGS(0);  /* ___ */
0034 }
0035 
0036 SECTIONS
0037 {
0038     . = 0x100000;
0039     .text : {
0040         _stext = .;     /* Start of text section */
0041         _text = .;      /* Text and read-only data */
0042         HEAD_TEXT
0043         TEXT_TEXT
0044         SCHED_TEXT
0045         CPUIDLE_TEXT
0046         LOCK_TEXT
0047         KPROBES_TEXT
0048         IRQENTRY_TEXT
0049         SOFTIRQENTRY_TEXT
0050         FTRACE_HOTPATCH_TRAMPOLINES_TEXT
0051         *(.text.*_indirect_*)
0052         *(.gnu.warning)
0053         . = ALIGN(PAGE_SIZE);
0054         _etext = .;     /* End of text section */
0055     } :text = 0x0700
0056 
0057     RO_DATA(PAGE_SIZE)
0058 
0059     . = ALIGN(PAGE_SIZE);
0060     _sdata = .;     /* Start of data section */
0061 
0062     . = ALIGN(PAGE_SIZE);
0063     __start_ro_after_init = .;
0064     .data..ro_after_init : {
0065          *(.data..ro_after_init)
0066         JUMP_TABLE_DATA
0067     } :data
0068     EXCEPTION_TABLE(16)
0069     . = ALIGN(PAGE_SIZE);
0070     __end_ro_after_init = .;
0071 
0072     RW_DATA(0x100, PAGE_SIZE, THREAD_SIZE)
0073     BOOT_DATA_PRESERVED
0074 
0075     . = ALIGN(8);
0076     .amode31.refs : {
0077         _start_amode31_refs = .;
0078         *(.amode31.refs)
0079         _end_amode31_refs = .;
0080     }
0081 
0082     _edata = .;     /* End of data section */
0083 
0084     /* will be freed after init */
0085     . = ALIGN(PAGE_SIZE);   /* Init code and data */
0086     __init_begin = .;
0087 
0088     . = ALIGN(PAGE_SIZE);
0089     .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
0090         _sinittext = .;
0091         INIT_TEXT
0092         . = ALIGN(PAGE_SIZE);
0093         _einittext = .;
0094     }
0095 
0096     /*
0097      * .exit.text is discarded at runtime, not link time,
0098      * to deal with references from __bug_table
0099     */
0100     .exit.text : {
0101         EXIT_TEXT
0102     }
0103 
0104     .exit.data : {
0105         EXIT_DATA
0106     }
0107 
0108     /*
0109      * struct alt_inst entries. From the header (alternative.h):
0110      * "Alternative instructions for different CPU types or capabilities"
0111      * Think locking instructions on spinlocks.
0112      * Note, that it is a part of __init region.
0113      */
0114     . = ALIGN(8);
0115     .altinstructions : {
0116         __alt_instructions = .;
0117         *(.altinstructions)
0118         __alt_instructions_end = .;
0119     }
0120 
0121     /*
0122      * And here are the replacement instructions. The linker sticks
0123      * them as binary blobs. The .altinstructions has enough data to
0124      * get the address and the length of them to patch the kernel safely.
0125      * Note, that it is a part of __init region.
0126      */
0127     .altinstr_replacement : {
0128         *(.altinstr_replacement)
0129     }
0130 
0131     /*
0132      * Table with the patch locations to undo expolines
0133     */
0134     . = ALIGN(4);
0135     .nospec_call_table : {
0136         __nospec_call_start = . ;
0137         *(.s390_indirect*)
0138         __nospec_call_end = . ;
0139     }
0140     .nospec_return_table : {
0141         __nospec_return_start = . ;
0142         *(.s390_return*)
0143         __nospec_return_end = . ;
0144     }
0145 
0146     BOOT_DATA
0147 
0148     /*
0149      * .amode31 section for code, data, ex_table that need to stay
0150      * below 2 GB, even when the kernel is relocated above 2 GB.
0151      */
0152     . = ALIGN(PAGE_SIZE);
0153     _samode31 = .;
0154     .amode31.text : {
0155         _stext_amode31 = .;
0156         *(.amode31.text)
0157         *(.amode31.text.*_indirect_*)
0158         . = ALIGN(PAGE_SIZE);
0159         _etext_amode31 = .;
0160     }
0161     . = ALIGN(16);
0162     .amode31.ex_table : {
0163         _start_amode31_ex_table = .;
0164         KEEP(*(.amode31.ex_table))
0165         _stop_amode31_ex_table = .;
0166     }
0167     . = ALIGN(PAGE_SIZE);
0168     .amode31.data : {
0169         *(.amode31.data)
0170     }
0171     . = ALIGN(PAGE_SIZE);
0172     _eamode31 = .;
0173 
0174     /* early.c uses stsi, which requires page aligned data. */
0175     . = ALIGN(PAGE_SIZE);
0176     INIT_DATA_SECTION(0x100)
0177 
0178     PERCPU_SECTION(0x100)
0179 
0180     .dynsym ALIGN(8) : {
0181         __dynsym_start = .;
0182         *(.dynsym)
0183         __dynsym_end = .;
0184     }
0185     .rela.dyn ALIGN(8) : {
0186         __rela_dyn_start = .;
0187         *(.rela*)
0188         __rela_dyn_end = .;
0189     }
0190 
0191     . = ALIGN(PAGE_SIZE);
0192     __init_end = .;     /* freed after init ends here */
0193 
0194     BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE)
0195 
0196     _end = . ;
0197 
0198     /*
0199      * uncompressed image info used by the decompressor
0200      * it should match struct vmlinux_info
0201      */
0202     .vmlinux.info 0 (INFO) : {
0203         QUAD(_stext)                    /* default_lma */
0204         QUAD(startup_continue)              /* entry */
0205         QUAD(__bss_start - _stext)          /* image_size */
0206         QUAD(__bss_stop - __bss_start)          /* bss_size */
0207         QUAD(__boot_data_start)             /* bootdata_off */
0208         QUAD(__boot_data_end - __boot_data_start)   /* bootdata_size */
0209         QUAD(__boot_data_preserved_start)       /* bootdata_preserved_off */
0210         QUAD(__boot_data_preserved_end -
0211              __boot_data_preserved_start)       /* bootdata_preserved_size */
0212         QUAD(__dynsym_start)                /* dynsym_start */
0213         QUAD(__rela_dyn_start)              /* rela_dyn_start */
0214         QUAD(__rela_dyn_end)                /* rela_dyn_end */
0215         QUAD(_eamode31 - _samode31)         /* amode31_size */
0216     } :NONE
0217 
0218     /* Debugging sections.  */
0219     STABS_DEBUG
0220     DWARF_DEBUG
0221     ELF_DETAILS
0222 
0223     /* Sections to be discarded */
0224     DISCARDS
0225     /DISCARD/ : {
0226         *(.eh_frame)
0227     }
0228 }