1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_M32R__ELF_H 3 #define _ASM_M32R__ELF_H 4 5 /* 6 * ELF-specific definitions. 7 * 8 * Copyright (C) 1999-2004, Renesas Technology Corp. 9 * Hirokazu Takata <takata at linux-m32r.org> 10 */ 11 12 #include <asm/ptrace.h> 13 #include <asm/user.h> 14 #include <asm/page.h> 15 16 /* M32R relocation types */ 17 #define R_M32R_NONE 0 18 #define R_M32R_16 1 19 #define R_M32R_32 2 20 #define R_M32R_24 3 21 #define R_M32R_10_PCREL 4 22 #define R_M32R_18_PCREL 5 23 #define R_M32R_26_PCREL 6 24 #define R_M32R_HI16_ULO 7 25 #define R_M32R_HI16_SLO 8 26 #define R_M32R_LO16 9 27 #define R_M32R_SDA16 10 28 #define R_M32R_GNU_VTINHERIT 11 29 #define R_M32R_GNU_VTENTRY 12 30 31 #define R_M32R_16_RELA 33 32 #define R_M32R_32_RELA 34 33 #define R_M32R_24_RELA 35 34 #define R_M32R_10_PCREL_RELA 36 35 #define R_M32R_18_PCREL_RELA 37 36 #define R_M32R_26_PCREL_RELA 38 37 #define R_M32R_HI16_ULO_RELA 39 38 #define R_M32R_HI16_SLO_RELA 40 39 #define R_M32R_LO16_RELA 41 40 #define R_M32R_SDA16_RELA 42 41 #define R_M32R_RELA_GNU_VTINHERIT 43 42 #define R_M32R_RELA_GNU_VTENTRY 44 43 44 #define R_M32R_GOT24 48 45 #define R_M32R_26_PLTREL 49 46 #define R_M32R_COPY 50 47 #define R_M32R_GLOB_DAT 51 48 #define R_M32R_JMP_SLOT 52 49 #define R_M32R_RELATIVE 53 50 #define R_M32R_GOTOFF 54 51 #define R_M32R_GOTPC24 55 52 #define R_M32R_GOT16_HI_ULO 56 53 #define R_M32R_GOT16_HI_SLO 57 54 #define R_M32R_GOT16_LO 58 55 #define R_M32R_GOTPC_HI_ULO 59 56 #define R_M32R_GOTPC_HI_SLO 60 57 #define R_M32R_GOTPC_LO 61 58 #define R_M32R_GOTOFF_HI_ULO 62 59 #define R_M32R_GOTOFF_HI_SLO 63 60 #define R_M32R_GOTOFF_LO 64 61 62 #define R_M32R_NUM 256 63 64 /* 65 * ELF register definitions.. 66 */ 67 #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) 68 69 typedef unsigned long elf_greg_t; 70 typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 71 72 /* We have no FP mumumu. */ 73 typedef double elf_fpreg_t; 74 typedef elf_fpreg_t elf_fpregset_t; 75 76 /* 77 * This is used to ensure we don't load something for the wrong architecture. 78 */ 79 #define elf_check_arch(x) \ 80 (((x)->e_machine == EM_M32R) || ((x)->e_machine == EM_CYGNUS_M32R)) 81 82 /* 83 * These are used to set parameters in the core dumps. 84 */ 85 #define ELF_CLASS ELFCLASS32 86 #if defined(__LITTLE_ENDIAN__) 87 #define ELF_DATA ELFDATA2LSB 88 #elif defined(__BIG_ENDIAN__) 89 #define ELF_DATA ELFDATA2MSB 90 #else 91 #error no endian defined 92 #endif 93 #define ELF_ARCH EM_M32R 94 95 /* r0 is set by ld.so to a pointer to a function which might be 96 * registered using 'atexit'. This provides a mean for the dynamic 97 * linker to call DT_FINI functions for shared libraries that have 98 * been loaded before the code runs. 99 * 100 * So that we can use the same startup file with static executables, 101 * we start programs with a value of 0 to indicate that there is no 102 * such function. 103 */ 104 #define ELF_PLAT_INIT(_r, load_addr) (_r)->r0 = 0 105 106 #define ELF_EXEC_PAGESIZE PAGE_SIZE 107 108 /* 109 * This is the location that an ET_DYN program is loaded if exec'ed. 110 * Typical use of this is to invoke "./ld.so someprog" to test out a 111 * new version of the loader. We need to make sure that it is out of 112 * the way of the program that it will "exec", and that there is 113 * sufficient room for the brk. 114 */ 115 #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) 116 117 /* regs is struct pt_regs, pr_reg is elf_gregset_t (which is 118 now struct_user_regs, they are different) */ 119 120 #define ELF_CORE_COPY_REGS(pr_reg, regs) \ 121 memcpy((char *)pr_reg, (char *)regs, sizeof (struct pt_regs)); 122 123 /* This yields a mask that user programs can use to figure out what 124 instruction set this CPU supports. */ 125 #define ELF_HWCAP (0) 126 127 /* This yields a string that ld.so will use to load implementation 128 specific libraries for optimization. This is more specific in 129 intent than poking at uname or /proc/cpuinfo. */ 130 #define ELF_PLATFORM (NULL) 131 132 #endif /* _ASM_M32R__ELF_H */ 133