GNU Linux-libre 5.4.274-gnu1
[releases.git] / arch / arm64 / kernel / vdso / vdso.lds.S
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
15 OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", "elf64-littleaarch64")
16 OUTPUT_ARCH(aarch64)
17
18 SECTIONS
19 {
20         PROVIDE(_vdso_data = . - PAGE_SIZE);
21         . = VDSO_LBASE + SIZEOF_HEADERS;
22
23         .hash           : { *(.hash) }                  :text
24         .gnu.hash       : { *(.gnu.hash) }
25         .dynsym         : { *(.dynsym) }
26         .dynstr         : { *(.dynstr) }
27         .gnu.version    : { *(.gnu.version) }
28         .gnu.version_d  : { *(.gnu.version_d) }
29         .gnu.version_r  : { *(.gnu.version_r) }
30
31         /*
32          * Discard .note.gnu.property sections which are unused and have
33          * different alignment requirement from vDSO note sections.
34          */
35         /DISCARD/       : {
36                 *(.note.GNU-stack .note.gnu.property)
37         }
38         .note           : { *(.note.*) }                :text   :note
39
40         . = ALIGN(16);
41
42         .text           : { *(.text*) }                 :text   =0xd503201f
43         PROVIDE (__etext = .);
44         PROVIDE (_etext = .);
45         PROVIDE (etext = .);
46
47         .eh_frame_hdr   : { *(.eh_frame_hdr) }          :text   :eh_frame_hdr
48         .eh_frame       : { KEEP (*(.eh_frame)) }       :text
49
50         .dynamic        : { *(.dynamic) }               :text   :dynamic
51
52         .rodata         : { *(.rodata*) }               :text
53
54         _end = .;
55         PROVIDE(end = .);
56
57         /DISCARD/       : {
58                 *(.data .data.* .gnu.linkonce.d.* .sdata*)
59                 *(.bss .sbss .dynbss .dynsbss)
60         }
61 }
62
63 /*
64  * We must supply the ELF program headers explicitly to get just one
65  * PT_LOAD segment, and set the flags explicitly to make segments read-only.
66  */
67 PHDRS
68 {
69         text            PT_LOAD         FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
70         dynamic         PT_DYNAMIC      FLAGS(4);               /* PF_R */
71         note            PT_NOTE         FLAGS(4);               /* PF_R */
72         eh_frame_hdr    PT_GNU_EH_FRAME;
73 }
74
75 /*
76  * This controls what symbols we export from the DSO.
77  */
78 VERSION
79 {
80         LINUX_2.6.39 {
81         global:
82                 __kernel_rt_sigreturn;
83                 __kernel_gettimeofday;
84                 __kernel_clock_gettime;
85                 __kernel_clock_getres;
86         local: *;
87         };
88 }
89
90 /*
91  * Make the sigreturn code visible to the kernel.
92  */
93 VDSO_sigtramp           = __kernel_rt_sigreturn;