1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * GNU linker script for the VDSO library. 4* 5 * Copyright (C) 2012 ARM Limited 6 * 7 * Author: Will Deacon <will.deacon@arm.com> 8 * Heavily based on the vDSO linker scripts for other archs. 9 */ 10 11#include <linux/const.h> 12#include <asm/page.h> 13#include <asm/vdso.h> 14#include <asm-generic/vmlinux.lds.h> 15 16OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", "elf64-littleaarch64") 17OUTPUT_ARCH(aarch64) 18 19SECTIONS 20{ 21 PROVIDE(_vdso_data = . - __VVAR_PAGES * PAGE_SIZE); 22#ifdef CONFIG_TIME_NS 23 PROVIDE(_timens_data = _vdso_data + PAGE_SIZE); 24#endif 25 . = VDSO_LBASE + SIZEOF_HEADERS; 26 27 .hash : { *(.hash) } :text 28 .gnu.hash : { *(.gnu.hash) } 29 .dynsym : { *(.dynsym) } 30 .dynstr : { *(.dynstr) } 31 .gnu.version : { *(.gnu.version) } 32 .gnu.version_d : { *(.gnu.version_d) } 33 .gnu.version_r : { *(.gnu.version_r) } 34 35 /* 36 * Discard .note.gnu.property sections which are unused and have 37 * different alignment requirement from vDSO note sections. 38 */ 39 /DISCARD/ : { 40 *(.note.GNU-stack .note.gnu.property) 41 } 42 .note : { *(.note.*) } :text :note 43 44 . = ALIGN(16); 45 46 .text : { *(.text*) } :text =0xd503201f 47 PROVIDE (__etext = .); 48 PROVIDE (_etext = .); 49 PROVIDE (etext = .); 50 51 .dynamic : { *(.dynamic) } :text :dynamic 52 53 .rela.dyn : ALIGN(8) { *(.rela .rela*) } 54 55 .rodata : { 56 *(.rodata*) 57 *(.got) 58 *(.got.plt) 59 *(.plt) 60 *(.plt.*) 61 *(.iplt) 62 *(.igot .igot.plt) 63 } :text 64 65 _end = .; 66 PROVIDE(end = .); 67 68 DWARF_DEBUG 69 ELF_DETAILS 70 71 /DISCARD/ : { 72 *(.data .data.* .gnu.linkonce.d.* .sdata*) 73 *(.bss .sbss .dynbss .dynsbss) 74 *(.eh_frame .eh_frame_hdr) 75 } 76} 77 78/* 79 * We must supply the ELF program headers explicitly to get just one 80 * PT_LOAD segment, and set the flags explicitly to make segments read-only. 81 */ 82PHDRS 83{ 84 text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */ 85 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 86 note PT_NOTE FLAGS(4); /* PF_R */ 87} 88 89/* 90 * This controls what symbols we export from the DSO. 91 */ 92VERSION 93{ 94 LINUX_2.6.39 { 95 global: 96 __kernel_rt_sigreturn; 97 __kernel_gettimeofday; 98 __kernel_clock_gettime; 99 __kernel_clock_getres; 100 local: *; 101 }; 102} 103 104/* 105 * Make the sigreturn code visible to the kernel. 106 */ 107VDSO_sigtramp = __kernel_rt_sigreturn; 108