1 /* $NetBSD: elf_machdep.h,v 1.4 2025/12/12 12:13:49 jkoshy 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 #if !defined(_SYS_ELFDEFINITIONS_H_) 36 /* Processor specific flags for the ELF header e_flags field. */ 37 38 #define EF_OR1K_NODELAY 0x00000001 39 40 /* Processor specific relocation types */ 41 42 #define R_OR1K_NONE 0 43 #define R_OR1K_32 1 // A 44 #define R_OR1K_16 2 // A & 0xffff 45 #define R_OR1K_8 3 // A & 0xff 46 #define R_OR1K_LO_16_IN_INSN 4 // A & 0xffff 47 #define R_OR1K_HI_16_IN_INSN 5 // (A >> 16) & 0xffff 48 #define R_OR1K_INSN_REL_26 6 // (S + A - P) >> 2 49 #define R_OR1K_GNU_VTENTRY 7 50 #define R_OR1K_GNU_VTINHERIT 8 51 #define R_OR1K_32_PCREL 9 // A - P 52 #define R_OR1K_16_PCREL 10 // (A - P) & 0xffff 53 #define R_OR1K_8_PCREL 11 // (A - P) & 0xff 54 #define R_OR1K_GOTPC_HI16 12 55 #define R_OR1K_GOTPC_LO16 13 56 #define R_OR1K_GOT16 14 57 #define R_OR1K_PLT26 15 58 #define R_OR1K_GOTOFF_HI16 16 59 #define R_OR1K_GOTOFF_LO16 17 60 #define R_OR1K_COPY 18 61 #define R_OR1K_GLOB_DAT 19 62 #define R_OR1K_JMP_SLOT 20 63 #define R_OR1K_RELATIVE 21 64 #define R_OR1K_TLS_GD_HI16 22 65 #define R_OR1K_TLS_GD_LO16 23 66 #define R_OR1K_TLS_LDM_HI16 24 67 #define R_OR1K_TLS_LDM_LO16 25 68 #define R_OR1K_TLS_LDO_HI16 26 69 #define R_OR1K_TLS_LDO_LO16 27 70 #define R_OR1K_TLS_IE_HI16 28 71 #define R_OR1K_TLS_IE_LO16 29 72 #define R_OR1K_TLS_LE_HI16 30 73 #define R_OR1K_TLS_LE_LO16 31 74 #define R_OR1K_TLS_TPOFF 32 75 #define R_OR1K_TLS_DTPOFF 33 76 #define R_OR1K_TLS_DTPMOD 34 77 78 #endif /* !defined(_SYS_ELFDEFINITIONS_H_) */ 79 80 /* 81 * Local symbols. 82 */ 83 #define ELF32_MACHDEP_ID EM_OR1K 84 85 #define ELF32_MACHDEP_ENDIANNESS ELFDATA2MSB 86 #define ELF64_MACHDEP_ENDIANNESS xxx 87 88 #define ELF32_MACHDEP_ID_CASES \ 89 case EM_OR1K: \ 90 break; 91 92 #define ELF64_MACHDEP_ID_CASES 93 94 #define KERN_ELFSIZE 32 95 #define ARCH_ELFSIZE 32 /* MD native binary size */ 96 97 #define R_TYPE(name) R_OR1K_ ## name 98 #define R_TLS_TYPE(name) R_OR1K_ ## name ## 64 99 100 #endif /* _OR1K_ELF_MACHDEP_H_ */ 101