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