| 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 | #include <asm/page.h> |
| 8 | #include <asm-generic/vmlinux.lds.h> |
| 9 | #include <vdso/datapage.h> |
| 10 | |
| 11 | #ifdef __LITTLE_ENDIAN__ |
| 12 | OUTPUT_FORMAT("elf32-powerpcle" , "elf32-powerpcle" , "elf32-powerpcle" ) |
| 13 | #else |
| 14 | OUTPUT_FORMAT("elf32-powerpc" , "elf32-powerpc" , "elf32-powerpc" ) |
| 15 | #endif |
| 16 | OUTPUT_ARCH(powerpc:common) |
| 17 | |
| 18 | SECTIONS |
| 19 | { |
| 20 | VDSO_VVAR_SYMS |
| 21 | |
| 22 | . = SIZEOF_HEADERS; |
| 23 | |
| 24 | .hash : { *(.hash) } :text |
| 25 | .gnu.hash : { *(.gnu.hash) } |
| 26 | .dynsym : { *(.dynsym) } |
| 27 | .dynstr : { *(.dynstr) } |
| 28 | .gnu.version : { *(.gnu.version) } |
| 29 | .gnu.version_d : { *(.gnu.version_d) } |
| 30 | .gnu.version_r : { *(.gnu.version_r) } |
| 31 | |
| 32 | .note : { *(.note.*) } :text :note |
| 33 | |
| 34 | . = ALIGN(16); |
| 35 | .text : { |
| 36 | *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*) |
| 37 | } :text |
| 38 | PROVIDE(__etext = .); |
| 39 | PROVIDE(_etext = .); |
| 40 | PROVIDE(etext = .); |
| 41 | |
| 42 | . = ALIGN(8); |
| 43 | VDSO_ftr_fixup_start = .; |
| 44 | __ftr_fixup : { *(__ftr_fixup) } |
| 45 | VDSO_ftr_fixup_end = .; |
| 46 | |
| 47 | . = ALIGN(8); |
| 48 | VDSO_mmu_ftr_fixup_start = .; |
| 49 | __mmu_ftr_fixup : { *(__mmu_ftr_fixup) } |
| 50 | VDSO_mmu_ftr_fixup_end = .; |
| 51 | |
| 52 | . = ALIGN(8); |
| 53 | VDSO_lwsync_fixup_start = .; |
| 54 | __lwsync_fixup : { *(__lwsync_fixup) } |
| 55 | VDSO_lwsync_fixup_end = .; |
| 56 | |
| 57 | #ifdef CONFIG_PPC64 |
| 58 | . = ALIGN(8); |
| 59 | VDSO_fw_ftr_fixup_start = .; |
| 60 | __fw_ftr_fixup : { *(__fw_ftr_fixup) } |
| 61 | VDSO_fw_ftr_fixup_end = .; |
| 62 | #endif |
| 63 | |
| 64 | /* |
| 65 | * Other stuff is appended to the text segment: |
| 66 | */ |
| 67 | .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } |
| 68 | .rodata1 : { *(.rodata1) } |
| 69 | |
| 70 | .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr |
| 71 | .eh_frame : { KEEP (*(.eh_frame)) } :text |
| 72 | .gcc_except_table : { *(.gcc_except_table) } |
| 73 | .fixup : { *(.fixup) } |
| 74 | |
| 75 | .dynamic : { *(.dynamic) } :text :dynamic |
| 76 | .got : { *(.got) } :text |
| 77 | .plt : { *(.plt) } |
| 78 | |
| 79 | .rela.dyn : { *(.rela .rela*) } |
| 80 | |
| 81 | _end = .; |
| 82 | __end = .; |
| 83 | PROVIDE(end = .); |
| 84 | |
| 85 | DWARF_DEBUG |
| 86 | ELF_DETAILS |
| 87 | |
| 88 | /DISCARD/ : { |
| 89 | *(.note.GNU-stack) |
| 90 | *(*.EMB.apuinfo) |
| 91 | *(.branch_lt) |
| 92 | *(.data .data.* .gnu.linkonce.d.* .sdata*) |
| 93 | *(.bss .sbss .dynbss .dynsbss) |
| 94 | *(.got1 .glink .iplt) |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | /* |
| 99 | * Very old versions of ld do not recognize this name token; use the constant. |
| 100 | */ |
| 101 | #define PT_GNU_EH_FRAME 0x6474e550 |
| 102 | |
| 103 | /* |
| 104 | * We must supply the ELF program headers explicitly to get just one |
| 105 | * PT_LOAD segment, and set the flags explicitly to make segments read-only. |
| 106 | */ |
| 107 | PHDRS |
| 108 | { |
| 109 | text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ |
| 110 | dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ |
| 111 | note PT_NOTE FLAGS(4); /* PF_R */ |
| 112 | eh_frame_hdr PT_GNU_EH_FRAME; |
| 113 | } |
| 114 | |
| 115 | /* |
| 116 | * This controls what symbols we export from the DSO. |
| 117 | */ |
| 118 | VERSION |
| 119 | { |
| 120 | VDSO_VERSION_STRING { |
| 121 | global: |
| 122 | __kernel_get_syscall_map; |
| 123 | __kernel_gettimeofday; |
| 124 | __kernel_clock_gettime; |
| 125 | __kernel_clock_gettime64; |
| 126 | __kernel_clock_getres; |
| 127 | __kernel_time; |
| 128 | __kernel_get_tbfreq; |
| 129 | __kernel_sync_dicache; |
| 130 | __kernel_sigtramp32; |
| 131 | __kernel_sigtramp_rt32; |
| 132 | #if defined(CONFIG_PPC64) || !defined(CONFIG_SMP) |
| 133 | __kernel_getcpu; |
| 134 | #endif |
| 135 | __kernel_getrandom; |
| 136 | |
| 137 | local: *; |
| 138 | }; |
| 139 | } |
| 140 | |
| 141 | /* |
| 142 | * Make the sigreturn code visible to the kernel. |
| 143 | */ |
| 144 | VDSO_sigtramp32 = __kernel_sigtramp32; |
| 145 | VDSO_sigtramp_rt32 = __kernel_sigtramp_rt32; |
| 146 | |