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 .plt : { 56 *(.plt) 57 *(.plt.*) 58 *(.iplt) 59 *(.igot .igot.plt) 60 } 61 62 .got : { *(.got) } 63 .got.plt : { *(.got.plt) } 64 65 .rodata : { *(.rodata*) } :text 66 67 _end = .; 68 PROVIDE(end = .); 69 70 DWARF_DEBUG 71 ELF_DETAILS 72 73 /DISCARD/ : { 74 *(.data .data.* .gnu.linkonce.d.* .sdata*) 75 *(.bss .sbss .dynbss .dynsbss) 76 *(.eh_frame .eh_frame_hdr) 77 } 78} 79 80/* 81 * We must supply the ELF program headers explicitly to get just one 82 * PT_LOAD segment, and set the flags explicitly to make segments read-only. 83 */ 84PHDRS 85{ 86 text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */ 87 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 88 note PT_NOTE FLAGS(4); /* PF_R */ 89} 90 91/* 92 * This controls what symbols we export from the DSO. 93 */ 94VERSION 95{ 96 LINUX_2.6.39 { 97 global: 98 __kernel_rt_sigreturn; 99 __kernel_gettimeofday; 100 __kernel_clock_gettime; 101 __kernel_clock_getres; 102 local: *; 103 }; 104} 105 106/* 107 * Make the sigreturn code visible to the kernel. 108 */ 109VDSO_sigtramp = __kernel_rt_sigreturn; 110