10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52850Srie * Common Development and Distribution License (the "License"). 62850Srie * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 212850Srie 220Sstevel@tonic-gate /* 230Sstevel@tonic-gate * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T 240Sstevel@tonic-gate * All Rights Reserved 250Sstevel@tonic-gate * 26*10201SEdward.Pilatowicz@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 272850Srie * Use is subject to license terms. 280Sstevel@tonic-gate */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifndef _SYS_ELF_SPARC_H 310Sstevel@tonic-gate #define _SYS_ELF_SPARC_H 320Sstevel@tonic-gate 330Sstevel@tonic-gate #ifdef __cplusplus 340Sstevel@tonic-gate extern "C" { 350Sstevel@tonic-gate #endif 360Sstevel@tonic-gate 370Sstevel@tonic-gate #define EF_SPARC_32PLUS_MASK 0xffff00 /* bits indicating V8+ type */ 380Sstevel@tonic-gate #define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ 390Sstevel@tonic-gate #define EF_SPARC_EXT_MASK 0xffff00 /* bits for vendor extensions */ 400Sstevel@tonic-gate #define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ 410Sstevel@tonic-gate #define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ 420Sstevel@tonic-gate #define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARC3 extensions */ 430Sstevel@tonic-gate 440Sstevel@tonic-gate #define EF_SPARCV9_MM 0x3 /* mask for memory model */ 450Sstevel@tonic-gate #define EF_SPARCV9_TSO 0x0 /* total store ordering */ 460Sstevel@tonic-gate #define EF_SPARCV9_PSO 0x1 /* partial store ordering */ 470Sstevel@tonic-gate #define EF_SPARCV9_RMO 0x2 /* relaxed memory ordering */ 480Sstevel@tonic-gate 490Sstevel@tonic-gate #define R_SPARC_NONE 0 /* relocation type */ 500Sstevel@tonic-gate #define R_SPARC_8 1 510Sstevel@tonic-gate #define R_SPARC_16 2 520Sstevel@tonic-gate #define R_SPARC_32 3 530Sstevel@tonic-gate #define R_SPARC_DISP8 4 540Sstevel@tonic-gate #define R_SPARC_DISP16 5 550Sstevel@tonic-gate #define R_SPARC_DISP32 6 560Sstevel@tonic-gate #define R_SPARC_WDISP30 7 570Sstevel@tonic-gate #define R_SPARC_WDISP22 8 580Sstevel@tonic-gate #define R_SPARC_HI22 9 590Sstevel@tonic-gate #define R_SPARC_22 10 600Sstevel@tonic-gate #define R_SPARC_13 11 610Sstevel@tonic-gate #define R_SPARC_LO10 12 620Sstevel@tonic-gate #define R_SPARC_GOT10 13 630Sstevel@tonic-gate #define R_SPARC_GOT13 14 640Sstevel@tonic-gate #define R_SPARC_GOT22 15 650Sstevel@tonic-gate #define R_SPARC_PC10 16 660Sstevel@tonic-gate #define R_SPARC_PC22 17 670Sstevel@tonic-gate #define R_SPARC_WPLT30 18 680Sstevel@tonic-gate #define R_SPARC_COPY 19 690Sstevel@tonic-gate #define R_SPARC_GLOB_DAT 20 700Sstevel@tonic-gate #define R_SPARC_JMP_SLOT 21 710Sstevel@tonic-gate #define R_SPARC_RELATIVE 22 720Sstevel@tonic-gate #define R_SPARC_UA32 23 730Sstevel@tonic-gate #define R_SPARC_PLT32 24 740Sstevel@tonic-gate #define R_SPARC_HIPLT22 25 750Sstevel@tonic-gate #define R_SPARC_LOPLT10 26 760Sstevel@tonic-gate #define R_SPARC_PCPLT32 27 770Sstevel@tonic-gate #define R_SPARC_PCPLT22 28 780Sstevel@tonic-gate #define R_SPARC_PCPLT10 29 790Sstevel@tonic-gate #define R_SPARC_10 30 800Sstevel@tonic-gate #define R_SPARC_11 31 810Sstevel@tonic-gate #define R_SPARC_64 32 820Sstevel@tonic-gate #define R_SPARC_OLO10 33 830Sstevel@tonic-gate #define R_SPARC_HH22 34 840Sstevel@tonic-gate #define R_SPARC_HM10 35 850Sstevel@tonic-gate #define R_SPARC_LM22 36 860Sstevel@tonic-gate #define R_SPARC_PC_HH22 37 870Sstevel@tonic-gate #define R_SPARC_PC_HM10 38 880Sstevel@tonic-gate #define R_SPARC_PC_LM22 39 890Sstevel@tonic-gate #define R_SPARC_WDISP16 40 900Sstevel@tonic-gate #define R_SPARC_WDISP19 41 910Sstevel@tonic-gate #define R_SPARC_GLOB_JMP 42 920Sstevel@tonic-gate #define R_SPARC_7 43 930Sstevel@tonic-gate #define R_SPARC_5 44 940Sstevel@tonic-gate #define R_SPARC_6 45 950Sstevel@tonic-gate #define R_SPARC_DISP64 46 960Sstevel@tonic-gate #define R_SPARC_PLT64 47 970Sstevel@tonic-gate #define R_SPARC_HIX22 48 980Sstevel@tonic-gate #define R_SPARC_LOX10 49 990Sstevel@tonic-gate #define R_SPARC_H44 50 1000Sstevel@tonic-gate #define R_SPARC_M44 51 1010Sstevel@tonic-gate #define R_SPARC_L44 52 1020Sstevel@tonic-gate #define R_SPARC_REGISTER 53 1030Sstevel@tonic-gate #define R_SPARC_UA64 54 1040Sstevel@tonic-gate #define R_SPARC_UA16 55 1050Sstevel@tonic-gate #define R_SPARC_TLS_GD_HI22 56 1060Sstevel@tonic-gate #define R_SPARC_TLS_GD_LO10 57 1070Sstevel@tonic-gate #define R_SPARC_TLS_GD_ADD 58 1080Sstevel@tonic-gate #define R_SPARC_TLS_GD_CALL 59 1090Sstevel@tonic-gate #define R_SPARC_TLS_LDM_HI22 60 1100Sstevel@tonic-gate #define R_SPARC_TLS_LDM_LO10 61 1110Sstevel@tonic-gate #define R_SPARC_TLS_LDM_ADD 62 1120Sstevel@tonic-gate #define R_SPARC_TLS_LDM_CALL 63 1130Sstevel@tonic-gate #define R_SPARC_TLS_LDO_HIX22 64 1140Sstevel@tonic-gate #define R_SPARC_TLS_LDO_LOX10 65 1150Sstevel@tonic-gate #define R_SPARC_TLS_LDO_ADD 66 1160Sstevel@tonic-gate #define R_SPARC_TLS_IE_HI22 67 1170Sstevel@tonic-gate #define R_SPARC_TLS_IE_LO10 68 1180Sstevel@tonic-gate #define R_SPARC_TLS_IE_LD 69 1190Sstevel@tonic-gate #define R_SPARC_TLS_IE_LDX 70 1200Sstevel@tonic-gate #define R_SPARC_TLS_IE_ADD 71 1210Sstevel@tonic-gate #define R_SPARC_TLS_LE_HIX22 72 1220Sstevel@tonic-gate #define R_SPARC_TLS_LE_LOX10 73 1230Sstevel@tonic-gate #define R_SPARC_TLS_DTPMOD32 74 1240Sstevel@tonic-gate #define R_SPARC_TLS_DTPMOD64 75 1250Sstevel@tonic-gate #define R_SPARC_TLS_DTPOFF32 76 1260Sstevel@tonic-gate #define R_SPARC_TLS_DTPOFF64 77 1270Sstevel@tonic-gate #define R_SPARC_TLS_TPOFF32 78 1280Sstevel@tonic-gate #define R_SPARC_TLS_TPOFF64 79 1290Sstevel@tonic-gate #define R_SPARC_GOTDATA_HIX22 80 1300Sstevel@tonic-gate #define R_SPARC_GOTDATA_LOX10 81 1310Sstevel@tonic-gate #define R_SPARC_GOTDATA_OP_HIX22 82 1320Sstevel@tonic-gate #define R_SPARC_GOTDATA_OP_LOX10 83 1330Sstevel@tonic-gate #define R_SPARC_GOTDATA_OP 84 1340Sstevel@tonic-gate #define R_SPARC_H34 85 1352850Srie #define R_SPARC_SIZE32 86 1362850Srie #define R_SPARC_SIZE64 87 1372850Srie #define R_SPARC_NUM 88 1380Sstevel@tonic-gate 1390Sstevel@tonic-gate /* 1400Sstevel@tonic-gate * Relocation aliases 1410Sstevel@tonic-gate */ 1420Sstevel@tonic-gate #define R_SPARC_L34 R_SPARC_L44 /* associated with R_SPARC_H34 */ 1430Sstevel@tonic-gate /* same calc as R_SPARC_L44 */ 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate #define ELF_SPARC_MAXPGSZ 0x10000 /* maximum page size */ 1460Sstevel@tonic-gate #define ELF_SPARCV9_MAXPGSZ 0x100000 1470Sstevel@tonic-gate 1480Sstevel@tonic-gate /* 1490Sstevel@tonic-gate * Processor specific section types 1500Sstevel@tonic-gate */ 1510Sstevel@tonic-gate #define SHT_SPARC_GOTDATA 0x70000000 1520Sstevel@tonic-gate 1530Sstevel@tonic-gate #define SHF_ORDERED 0x40000000 1540Sstevel@tonic-gate #define SHF_EXCLUDE 0x80000000 1550Sstevel@tonic-gate 1560Sstevel@tonic-gate #define SHN_BEFORE 0xff00 1570Sstevel@tonic-gate #define SHN_AFTER 0xff01 1580Sstevel@tonic-gate 1590Sstevel@tonic-gate #define STT_SPARC_REGISTER 13 /* register symbol type */ 1600Sstevel@tonic-gate 1610Sstevel@tonic-gate #define DT_SPARC_REGISTER 0x70000001 /* identifies register */ 1620Sstevel@tonic-gate /* symbols */ 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate 1650Sstevel@tonic-gate /* 1660Sstevel@tonic-gate * Register symbol numbers - to be used in the st_value field 1670Sstevel@tonic-gate * of register symbols. 1680Sstevel@tonic-gate */ 1690Sstevel@tonic-gate #define STO_SPARC_REGISTER_G1 0x1 /* register %g1 */ 1700Sstevel@tonic-gate #define STO_SPARC_REGISTER_G2 0x2 /* register %g2 */ 1710Sstevel@tonic-gate #define STO_SPARC_REGISTER_G3 0x3 /* register %g3 */ 1720Sstevel@tonic-gate #define STO_SPARC_REGISTER_G4 0x4 /* register %g4 */ 1730Sstevel@tonic-gate #define STO_SPARC_REGISTER_G5 0x5 /* register %g5 */ 1740Sstevel@tonic-gate #define STO_SPARC_REGISTER_G6 0x6 /* register %g6 */ 1750Sstevel@tonic-gate #define STO_SPARC_REGISTER_G7 0x7 /* register %g7 */ 1760Sstevel@tonic-gate 177*10201SEdward.Pilatowicz@Sun.COM /* 178*10201SEdward.Pilatowicz@Sun.COM * There are consumers of this file that want to include elf defines for 179*10201SEdward.Pilatowicz@Sun.COM * all architectures. This is a problem for the defines below, because 180*10201SEdward.Pilatowicz@Sun.COM * while they are architecture specific they have common names. Hence to 181*10201SEdward.Pilatowicz@Sun.COM * prevent attempts to redefine these variables we'll check if any of 182*10201SEdward.Pilatowicz@Sun.COM * the other elf architecture header files have been included. If 183*10201SEdward.Pilatowicz@Sun.COM * they have then we'll just stick with the existing definitions. 184*10201SEdward.Pilatowicz@Sun.COM */ 185*10201SEdward.Pilatowicz@Sun.COM #if !defined(_SYS_ELF_MACH_COMMON) 186*10201SEdward.Pilatowicz@Sun.COM #define _SYS_ELF_MACH_COMMON 187*10201SEdward.Pilatowicz@Sun.COM 188*10201SEdward.Pilatowicz@Sun.COM /* 189*10201SEdward.Pilatowicz@Sun.COM * Plt and Got information; the first few .got and .plt entries are reserved 190*10201SEdward.Pilatowicz@Sun.COM * PLT[0] jump to dynamic linker 191*10201SEdward.Pilatowicz@Sun.COM * GOT[0] address of _DYNAMIC 192*10201SEdward.Pilatowicz@Sun.COM */ 193*10201SEdward.Pilatowicz@Sun.COM #define M_PLT_INSSIZE 4 /* single plt instruction size */ 194*10201SEdward.Pilatowicz@Sun.COM #define M_PLT_XNumber 4 /* reserved no. of plt entries */ 195*10201SEdward.Pilatowicz@Sun.COM #define M_GOT_XDYNAMIC 0 /* got index for _DYNAMIC */ 196*10201SEdward.Pilatowicz@Sun.COM #define M_GOT_XNumber 1 /* reserved no. of got entries */ 197*10201SEdward.Pilatowicz@Sun.COM 198*10201SEdward.Pilatowicz@Sun.COM /* 199*10201SEdward.Pilatowicz@Sun.COM * ELF32 bit PLT constants 200*10201SEdward.Pilatowicz@Sun.COM */ 201*10201SEdward.Pilatowicz@Sun.COM #define M32_WORD_ALIGN 4 202*10201SEdward.Pilatowicz@Sun.COM #define M32_PLT_ENTSIZE 12 /* plt entry size in bytes */ 203*10201SEdward.Pilatowicz@Sun.COM #define M32_PLT_ALIGN M_WORD_ALIGN /* alignment of .plt section */ 204*10201SEdward.Pilatowicz@Sun.COM #define M32_GOT_ENTSIZE 4 /* got entry size in bytes */ 205*10201SEdward.Pilatowicz@Sun.COM #define M32_GOT_MAXSMALL 2048 /* maximum no. of small gots */ 206*10201SEdward.Pilatowicz@Sun.COM #define M32_PLT_RESERVSZ (M_PLT_XNumber * \ 207*10201SEdward.Pilatowicz@Sun.COM M32_PLT_ENTSIZE) /* first 4 plt's reserved */ 208*10201SEdward.Pilatowicz@Sun.COM 209*10201SEdward.Pilatowicz@Sun.COM /* 210*10201SEdward.Pilatowicz@Sun.COM * ELF64 bit PLT constants 211*10201SEdward.Pilatowicz@Sun.COM */ 212*10201SEdward.Pilatowicz@Sun.COM #define M64_WORD_ALIGN 8 213*10201SEdward.Pilatowicz@Sun.COM #define M64_PLT_ENTSIZE 32 /* plt entry size in bytes */ 214*10201SEdward.Pilatowicz@Sun.COM #define M64_PLT_ALIGN 256 /* alignment of .plt section */ 215*10201SEdward.Pilatowicz@Sun.COM #define M64_GOT_ENTSIZE 8 /* got entry size in bytes */ 216*10201SEdward.Pilatowicz@Sun.COM #define M64_GOT_MAXSMALL 1024 /* maximum no. of small gots */ 217*10201SEdward.Pilatowicz@Sun.COM #define M64_PLT_RESERVSZ (M_PLT_XNumber * \ 218*10201SEdward.Pilatowicz@Sun.COM M64_PLT_ENTSIZE) /* first 4 plt's reserved */ 219*10201SEdward.Pilatowicz@Sun.COM 220*10201SEdward.Pilatowicz@Sun.COM #define M64_PLT_NEARPLTS 0x8000 /* # of NEAR PLTS we can have */ 221*10201SEdward.Pilatowicz@Sun.COM #define M64_PLT_FENTSIZE 24 /* size of far plt is 6 instructions */ 222*10201SEdward.Pilatowicz@Sun.COM /* x 4bytes */ 223*10201SEdward.Pilatowicz@Sun.COM #define M64_PLT_PSIZE 8 /* size of PLTP pointer */ 224*10201SEdward.Pilatowicz@Sun.COM #define M64_PLT_FBLKCNTS 160 /* # of plts in far PLT blocks */ 225*10201SEdward.Pilatowicz@Sun.COM #define M64_PLT_FBLOCKSZ (M64_PLT_FBLKCNTS *\ 226*10201SEdward.Pilatowicz@Sun.COM M64_PLT_ENTSIZE) /* size of far PLT block */ 227*10201SEdward.Pilatowicz@Sun.COM 228*10201SEdward.Pilatowicz@Sun.COM 229*10201SEdward.Pilatowicz@Sun.COM /* 230*10201SEdward.Pilatowicz@Sun.COM * Make common alias for the 32/64 bit specific defines based on _ELF64 231*10201SEdward.Pilatowicz@Sun.COM */ 232*10201SEdward.Pilatowicz@Sun.COM #ifdef _ELF64 233*10201SEdward.Pilatowicz@Sun.COM /* architecture common defines */ 234*10201SEdward.Pilatowicz@Sun.COM #define M_WORD_ALIGN M64_WORD_ALIGN 235*10201SEdward.Pilatowicz@Sun.COM #define M_PLT_ENTSIZE M64_PLT_ENTSIZE 236*10201SEdward.Pilatowicz@Sun.COM #define M_PLT_ALIGN M64_PLT_ALIGN 237*10201SEdward.Pilatowicz@Sun.COM #define M_PLT_RESERVSZ M64_PLT_RESERVSZ 238*10201SEdward.Pilatowicz@Sun.COM #define M_GOT_ENTSIZE M64_GOT_ENTSIZE 239*10201SEdward.Pilatowicz@Sun.COM /* sparc specific defines */ 240*10201SEdward.Pilatowicz@Sun.COM #define M_GOT_MAXSMALL M64_GOT_MAXSMALL 241*10201SEdward.Pilatowicz@Sun.COM #else /* !_ELF64 */ 242*10201SEdward.Pilatowicz@Sun.COM /* architecture common defines */ 243*10201SEdward.Pilatowicz@Sun.COM #define M_WORD_ALIGN M32_WORD_ALIGN 244*10201SEdward.Pilatowicz@Sun.COM #define M_PLT_ENTSIZE M32_PLT_ENTSIZE 245*10201SEdward.Pilatowicz@Sun.COM #define M_PLT_ALIGN M32_PLT_ALIGN 246*10201SEdward.Pilatowicz@Sun.COM #define M_PLT_RESERVSZ M32_PLT_RESERVSZ 247*10201SEdward.Pilatowicz@Sun.COM #define M_GOT_ENTSIZE M32_GOT_ENTSIZE 248*10201SEdward.Pilatowicz@Sun.COM /* sparc specific defines */ 249*10201SEdward.Pilatowicz@Sun.COM #define M_GOT_MAXSMALL M32_GOT_MAXSMALL 250*10201SEdward.Pilatowicz@Sun.COM #endif /* !_ELF64 */ 251*10201SEdward.Pilatowicz@Sun.COM 252*10201SEdward.Pilatowicz@Sun.COM #endif /* !_SYS_ELF_MACH_COMMON */ 2530Sstevel@tonic-gate 2540Sstevel@tonic-gate #ifdef __cplusplus 2550Sstevel@tonic-gate } 2560Sstevel@tonic-gate #endif 2570Sstevel@tonic-gate 2580Sstevel@tonic-gate #endif /* _SYS_ELF_SPARC_H */ 259