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 702926dd2eSrie #define R_AMD64_NUM 34 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate /* 742926dd2eSrie * The "System V Application Binary Interface, AMD64 Architecture Processor 752926dd2eSrie * Supplement", defines relocations in terms of R_X86_64_ rather than R_AMD64_. 762926dd2eSrie * Maintain both relocation naming conventions for compatibility. 777c478bd9Sstevel@tonic-gate */ 787c478bd9Sstevel@tonic-gate #define R_X86_64_NONE R_AMD64_NONE 797c478bd9Sstevel@tonic-gate #define R_X86_64_64 R_AMD64_64 807c478bd9Sstevel@tonic-gate #define R_X86_64_PC32 R_AMD64_PC32 817c478bd9Sstevel@tonic-gate #define R_X86_64_GOT32 R_AMD64_GOT32 827c478bd9Sstevel@tonic-gate #define R_X86_64_PLT32 R_AMD64_PLT32 837c478bd9Sstevel@tonic-gate #define R_X86_64_COPY R_AMD64_COPY 847c478bd9Sstevel@tonic-gate #define R_X86_64_GLOB_DAT R_AMD64_GLOB_DAT 857c478bd9Sstevel@tonic-gate #define R_X86_64_JUMP_SLOT R_AMD64_JUMP_SLOT 867c478bd9Sstevel@tonic-gate #define R_X86_64_RELATIVE R_AMD64_RELATIVE 877c478bd9Sstevel@tonic-gate #define R_X86_64_GOTPCREL R_AMD64_GOTPCREL 887c478bd9Sstevel@tonic-gate #define R_X86_64_32 R_AMD64_32 897c478bd9Sstevel@tonic-gate #define R_X86_64_32S R_AMD64_32S 907c478bd9Sstevel@tonic-gate #define R_X86_64_16 R_AMD64_16 917c478bd9Sstevel@tonic-gate #define R_X86_64_PC16 R_AMD64_PC16 927c478bd9Sstevel@tonic-gate #define R_X86_64_8 R_AMD64_8 937c478bd9Sstevel@tonic-gate #define R_X86_64_PC8 R_AMD64_PC8 947c478bd9Sstevel@tonic-gate #define R_X86_64_DTPMOD64 R_AMD64_DTPMOD64 957c478bd9Sstevel@tonic-gate #define R_X86_64_DTPOFF64 R_AMD64_DTPOFF64 967c478bd9Sstevel@tonic-gate #define R_X86_64_TPOFF64 R_AMD64_TPOFF64 977c478bd9Sstevel@tonic-gate #define R_X86_64_TLSGD R_AMD64_TLSGD 987c478bd9Sstevel@tonic-gate #define R_X86_64_TLSLD R_AMD64_TLSLD 997c478bd9Sstevel@tonic-gate #define R_X86_64_DTPOFF32 R_AMD64_DTPOFF32 1007c478bd9Sstevel@tonic-gate #define R_X86_64_GOTTPOFF R_AMD64_GOTTPOFF 1017c478bd9Sstevel@tonic-gate #define R_X86_64_TPOFF32 R_AMD64_TPOFF32 1027c478bd9Sstevel@tonic-gate #define R_X86_64_PC64 R_AMD64_PC64 1037c478bd9Sstevel@tonic-gate #define R_X86_64_GOTPC32 R_AMD64_GOTPC32 1047c478bd9Sstevel@tonic-gate #define R_X86_64_GOTOFF64 R_AMD64_GOTOFF64 105552ff457Srie #define R_X86_64_GOT64 R_AMD64_GOT64 106552ff457Srie #define R_X86_64_GOTPCREL64 R_AMD64_GOTPCREL64 107552ff457Srie #define R_X86_64_GOTPC64 R_AMD64_GOTPC64 108552ff457Srie #define R_X86_64_GOTPLT64 R_AMD64_GOTPLT64 109552ff457Srie #define R_X86_64_PLTOFF64 R_AMD64_PLTOFF64 1102926dd2eSrie #define R_X86_64_SIZE32 R_AMD64_SIZE32 1112926dd2eSrie #define R_X86_64_SIZE64 R_AMD64_SIZE64 1127c478bd9Sstevel@tonic-gate #define R_X86_64_NUM R_AMD64_NUM 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate #define ELF_AMD64_MAXPGSZ 0x100000 /* maximum page size */ 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate /* 1187c478bd9Sstevel@tonic-gate * processor specific section types 1197c478bd9Sstevel@tonic-gate */ 1207c478bd9Sstevel@tonic-gate #define SHT_AMD64_UNWIND 0x70000001 /* unwind information */ 121*3fc1e289SBryan Cantrill #define SHT_X86_64_UNWIND SHT_AMD64_UNWIND 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate /* 1247c478bd9Sstevel@tonic-gate * NOTE: PT_SUNW_UNWIND is defined in the OS specific range 1257c478bd9Sstevel@tonic-gate * to conform with the amd64 psABI. 1267c478bd9Sstevel@tonic-gate */ 1277c478bd9Sstevel@tonic-gate 12854d82594Sseizo #define SHF_AMD64_LARGE 0x10000000 12954d82594Sseizo #define SHF_X86_64_LARGE SHF_AMD64_LARGE 1307c478bd9Sstevel@tonic-gate 13154d82594Sseizo #define SHN_AMD64_LCOMMON 0xff02 13254d82594Sseizo #define SHN_X86_64_LCOMMON SHN_AMD64_LCOMMON 13354d82594Sseizo 134d9452f23SEdward Pilatowicz /* 135d9452f23SEdward Pilatowicz * There are consumers of this file that want to include elf defines for 136d9452f23SEdward Pilatowicz * all architectures. This is a problem for the defines below, because 137d9452f23SEdward Pilatowicz * while they are architecture specific they have common names. Hence to 138d9452f23SEdward Pilatowicz * prevent attempts to redefine these variables we'll check if any of 139d9452f23SEdward Pilatowicz * the other elf architecture header files have been included. If 140d9452f23SEdward Pilatowicz * they have then we'll just stick with the existing definitions. 141d9452f23SEdward Pilatowicz */ 142d9452f23SEdward Pilatowicz #if defined(_SYS_ELF_MACH_386) 143d9452f23SEdward Pilatowicz 144d9452f23SEdward Pilatowicz /* 145d9452f23SEdward Pilatowicz * Plt and Got information; the first few .got and .plt entries are reserved 146d9452f23SEdward Pilatowicz * PLT[0] jump to dynamic linker 147d9452f23SEdward Pilatowicz * GOT[0] address of _DYNAMIC 148d9452f23SEdward Pilatowicz */ 149d9452f23SEdward Pilatowicz #define M64_WORD_ALIGN 8 150d9452f23SEdward Pilatowicz #define M64_PLT_ENTSIZE M32_PLT_ENTSIZE 151d9452f23SEdward Pilatowicz #define M64_PLT_ALIGN M64_WORD_ALIGN /* alignment of .plt section */ 152d9452f23SEdward Pilatowicz #define M64_GOT_ENTSIZE 8 /* got entry size in bytes */ 153d9452f23SEdward Pilatowicz #define M64_PLT_RESERVSZ M32_PLT_RESERVSZ 154d9452f23SEdward Pilatowicz 155d9452f23SEdward Pilatowicz /* 156d9452f23SEdward Pilatowicz * Make common alias for the 32/64 bit specific defines based on _ELF64 157d9452f23SEdward Pilatowicz */ 158d9452f23SEdward Pilatowicz #if defined(_ELF64) 159d9452f23SEdward Pilatowicz /* architecture common defines */ 160d9452f23SEdward Pilatowicz #define M_WORD_ALIGN M64_WORD_ALIGN 161d9452f23SEdward Pilatowicz #define M_PLT_ENTSIZE M64_PLT_ENTSIZE 162d9452f23SEdward Pilatowicz #define M_PLT_ALIGN M64_PLT_ALIGN 163d9452f23SEdward Pilatowicz #define M_PLT_RESERVSZ M64_PLT_RESERVSZ 164d9452f23SEdward Pilatowicz #define M_GOT_ENTSIZE M64_GOT_ENTSIZE 165d9452f23SEdward Pilatowicz #endif /* _ELF64 */ 166d9452f23SEdward Pilatowicz 167d9452f23SEdward Pilatowicz #endif /* _SYS_ELF_MACH_386 */ 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1707c478bd9Sstevel@tonic-gate } 1717c478bd9Sstevel@tonic-gate #endif 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate #endif /* _SYS_ELF_AMD64_H */ 174