1/* 2 * Copyright (C) 2012 Regents of the University of California 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation, version 2. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 */ 13 14OUTPUT_ARCH(riscv) 15 16SECTIONS 17{ 18 . = SIZEOF_HEADERS; 19 20 .hash : { *(.hash) } :text 21 .gnu.hash : { *(.gnu.hash) } 22 .dynsym : { *(.dynsym) } 23 .dynstr : { *(.dynstr) } 24 .gnu.version : { *(.gnu.version) } 25 .gnu.version_d : { *(.gnu.version_d) } 26 .gnu.version_r : { *(.gnu.version_r) } 27 28 .note : { *(.note.*) } :text :note 29 .dynamic : { *(.dynamic) } :text :dynamic 30 31 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr 32 .eh_frame : { KEEP (*(.eh_frame)) } :text 33 34 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 35 36 /* 37 * This linker script is used both with -r and with -shared. 38 * For the layouts to match, we need to skip more than enough 39 * space for the dynamic symbol table, etc. If this amount is 40 * insufficient, ld -shared will error; simply increase it here. 41 */ 42 . = 0x800; 43 .text : { *(.text .text.*) } :text 44 45 .data : { 46 *(.got.plt) *(.got) 47 *(.data .data.* .gnu.linkonce.d.*) 48 *(.dynbss) 49 *(.bss .bss.* .gnu.linkonce.b.*) 50 } 51} 52 53/* 54 * We must supply the ELF program headers explicitly to get just one 55 * PT_LOAD segment, and set the flags explicitly to make segments read-only. 56 */ 57PHDRS 58{ 59 text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */ 60 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 61 note PT_NOTE FLAGS(4); /* PF_R */ 62 eh_frame_hdr PT_GNU_EH_FRAME; 63} 64 65/* 66 * This controls what symbols we export from the DSO. 67 */ 68VERSION 69{ 70 LINUX_4.15 { 71 global: 72 __vdso_rt_sigreturn; 73 __vdso_gettimeofday; 74 __vdso_clock_gettime; 75 __vdso_clock_getres; 76 __vdso_getcpu; 77 __vdso_flush_icache; 78 local: *; 79 }; 80} 81