1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * This is the infamous ld script for the 32 bits vdso 4 * library 5 */ 6#include <asm/vdso.h> 7 8#ifdef __LITTLE_ENDIAN__ 9OUTPUT_FORMAT("elf32-powerpcle", "elf32-powerpcle", "elf32-powerpcle") 10#else 11OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") 12#endif 13OUTPUT_ARCH(powerpc:common) 14ENTRY(_start) 15 16SECTIONS 17{ 18 . = VDSO32_LBASE + 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 30 . = ALIGN(16); 31 .text : { 32 *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*) 33 } :text 34 PROVIDE(__etext = .); 35 PROVIDE(_etext = .); 36 PROVIDE(etext = .); 37 38 . = ALIGN(8); 39 __ftr_fixup : { *(__ftr_fixup) } 40 41 . = ALIGN(8); 42 __mmu_ftr_fixup : { *(__mmu_ftr_fixup) } 43 44 . = ALIGN(8); 45 __lwsync_fixup : { *(__lwsync_fixup) } 46 47#ifdef CONFIG_PPC64 48 . = ALIGN(8); 49 __fw_ftr_fixup : { *(__fw_ftr_fixup) } 50#endif 51 52 /* 53 * Other stuff is appended to the text segment: 54 */ 55 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 56 .rodata1 : { *(.rodata1) } 57 58 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr 59 .eh_frame : { KEEP (*(.eh_frame)) } :text 60 .gcc_except_table : { *(.gcc_except_table) } 61 .fixup : { *(.fixup) } 62 63 .dynamic : { *(.dynamic) } :text :dynamic 64 .got : { *(.got) } :text 65 .plt : { *(.plt) } 66 67 _end = .; 68 __end = .; 69 PROVIDE(end = .); 70 71 /* 72 * Stabs debugging sections are here too. 73 */ 74 .stab 0 : { *(.stab) } 75 .stabstr 0 : { *(.stabstr) } 76 .stab.excl 0 : { *(.stab.excl) } 77 .stab.exclstr 0 : { *(.stab.exclstr) } 78 .stab.index 0 : { *(.stab.index) } 79 .stab.indexstr 0 : { *(.stab.indexstr) } 80 .comment 0 : { *(.comment) } 81 82 /* 83 * DWARF debug sections. 84 * Symbols in the DWARF debugging sections are relative to the beginning 85 * of the section so we begin them at 0. 86 */ 87 /* DWARF 1 */ 88 .debug 0 : { *(.debug) } 89 .line 0 : { *(.line) } 90 /* GNU DWARF 1 extensions */ 91 .debug_srcinfo 0 : { *(.debug_srcinfo) } 92 .debug_sfnames 0 : { *(.debug_sfnames) } 93 /* DWARF 1.1 and DWARF 2 */ 94 .debug_aranges 0 : { *(.debug_aranges) } 95 .debug_pubnames 0 : { *(.debug_pubnames) } 96 /* DWARF 2 */ 97 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 98 .debug_abbrev 0 : { *(.debug_abbrev) } 99 .debug_line 0 : { *(.debug_line) } 100 .debug_frame 0 : { *(.debug_frame) } 101 .debug_str 0 : { *(.debug_str) } 102 .debug_loc 0 : { *(.debug_loc) } 103 .debug_macinfo 0 : { *(.debug_macinfo) } 104 /* SGI/MIPS DWARF 2 extensions */ 105 .debug_weaknames 0 : { *(.debug_weaknames) } 106 .debug_funcnames 0 : { *(.debug_funcnames) } 107 .debug_typenames 0 : { *(.debug_typenames) } 108 .debug_varnames 0 : { *(.debug_varnames) } 109 110 /DISCARD/ : { 111 *(.note.GNU-stack) 112 *(.data .data.* .gnu.linkonce.d.* .sdata*) 113 *(.bss .sbss .dynbss .dynsbss) 114 } 115} 116 117/* 118 * Very old versions of ld do not recognize this name token; use the constant. 119 */ 120#define PT_GNU_EH_FRAME 0x6474e550 121 122/* 123 * We must supply the ELF program headers explicitly to get just one 124 * PT_LOAD segment, and set the flags explicitly to make segments read-only. 125 */ 126PHDRS 127{ 128 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ 129 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 130 note PT_NOTE FLAGS(4); /* PF_R */ 131 eh_frame_hdr PT_GNU_EH_FRAME; 132} 133 134/* 135 * This controls what symbols we export from the DSO. 136 */ 137VERSION 138{ 139 VDSO_VERSION_STRING { 140 global: 141 /* 142 * Has to be there for the kernel to find 143 */ 144 __kernel_datapage_offset; 145 146 __kernel_get_syscall_map; 147#ifndef CONFIG_PPC_BOOK3S_601 148 __kernel_gettimeofday; 149 __kernel_clock_gettime; 150 __kernel_clock_getres; 151 __kernel_time; 152 __kernel_get_tbfreq; 153#endif 154 __kernel_sync_dicache; 155 __kernel_sync_dicache_p5; 156 __kernel_sigtramp32; 157 __kernel_sigtramp_rt32; 158#ifdef CONFIG_PPC64 159 __kernel_getcpu; 160#endif 161 162 local: *; 163 }; 164} 165