17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52926dd2eSrie * Common Development and Distribution License (the "License"). 62926dd2eSrie * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21552ff457Srie 227c478bd9Sstevel@tonic-gate /* 23d9452f23SEdward Pilatowicz * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_ELF_AMD64_H 287c478bd9Sstevel@tonic-gate #define _SYS_ELF_AMD64_H 297c478bd9Sstevel@tonic-gate 30d9452f23SEdward Pilatowicz #include <sys/elf_386.h> 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #define R_AMD64_NONE 0 /* relocation types */ 377c478bd9Sstevel@tonic-gate #define R_AMD64_64 1 387c478bd9Sstevel@tonic-gate #define R_AMD64_PC32 2 397c478bd9Sstevel@tonic-gate #define R_AMD64_GOT32 3 407c478bd9Sstevel@tonic-gate #define R_AMD64_PLT32 4 417c478bd9Sstevel@tonic-gate #define R_AMD64_COPY 5 427c478bd9Sstevel@tonic-gate #define R_AMD64_GLOB_DAT 6 437c478bd9Sstevel@tonic-gate #define R_AMD64_JUMP_SLOT 7 447c478bd9Sstevel@tonic-gate #define R_AMD64_RELATIVE 8 457c478bd9Sstevel@tonic-gate #define R_AMD64_GOTPCREL 9 467c478bd9Sstevel@tonic-gate #define R_AMD64_32 10 477c478bd9Sstevel@tonic-gate #define R_AMD64_32S 11 487c478bd9Sstevel@tonic-gate #define R_AMD64_16 12 497c478bd9Sstevel@tonic-gate #define R_AMD64_PC16 13 507c478bd9Sstevel@tonic-gate #define R_AMD64_8 14 517c478bd9Sstevel@tonic-gate #define R_AMD64_PC8 15 527c478bd9Sstevel@tonic-gate #define R_AMD64_DTPMOD64 16 537c478bd9Sstevel@tonic-gate #define R_AMD64_DTPOFF64 17 547c478bd9Sstevel@tonic-gate #define R_AMD64_TPOFF64 18 557c478bd9Sstevel@tonic-gate #define R_AMD64_TLSGD 19 567c478bd9Sstevel@tonic-gate #define R_AMD64_TLSLD 20 577c478bd9Sstevel@tonic-gate #define R_AMD64_DTPOFF32 21 587c478bd9Sstevel@tonic-gate #define R_AMD64_GOTTPOFF 22 597c478bd9Sstevel@tonic-gate #define R_AMD64_TPOFF32 23 607c478bd9Sstevel@tonic-gate #define R_AMD64_PC64 24 617c478bd9Sstevel@tonic-gate #define R_AMD64_GOTOFF64 25 627c478bd9Sstevel@tonic-gate #define R_AMD64_GOTPC32 26 63552ff457Srie #define R_AMD64_GOT64 27 /* reserved for future expansion */ 64552ff457Srie #define R_AMD64_GOTPCREL64 28 /* reserved for future expansion */ 65552ff457Srie #define R_AMD64_GOTPC64 29 /* reserved for future expansion */ 66552ff457Srie #define R_AMD64_GOTPLT64 30 /* reserved for future expansion */ 67552ff457Srie #define R_AMD64_PLTOFF64 31 /* reserved for future expansion */ 682926dd2eSrie #define R_AMD64_SIZE32 32 692926dd2eSrie #define R_AMD64_SIZE64 33 70*a530dbfeSRichard Lowe #define R_AMD64_GOTPC32_TLSDESC 34 71*a530dbfeSRichard Lowe #define R_AMD64_TLSDESC_CALL 35 72*a530dbfeSRichard Lowe #define R_AMD64_TLSDESC 36 73*a530dbfeSRichard Lowe #define R_AMD64_IRELATIVE 37 74*a530dbfeSRichard Lowe #define R_AMD64_RELATIVE64 38 75*a530dbfeSRichard Lowe #define R_AMD64_UNKNOWN39 39 /* deprecated */ 76*a530dbfeSRichard Lowe #define R_AMD64_UNKNOWN40 40 /* deprecated */ 77*a530dbfeSRichard Lowe #define R_AMD64_GOTPCRELX 41 78*a530dbfeSRichard Lowe #define R_AMD64_REX_GOTPCRELX 42 79*a530dbfeSRichard Lowe #define R_AMD64_NUM 43 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate /* 822926dd2eSrie * The "System V Application Binary Interface, AMD64 Architecture Processor 832926dd2eSrie * Supplement", defines relocations in terms of R_X86_64_ rather than R_AMD64_. 842926dd2eSrie * Maintain both relocation naming conventions for compatibility. 857c478bd9Sstevel@tonic-gate */ 867c478bd9Sstevel@tonic-gate #define R_X86_64_NONE R_AMD64_NONE 877c478bd9Sstevel@tonic-gate #define R_X86_64_64 R_AMD64_64 887c478bd9Sstevel@tonic-gate #define R_X86_64_PC32 R_AMD64_PC32 897c478bd9Sstevel@tonic-gate #define R_X86_64_GOT32 R_AMD64_GOT32 907c478bd9Sstevel@tonic-gate #define R_X86_64_PLT32 R_AMD64_PLT32 917c478bd9Sstevel@tonic-gate #define R_X86_64_COPY R_AMD64_COPY 927c478bd9Sstevel@tonic-gate #define R_X86_64_GLOB_DAT R_AMD64_GLOB_DAT 937c478bd9Sstevel@tonic-gate #define R_X86_64_JUMP_SLOT R_AMD64_JUMP_SLOT 947c478bd9Sstevel@tonic-gate #define R_X86_64_RELATIVE R_AMD64_RELATIVE 957c478bd9Sstevel@tonic-gate #define R_X86_64_GOTPCREL R_AMD64_GOTPCREL 967c478bd9Sstevel@tonic-gate #define R_X86_64_32 R_AMD64_32 977c478bd9Sstevel@tonic-gate #define R_X86_64_32S R_AMD64_32S 987c478bd9Sstevel@tonic-gate #define R_X86_64_16 R_AMD64_16 997c478bd9Sstevel@tonic-gate #define R_X86_64_PC16 R_AMD64_PC16 1007c478bd9Sstevel@tonic-gate #define R_X86_64_8 R_AMD64_8 1017c478bd9Sstevel@tonic-gate #define R_X86_64_PC8 R_AMD64_PC8 1027c478bd9Sstevel@tonic-gate #define R_X86_64_DTPMOD64 R_AMD64_DTPMOD64 1037c478bd9Sstevel@tonic-gate #define R_X86_64_DTPOFF64 R_AMD64_DTPOFF64 1047c478bd9Sstevel@tonic-gate #define R_X86_64_TPOFF64 R_AMD64_TPOFF64 1057c478bd9Sstevel@tonic-gate #define R_X86_64_TLSGD R_AMD64_TLSGD 1067c478bd9Sstevel@tonic-gate #define R_X86_64_TLSLD R_AMD64_TLSLD 1077c478bd9Sstevel@tonic-gate #define R_X86_64_DTPOFF32 R_AMD64_DTPOFF32 1087c478bd9Sstevel@tonic-gate #define R_X86_64_GOTTPOFF R_AMD64_GOTTPOFF 1097c478bd9Sstevel@tonic-gate #define R_X86_64_TPOFF32 R_AMD64_TPOFF32 1107c478bd9Sstevel@tonic-gate #define R_X86_64_PC64 R_AMD64_PC64 1117c478bd9Sstevel@tonic-gate #define R_X86_64_GOTPC32 R_AMD64_GOTPC32 1127c478bd9Sstevel@tonic-gate #define R_X86_64_GOTOFF64 R_AMD64_GOTOFF64 113552ff457Srie #define R_X86_64_GOT64 R_AMD64_GOT64 114552ff457Srie #define R_X86_64_GOTPCREL64 R_AMD64_GOTPCREL64 115552ff457Srie #define R_X86_64_GOTPC64 R_AMD64_GOTPC64 116552ff457Srie #define R_X86_64_GOTPLT64 R_AMD64_GOTPLT64 117552ff457Srie #define R_X86_64_PLTOFF64 R_AMD64_PLTOFF64 1182926dd2eSrie #define R_X86_64_SIZE32 R_AMD64_SIZE32 1192926dd2eSrie #define R_X86_64_SIZE64 R_AMD64_SIZE64 120*a530dbfeSRichard Lowe #define R_X86_64_GOTPC32_TLSDESC R_AMD64_GOTPC32_TLSDESC 121*a530dbfeSRichard Lowe #define R_X86_64_TLSDESC_CALL R_AMD64_TLSDESC_CALL 122*a530dbfeSRichard Lowe #define R_X86_64_TLSDESC R_AMD64_TLSDESC 123*a530dbfeSRichard Lowe #define R_X86_64_IRELATIVE R_AMD64_IRELATIVE 124*a530dbfeSRichard Lowe #define R_X86_64_RELATIVE64 R_AMD64_RELATIVE64 125*a530dbfeSRichard Lowe #define R_X86_64_GOTPCRELX R_AMD64_GOTPCRELX 126*a530dbfeSRichard Lowe #define R_X86_64_REX_GOTPCRELX R_AMD64_REX_GOTPCRELX 1277c478bd9Sstevel@tonic-gate #define R_X86_64_NUM R_AMD64_NUM 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate #define ELF_AMD64_MAXPGSZ 0x100000 /* maximum page size */ 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate /* 1327c478bd9Sstevel@tonic-gate * processor specific section types 1337c478bd9Sstevel@tonic-gate */ 1347c478bd9Sstevel@tonic-gate #define SHT_AMD64_UNWIND 0x70000001 /* unwind information */ 1353fc1e289SBryan Cantrill #define SHT_X86_64_UNWIND SHT_AMD64_UNWIND 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate /* 1387c478bd9Sstevel@tonic-gate * NOTE: PT_SUNW_UNWIND is defined in the OS specific range 1397c478bd9Sstevel@tonic-gate * to conform with the amd64 psABI. 1407c478bd9Sstevel@tonic-gate */ 1417c478bd9Sstevel@tonic-gate 14254d82594Sseizo #define SHF_AMD64_LARGE 0x10000000 14354d82594Sseizo #define SHF_X86_64_LARGE SHF_AMD64_LARGE 1447c478bd9Sstevel@tonic-gate 14554d82594Sseizo #define SHN_AMD64_LCOMMON 0xff02 14654d82594Sseizo #define SHN_X86_64_LCOMMON SHN_AMD64_LCOMMON 14754d82594Sseizo 148d9452f23SEdward Pilatowicz /* 149d9452f23SEdward Pilatowicz * There are consumers of this file that want to include elf defines for 150d9452f23SEdward Pilatowicz * all architectures. This is a problem for the defines below, because 151d9452f23SEdward Pilatowicz * while they are architecture specific they have common names. Hence to 152d9452f23SEdward Pilatowicz * prevent attempts to redefine these variables we'll check if any of 153d9452f23SEdward Pilatowicz * the other elf architecture header files have been included. If 154d9452f23SEdward Pilatowicz * they have then we'll just stick with the existing definitions. 155d9452f23SEdward Pilatowicz */ 156d9452f23SEdward Pilatowicz #if defined(_SYS_ELF_MACH_386) 157d9452f23SEdward Pilatowicz 158d9452f23SEdward Pilatowicz /* 159d9452f23SEdward Pilatowicz * Plt and Got information; the first few .got and .plt entries are reserved 160d9452f23SEdward Pilatowicz * PLT[0] jump to dynamic linker 161d9452f23SEdward Pilatowicz * GOT[0] address of _DYNAMIC 162d9452f23SEdward Pilatowicz */ 163d9452f23SEdward Pilatowicz #define M64_WORD_ALIGN 8 164d9452f23SEdward Pilatowicz #define M64_PLT_ENTSIZE M32_PLT_ENTSIZE 165d9452f23SEdward Pilatowicz #define M64_PLT_ALIGN M64_WORD_ALIGN /* alignment of .plt section */ 166d9452f23SEdward Pilatowicz #define M64_GOT_ENTSIZE 8 /* got entry size in bytes */ 167d9452f23SEdward Pilatowicz #define M64_PLT_RESERVSZ M32_PLT_RESERVSZ 168d9452f23SEdward Pilatowicz 169d9452f23SEdward Pilatowicz /* 170d9452f23SEdward Pilatowicz * Make common alias for the 32/64 bit specific defines based on _ELF64 171d9452f23SEdward Pilatowicz */ 172d9452f23SEdward Pilatowicz #if defined(_ELF64) 173d9452f23SEdward Pilatowicz /* architecture common defines */ 174d9452f23SEdward Pilatowicz #define M_WORD_ALIGN M64_WORD_ALIGN 175d9452f23SEdward Pilatowicz #define M_PLT_ENTSIZE M64_PLT_ENTSIZE 176d9452f23SEdward Pilatowicz #define M_PLT_ALIGN M64_PLT_ALIGN 177d9452f23SEdward Pilatowicz #define M_PLT_RESERVSZ M64_PLT_RESERVSZ 178d9452f23SEdward Pilatowicz #define M_GOT_ENTSIZE M64_GOT_ENTSIZE 179d9452f23SEdward Pilatowicz #endif /* _ELF64 */ 180d9452f23SEdward Pilatowicz 181d9452f23SEdward Pilatowicz #endif /* _SYS_ELF_MACH_386 */ 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1847c478bd9Sstevel@tonic-gate } 1857c478bd9Sstevel@tonic-gate #endif 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate #endif /* _SYS_ELF_AMD64_H */ 188