xref: /openbmc/qemu/linux-user/riscv/vdso.ld (revision bf616ce4)
1/*
2 * Linker script for linux riscv replacement vdso.
3 *
4 * Copyright 2021 Linaro, Ltd.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9VERSION {
10        LINUX_4.15 {
11        global:
12                __vdso_rt_sigreturn;
13                __vdso_gettimeofday;
14                __vdso_clock_gettime;
15                __vdso_clock_getres;
16                __vdso_getcpu;
17                __vdso_flush_icache;
18
19        local: *;
20        };
21}
22
23
24PHDRS {
25        phdr            PT_PHDR         FLAGS(4) PHDRS;
26        load            PT_LOAD         FLAGS(7) FILEHDR PHDRS;
27        dynamic         PT_DYNAMIC      FLAGS(4);
28        eh_frame_hdr    PT_GNU_EH_FRAME;
29        note            PT_NOTE         FLAGS(4);
30}
31
32SECTIONS {
33        /*
34         * We can't prelink to any address without knowing something about
35         * the virtual memory space of the host, since that leaks over into
36         * the available memory space of the guest.
37         */
38        . = SIZEOF_HEADERS;
39
40        /*
41         * The following, including the FILEHDRS and PHDRS, are modified
42         * when we relocate the binary.  We want them to be initially
43         * writable for the relocation; we'll force them read-only after.
44         */
45        .note           : { *(.note*) }         :load :note
46        .dynamic        : { *(.dynamic) }       :load :dynamic
47        .dynsym         : { *(.dynsym) }        :load
48        /*
49         * There ought not be any real read-write data.
50         * But since we manipulated the segment layout,
51         * we have to put these sections somewhere.
52         */
53        .data           : {
54                *(.data*)
55                *(.sdata*)
56                *(.got.plt) *(.got)
57                *(.gnu.linkonce.d.*)
58                *(.bss*)
59                *(.dynbss*)
60                *(.gnu.linkonce.b.*)
61        }
62
63        .rodata         : { *(.rodata*) }
64        .hash           : { *(.hash) }
65        .gnu.hash       : { *(.gnu.hash) }
66        .dynstr         : { *(.dynstr) }
67        .gnu.version    : { *(.gnu.version) }
68        .gnu.version_d  : { *(.gnu.version_d) }
69        .gnu.version_r  : { *(.gnu.version_r) }
70        .eh_frame_hdr   : { *(.eh_frame_hdr) }  :load :eh_frame_hdr
71        .eh_frame       : { *(.eh_frame) }      :load
72
73        .text           : { *(.text*) }         :load   =0xd503201f
74}
75