12874c5fdSThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-or-later */ 2ebb5e78cSAlex Smith/* 3ebb5e78cSAlex Smith * Copyright (C) 2015 Imagination Technologies 4ebb5e78cSAlex Smith * Author: Alex Smith <alex.smith@imgtec.com> 5ebb5e78cSAlex Smith */ 6ebb5e78cSAlex Smith 7ebb5e78cSAlex Smith#include <asm/sgidefs.h> 8ebb5e78cSAlex Smith 9ebb5e78cSAlex Smith#if _MIPS_SIM == _MIPS_SIM_ABI64 10ebb5e78cSAlex SmithOUTPUT_FORMAT("elf64-tradlittlemips", "elf64-tradbigmips", "elf64-tradlittlemips") 11ebb5e78cSAlex Smith#elif _MIPS_SIM == _MIPS_SIM_NABI32 12ebb5e78cSAlex SmithOUTPUT_FORMAT("elf32-ntradlittlemips", "elf32-ntradbigmips", "elf32-ntradlittlemips") 13ebb5e78cSAlex Smith#else 14ebb5e78cSAlex SmithOUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradbigmips", "elf32-tradlittlemips") 15ebb5e78cSAlex Smith#endif 16ebb5e78cSAlex Smith 17ebb5e78cSAlex SmithOUTPUT_ARCH(mips) 18ebb5e78cSAlex Smith 19ebb5e78cSAlex SmithSECTIONS 20ebb5e78cSAlex Smith{ 21ebb5e78cSAlex Smith PROVIDE(_start = .); 22ebb5e78cSAlex Smith . = SIZEOF_HEADERS; 23ebb5e78cSAlex Smith 24ebb5e78cSAlex Smith /* 25ebb5e78cSAlex Smith * In order to retain compatibility with older toolchains we provide the 26ebb5e78cSAlex Smith * ABI flags section ourself. Newer assemblers will automatically 27ebb5e78cSAlex Smith * generate .MIPS.abiflags sections so we discard such input sections, 28ebb5e78cSAlex Smith * and then manually define our own section here. genvdso will patch 29ebb5e78cSAlex Smith * this section to have the correct name/type. 30ebb5e78cSAlex Smith */ 31ebb5e78cSAlex Smith .mips_abiflags : { *(.mips_abiflags) } :text :abiflags 32ebb5e78cSAlex Smith 33ebb5e78cSAlex Smith .reginfo : { *(.reginfo) } :text :reginfo 34ebb5e78cSAlex Smith 35ebb5e78cSAlex Smith .hash : { *(.hash) } :text 36ebb5e78cSAlex Smith .gnu.hash : { *(.gnu.hash) } 37ebb5e78cSAlex Smith .dynsym : { *(.dynsym) } 38ebb5e78cSAlex Smith .dynstr : { *(.dynstr) } 39ebb5e78cSAlex Smith .gnu.version : { *(.gnu.version) } 40ebb5e78cSAlex Smith .gnu.version_d : { *(.gnu.version_d) } 41ebb5e78cSAlex Smith .gnu.version_r : { *(.gnu.version_r) } 42ebb5e78cSAlex Smith 43ebb5e78cSAlex Smith .note : { *(.note.*) } :text :note 44ebb5e78cSAlex Smith 45ebb5e78cSAlex Smith .text : { *(.text*) } :text 46ebb5e78cSAlex Smith PROVIDE (__etext = .); 47ebb5e78cSAlex Smith PROVIDE (_etext = .); 48ebb5e78cSAlex Smith PROVIDE (etext = .); 49ebb5e78cSAlex Smith 50ebb5e78cSAlex Smith .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr 51ebb5e78cSAlex Smith .eh_frame : { KEEP (*(.eh_frame)) } :text 52ebb5e78cSAlex Smith 53ebb5e78cSAlex Smith .dynamic : { *(.dynamic) } :text :dynamic 54ebb5e78cSAlex Smith 55ebb5e78cSAlex Smith .rodata : { *(.rodata*) } :text 56ebb5e78cSAlex Smith 57ebb5e78cSAlex Smith _end = .; 58ebb5e78cSAlex Smith PROVIDE(end = .); 59ebb5e78cSAlex Smith 60ebb5e78cSAlex Smith /DISCARD/ : { 61ebb5e78cSAlex Smith *(.MIPS.abiflags) 62ebb5e78cSAlex Smith *(.gnu.attributes) 63ebb5e78cSAlex Smith *(.note.GNU-stack) 64ebb5e78cSAlex Smith *(.data .data.* .gnu.linkonce.d.* .sdata*) 65ebb5e78cSAlex Smith *(.bss .sbss .dynbss .dynsbss) 66ebb5e78cSAlex Smith } 67ebb5e78cSAlex Smith} 68ebb5e78cSAlex Smith 69ebb5e78cSAlex SmithPHDRS 70ebb5e78cSAlex Smith{ 71ebb5e78cSAlex Smith /* 72ebb5e78cSAlex Smith * Provide a PT_MIPS_ABIFLAGS header to assign the ABI flags section 73ebb5e78cSAlex Smith * to. We can specify the header type directly here so no modification 74ebb5e78cSAlex Smith * is needed later on. 75ebb5e78cSAlex Smith */ 76ebb5e78cSAlex Smith abiflags 0x70000003; 77ebb5e78cSAlex Smith 78ebb5e78cSAlex Smith /* 79ebb5e78cSAlex Smith * The ABI flags header must exist directly after the PT_INTERP header, 80ebb5e78cSAlex Smith * so we must explicitly place the PT_MIPS_REGINFO header after it to 81ebb5e78cSAlex Smith * stop the linker putting one in at the start. 82ebb5e78cSAlex Smith */ 83ebb5e78cSAlex Smith reginfo 0x70000000; 84ebb5e78cSAlex Smith 85ebb5e78cSAlex Smith text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */ 86ebb5e78cSAlex Smith dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 87ebb5e78cSAlex Smith note PT_NOTE FLAGS(4); /* PF_R */ 88ebb5e78cSAlex Smith eh_frame_hdr PT_GNU_EH_FRAME; 89ebb5e78cSAlex Smith} 90ebb5e78cSAlex Smith 91ebb5e78cSAlex SmithVERSION 92ebb5e78cSAlex Smith{ 93ebb5e78cSAlex Smith LINUX_2.6 { 94e91946d6SNathan Chancellor#ifndef CONFIG_MIPS_DISABLE_VDSO 95a7f4df4eSAlex Smith global: 96a7f4df4eSAlex Smith __vdso_clock_gettime; 97*971fe509SNathan Chancellor#ifdef CONFIG_MIPS_CLOCK_VSYSCALL 98a7f4df4eSAlex Smith __vdso_gettimeofday; 99*971fe509SNathan Chancellor#endif 100abed3d82SVincenzo Frascino __vdso_clock_getres; 1011f66c45dSVincenzo Frascino#if _MIPS_SIM != _MIPS_SIM_ABI64 1021f66c45dSVincenzo Frascino __vdso_clock_gettime64; 1031f66c45dSVincenzo Frascino#endif 104a7f4df4eSAlex Smith#endif 105ebb5e78cSAlex Smith local: *; 106ebb5e78cSAlex Smith }; 107ebb5e78cSAlex Smith} 108