^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Linker script for vsyscall DSO. The vsyscall page is an ELF shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * object prelinked to its virtual address, and with only one read-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * segment (that fits in one page). This script controls its layout.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <asm/asm-offsets.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #ifdef CONFIG_CPU_LITTLE_ENDIAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) OUTPUT_FORMAT("elf32-shbig-linux", "elf32-shbig-linux", "elf32-shbig-linux")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) OUTPUT_ARCH(sh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /* The ELF entry point can be used to set the AT_SYSINFO value. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) ENTRY(__kernel_vsyscall);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) SECTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) . = SIZEOF_HEADERS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) .hash : { *(.hash) } :text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) .gnu.hash : { *(.gnu.hash) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) .dynsym : { *(.dynsym) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) .dynstr : { *(.dynstr) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) .gnu.version : { *(.gnu.version) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) .gnu.version_d : { *(.gnu.version_d) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .gnu.version_r : { *(.gnu.version_r) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * This linker script is used both with -r and with -shared.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * For the layouts to match, we need to skip more than enough
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * space for the dynamic symbol table et al. If this amount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * is insufficient, ld -shared will barf. Just increase it here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) . = 0x400;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) .text : { *(.text) } :text =0x90909090
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) .note : { *(.note.*) } :text :note
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) .eh_frame_hdr : { *(.eh_frame_hdr ) } :text :eh_frame_hdr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) .eh_frame : {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) KEEP (*(.eh_frame))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) LONG (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) } :text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) .dynamic : { *(.dynamic) } :text :dynamic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) .useless : {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) *(.got.plt) *(.got)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) *(.data .data.* .gnu.linkonce.d.*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) *(.dynbss)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) *(.bss .bss.* .gnu.linkonce.b.*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) } :text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * Very old versions of ld do not recognize this name token; use the constant.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define PT_GNU_EH_FRAME 0x6474e550
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * We must supply the ELF program headers explicitly to get just one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * PT_LOAD segment, and set the flags explicitly to make segments read-only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) PHDRS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) note PT_NOTE FLAGS(4); /* PF_R */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) eh_frame_hdr PT_GNU_EH_FRAME;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * This controls what symbols we export from the DSO.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) LINUX_2.6 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) global:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) __kernel_vsyscall;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) __kernel_sigreturn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) __kernel_rt_sigreturn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) local: *;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) }