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 55aefb655Srie * Common Development and Distribution License (the "License"). 65aefb655Srie * 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 /* 23de777a60Sab196087 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate /* 297c478bd9Sstevel@tonic-gate * String conversion routine for relocation types. 307c478bd9Sstevel@tonic-gate */ 317c478bd9Sstevel@tonic-gate #include <stdio.h> 327c478bd9Sstevel@tonic-gate #include <sys/elf_amd64.h> 337c478bd9Sstevel@tonic-gate #include "relocate_amd64_msg.h" 34c13de8f6Sab196087 #include "_conv.h" 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* 37552ff457Srie * AMD64 specific relocations. 387c478bd9Sstevel@tonic-gate */ 39552ff457Srie static const Msg rels[R_AMD64_NUM] = { 40552ff457Srie MSG_R_AMD64_NONE, MSG_R_AMD64_64, 41552ff457Srie MSG_R_AMD64_PC32, MSG_R_AMD64_GOT32, 42552ff457Srie MSG_R_AMD64_PLT32, MSG_R_AMD64_COPY, 43552ff457Srie MSG_R_AMD64_GLOB_DATA, MSG_R_AMD64_JUMP_SLOT, 44552ff457Srie MSG_R_AMD64_RELATIVE, MSG_R_AMD64_GOTPCREL, 45552ff457Srie MSG_R_AMD64_32, MSG_R_AMD64_32S, 46552ff457Srie MSG_R_AMD64_16, MSG_R_AMD64_PC16, 47552ff457Srie MSG_R_AMD64_8, MSG_R_AMD64_PC8, 48552ff457Srie MSG_R_AMD64_DTPMOD64, MSG_R_AMD64_DTPOFF64, 49552ff457Srie MSG_R_AMD64_TPOFF64, MSG_R_AMD64_TLSGD, 50552ff457Srie MSG_R_AMD64_TLSLD, MSG_R_AMD64_DTPOFF32, 51552ff457Srie MSG_R_AMD64_GOTTPOFF, MSG_R_AMD64_TPOFF32, 52552ff457Srie MSG_R_AMD64_PC64, MSG_R_AMD64_GOTOFF64, 53552ff457Srie MSG_R_AMD64_GOTPC32, MSG_R_AMD64_GOT64, 54552ff457Srie MSG_R_AMD64_GOTPCREL64, MSG_R_AMD64_GOTPC64, 552926dd2eSrie MSG_R_AMD64_GOTPLT64, MSG_R_AMD64_PLTOFF64, 562926dd2eSrie MSG_R_AMD64_SIZE32, MSG_R_AMD64_SIZE64 577c478bd9Sstevel@tonic-gate }; 587c478bd9Sstevel@tonic-gate 592926dd2eSrie #if (R_AMD64_NUM != (R_AMD64_SIZE64 + 1)) 607c478bd9Sstevel@tonic-gate #error "R_AMD64_NUM has grown" 617c478bd9Sstevel@tonic-gate #endif 627c478bd9Sstevel@tonic-gate 63552ff457Srie const char * 64*d29b2c44Sab196087 conv_reloc_amd64_type(Word type, Conv_fmt_flags_t fmt_flags, 65*d29b2c44Sab196087 Conv_inv_buf_t *inv_buf) 66552ff457Srie { 67552ff457Srie if (type >= R_AMD64_NUM) 68de777a60Sab196087 return (conv_invalid_val(inv_buf, type, fmt_flags)); 69552ff457Srie return (MSG_ORIG(rels[type])); 707c478bd9Sstevel@tonic-gate } 71