1 /* $NetBSD: elf_machdep.h,v 1.2 2017/11/06 03:47:47 christos Exp $ */ 2 3 /*- 4 * Copyright (c) 2014 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Matt Thomas of 3am Software Foundry. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 #ifndef _OR1K_ELF_MACHDEP_H_ 33 #define _OR1K_ELF_MACHDEP_H_ 34 35 #define ELF32_MACHDEP_ID EM_OR1K 36 37 #define ELF32_MACHDEP_ENDIANNESS ELFDATA2MSB 38 #define ELF64_MACHDEP_ENDIANNESS xxx 39 40 #define ELF32_MACHDEP_ID_CASES \ 41 case EM_OR1K: \ 42 break; 43 44 #define ELF64_MACHDEP_ID_CASES 45 46 #define KERN_ELFSIZE 32 47 #define ARCH_ELFSIZE 32 /* MD native binary size */ 48 49 /* Processor specific flags for the ELF header e_flags field. */ 50 51 #define EF_OR1K_NODELAY 0x00000001 52 53 /* Processor specific relocation types */ 54 55 #define R_OR1K_NONE 0 56 #define R_OR1K_32 1 // A 57 #define R_OR1K_16 2 // A & 0xffff 58 #define R_OR1K_8 3 // A & 0xff 59 #define R_OR1K_LO_16_IN_INSN 4 // A & 0xffff 60 #define R_OR1K_HI_16_IN_INSN 5 // (A >> 16) & 0xffff 61 #define R_OR1K_INSN_REL_26 6 // (S + A - P) >> 2 62 #define R_OR1K_GNU_VTENTRY 7 63 #define R_OR1K_GNU_VTINHERIT 8 64 #define R_OR1K_32_PCREL 9 // A - P 65 #define R_OR1K_16_PCREL 10 // (A - P) & 0xffff 66 #define R_OR1K_8_PCREL 11 // (A - P) & 0xff 67 #define R_OR1K_GOTPC_HI16 12 68 #define R_OR1K_GOTPC_LO16 13 69 #define R_OR1K_GOT15 14 70 #define R_OR1K_PLT26 15 71 #define R_OR1K_GOTOFF_HI16 16 72 #define R_OR1K_GOTOFF_LO16 17 73 #define R_OR1K_COPY 18 74 #define R_OR1K_GLOB_DAT 19 75 #define R_OR1K_JMP_SLOT 20 76 #define R_OR1K_RELATIVE 21 77 #define R_OR1K_TLS_GD_HI16 22 78 #define R_OR1K_TLS_GD_LO16 23 79 #define R_OR1K_TLS_LDM_HI16 24 80 #define R_OR1K_TLS_LDM_LO16 25 81 #define R_OR1K_TLS_LDO_HI16 26 82 #define R_OR1K_TLS_LDO_LO16 27 83 #define R_OR1K_TLS_IE_HI16 28 84 #define R_OR1K_TLS_IE_LO16 29 85 #define R_OR1K_TLS_LE_HI16 30 86 #define R_OR1K_TLS_LE_LO16 31 87 #define R_OR1K_TLS_TPOFF 32 88 #define R_OR1K_TLS_DTPOFF 33 89 #define R_OR1K_TLS_DTPMOD 34 90 91 #define R_TYPE(name) R_OR1K_ ## name 92 #define R_TLS_TYPE(name) R_OR1K_ ## name ## 64 93 94 #endif /* _OR1K_ELF_MACHDEP_H_ */ 95