1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 #pragma ident "%Z%%M% %I% %E% SMI" 27 28 #include <sys/types.h> 29 #include "reloc.h" 30 31 static const char *rels[R_SPARC_NUM] = { 32 "R_SPARC_NONE", "R_SPARC_8", 33 "R_SPARC_16", "R_SPARC_32", 34 "R_SPARC_DISP8", "R_SPARC_DISP16", 35 "R_SPARC_DISP32", "R_SPARC_WDISP30", 36 "R_SPARC_WDISP22", "R_SPARC_HI22", 37 "R_SPARC_22", "R_SPARC_13", 38 "R_SPARC_LO10", "R_SPARC_GOT10", 39 "R_SPARC_GOT13", "R_SPARC_GOT22", 40 "R_SPARC_PC10", "R_SPARC_PC22", 41 "R_SPARC_WPLT30", "R_SPARC_COPY", 42 "R_SPARC_GLOB_DAT", "R_SPARC_JMP_SLOT", 43 "R_SPARC_RELATIVE", "R_SPARC_UA32", 44 "R_SPARC_PLT32", "R_SPARC_HIPLT22", 45 "R_SPARC_LOPLT10", "R_SPARC_PCPLT32", 46 "R_SPARC_PCPLT22", "R_SPARC_PCPLT10", 47 "R_SPARC_10", "R_SPARC_11", 48 "R_SPARC_64", "R_SPARC_OLO10", 49 "R_SPARC_HH22", "R_SPARC_HM10", 50 "R_SPARC_LM22", "R_SPARC_PC_HH22", 51 "R_SPARC_PC_HM10", "R_SPARC_PC_LM22", 52 "R_SPARC_WDISP16", "R_SPARC_WDISP19", 53 "R_SPARC_GLOB_JMP", "R_SPARC_7", 54 "R_SPARC_5", "R_SPARC_6", 55 "R_SPARC_DISP64", "R_SPARC_PLT64", 56 "R_SPARC_HIX22", "R_SPARC_LOX10", 57 "R_SPARC_H44", "R_SPARC_M44", 58 "R_SPARC_L44", "R_SPARC_REGISTER", 59 "R_SPARC_UA64", "R_SPARC_UA16", 60 "R_SPARC_TLS_GD_HI22", "R_SPARC_TLS_GD_LO10", 61 "R_SPARC_TLS_GD_ADD", "R_SPARC_TLS_GD_CALL", 62 "R_SPARC_TLS_LDM_HI22", "R_SPARC_TLS_LDM_LO10", 63 "R_SPARC_TLS_LDM_ADD", "R_SPARC_TLS_LDM_CALL", 64 "R_SPARC_TLS_LDO_HIX22", "R_SPARC_TLS_LDO_LOX10", 65 "R_SPARC_TLS_LDO_ADD", "R_SPARC_TLS_IE_HI22", 66 "R_SPARC_TLS_IE_LO10", "R_SPARC_TLS_IE_LD", 67 "R_SPARC_TLS_IE_LDX", "R_SPARC_TLS_IE_ADD", 68 "R_SPARC_TLS_LE_HIX22", "R_SPARC_TLS_LE_LOX10", 69 "R_SPARC_TLS_DTPMOD32", "R_SPARC_TLS_DTPMOD64", 70 "R_SPARC_TLS_DTPOFF32", "R_SPARC_TLS_DTPOFF64", 71 "R_SPARC_TLS_TPOFF32", "R_SPARC_TLS_TPOFF64", 72 "R_SPARC_GOTDATA_HIX22", "R_SPARC_GOTDATA_LOX10", 73 "R_SPARC_GOTDATA_OP_HIX22", "R_SPARC_GOTDATA_OP_LOX10", 74 "R_SPARC_GOTDATA_OP", "R_SPARC_H34" 75 }; 76 77 #if (R_SPARC_NUM != (R_SPARC_H34 + 1)) 78 #error "R_SPARC_NUM has grown" 79 #endif 80 81 /* 82 * This is a 'stub' of the orignal version defined in liblddbg.so. This stub 83 * returns the 'int string' of the relocation in question instead of converting 84 * the relocation to it's full syntax. 85 */ 86 const char * 87 conv_reloc_SPARC_type(Word type) 88 { 89 static char strbuf[32]; 90 int ndx = 31; 91 92 if (type < R_SPARC_NUM) 93 return (rels[type]); 94 95 strbuf[ndx--] = '\0'; 96 do { 97 strbuf[ndx--] = '0' + (type % 10); 98 type = type / 10; 99 } while ((ndx >= (int)0) && (type > (Word)0)); 100 101 return (&strbuf[ndx + 1]); 102 } 103