relocate_amd64.c revision 5088:26c540f30cd3
1226048Sobrien/* 2159764Sobrien * CDDL HEADER START 3330569Sgordon * 4159764Sobrien * The contents of this file are subject to the terms of the 568349Sobrien * Common Development and Distribution License (the "License"). 668349Sobrien * You may not use this file except in compliance with the License. 768349Sobrien * 8234250Sobrien * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9234250Sobrien * or http://www.opensolaris.org/os/licensing. 1068349Sobrien * See the License for the specific language governing permissions 11234250Sobrien * and limitations under the License. 12234250Sobrien * 13234250Sobrien * When distributing Covered Code, include this CDDL HEADER in each 14234250Sobrien * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15234250Sobrien * If applicable, add the following below this CDDL HEADER, with the 16234250Sobrien * fields enclosed by brackets "[]" replaced with your own identifying 17234250Sobrien * information: Portions Copyright [yyyy] [name of copyright owner] 1868349Sobrien * 19234250Sobrien * CDDL HEADER END 20234250Sobrien */ 21234250Sobrien 22234250Sobrien/* 23234250Sobrien * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24234250Sobrien * Use is subject to license terms. 25159764Sobrien */ 26234250Sobrien#pragma ident "%Z%%M% %I% %E% SMI" 27133359Sobrien 28133359Sobrien/* 29133359Sobrien * String conversion routine for relocation types. 30133359Sobrien */ 31186690Sobrien#include <stdio.h> 32159764Sobrien#include <sys/elf_amd64.h> 33186690Sobrien#include "relocate_amd64_msg.h" 34186690Sobrien#include "_conv.h" 35133359Sobrien 36133359Sobrien/* 37330569Sgordon * AMD64 specific relocations. 38330569Sgordon */ 39330569Sgordonstatic const Msg rels[R_AMD64_NUM] = { 40330569Sgordon MSG_R_AMD64_NONE, MSG_R_AMD64_64, 41133359Sobrien MSG_R_AMD64_PC32, MSG_R_AMD64_GOT32, 42330569Sgordon MSG_R_AMD64_PLT32, MSG_R_AMD64_COPY, 43267843Sdelphij MSG_R_AMD64_GLOB_DATA, MSG_R_AMD64_JUMP_SLOT, 44267843Sdelphij MSG_R_AMD64_RELATIVE, MSG_R_AMD64_GOTPCREL, 45267843Sdelphij MSG_R_AMD64_32, MSG_R_AMD64_32S, 46267843Sdelphij MSG_R_AMD64_16, MSG_R_AMD64_PC16, 47267843Sdelphij MSG_R_AMD64_8, MSG_R_AMD64_PC8, 48267843Sdelphij MSG_R_AMD64_DTPMOD64, MSG_R_AMD64_DTPOFF64, 49267843Sdelphij MSG_R_AMD64_TPOFF64, MSG_R_AMD64_TLSGD, 50267843Sdelphij MSG_R_AMD64_TLSLD, MSG_R_AMD64_DTPOFF32, 51267843Sdelphij MSG_R_AMD64_GOTTPOFF, MSG_R_AMD64_TPOFF32, 52267843Sdelphij MSG_R_AMD64_PC64, MSG_R_AMD64_GOTOFF64, 53267843Sdelphij MSG_R_AMD64_GOTPC32, MSG_R_AMD64_GOT64, 54267843Sdelphij MSG_R_AMD64_GOTPCREL64, MSG_R_AMD64_GOTPC64, 55267843Sdelphij MSG_R_AMD64_GOTPLT64, MSG_R_AMD64_PLTOFF64, 56267843Sdelphij MSG_R_AMD64_SIZE32, MSG_R_AMD64_SIZE64 57267843Sdelphij}; 58267843Sdelphij 59267843Sdelphij#if (R_AMD64_NUM != (R_AMD64_SIZE64 + 1)) 60267843Sdelphij#error "R_AMD64_NUM has grown" 61267843Sdelphij#endif 62267843Sdelphij 63267843Sdelphijconst char * 64267843Sdelphijconv_reloc_amd64_type(Word type, Conv_fmt_flags_t fmt_flags, 65267843Sdelphij Conv_inv_buf_t *inv_buf) 66267843Sdelphij{ 67267843Sdelphij if (type >= R_AMD64_NUM) 68267843Sdelphij return (conv_invalid_val(inv_buf, type, fmt_flags)); 69133359Sobrien return (MSG_ORIG(rels[type])); 70133359Sobrien} 71133359Sobrien