10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*1618Srie * Common Development and Distribution License (the "License"). 6*1618Srie * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 211169Srie 220Sstevel@tonic-gate /* 23*1618Srie * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 241169Srie * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 270Sstevel@tonic-gate 280Sstevel@tonic-gate #include <sys/types.h> 290Sstevel@tonic-gate #include "reloc.h" 300Sstevel@tonic-gate 311169Srie static const char *rels[R_SPARC_NUM] = { 321169Srie "R_SPARC_NONE", "R_SPARC_8", 331169Srie "R_SPARC_16", "R_SPARC_32", 341169Srie "R_SPARC_DISP8", "R_SPARC_DISP16", 351169Srie "R_SPARC_DISP32", "R_SPARC_WDISP30", 361169Srie "R_SPARC_WDISP22", "R_SPARC_HI22", 371169Srie "R_SPARC_22", "R_SPARC_13", 381169Srie "R_SPARC_LO10", "R_SPARC_GOT10", 391169Srie "R_SPARC_GOT13", "R_SPARC_GOT22", 401169Srie "R_SPARC_PC10", "R_SPARC_PC22", 411169Srie "R_SPARC_WPLT30", "R_SPARC_COPY", 421169Srie "R_SPARC_GLOB_DAT", "R_SPARC_JMP_SLOT", 431169Srie "R_SPARC_RELATIVE", "R_SPARC_UA32", 441169Srie "R_SPARC_PLT32", "R_SPARC_HIPLT22", 451169Srie "R_SPARC_LOPLT10", "R_SPARC_PCPLT32", 461169Srie "R_SPARC_PCPLT22", "R_SPARC_PCPLT10", 471169Srie "R_SPARC_10", "R_SPARC_11", 481169Srie "R_SPARC_64", "R_SPARC_OLO10", 491169Srie "R_SPARC_HH22", "R_SPARC_HM10", 501169Srie "R_SPARC_LM22", "R_SPARC_PC_HH22", 511169Srie "R_SPARC_PC_HM10", "R_SPARC_PC_LM22", 521169Srie "R_SPARC_WDISP16", "R_SPARC_WDISP19", 531169Srie "R_SPARC_GLOB_JMP", "R_SPARC_7", 541169Srie "R_SPARC_5", "R_SPARC_6", 551169Srie "R_SPARC_DISP64", "R_SPARC_PLT64", 561169Srie "R_SPARC_HIX22", "R_SPARC_LOX10", 571169Srie "R_SPARC_H44", "R_SPARC_M44", 581169Srie "R_SPARC_L44", "R_SPARC_REGISTER", 591169Srie "R_SPARC_UA64", "R_SPARC_UA16", 601169Srie "R_SPARC_TLS_GD_HI22", "R_SPARC_TLS_GD_LO10", 611169Srie "R_SPARC_TLS_GD_ADD", "R_SPARC_TLS_GD_CALL", 621169Srie "R_SPARC_TLS_LDM_HI22", "R_SPARC_TLS_LDM_LO10", 631169Srie "R_SPARC_TLS_LDM_ADD", "R_SPARC_TLS_LDM_CALL", 641169Srie "R_SPARC_TLS_LDO_HIX22", "R_SPARC_TLS_LDO_LOX10", 651169Srie "R_SPARC_TLS_LDO_ADD", "R_SPARC_TLS_IE_HI22", 661169Srie "R_SPARC_TLS_IE_LO10", "R_SPARC_TLS_IE_LD", 671169Srie "R_SPARC_TLS_IE_LDX", "R_SPARC_TLS_IE_ADD", 681169Srie "R_SPARC_TLS_LE_HIX22", "R_SPARC_TLS_LE_LOX10", 691169Srie "R_SPARC_TLS_DTPMOD32", "R_SPARC_TLS_DTPMOD64", 701169Srie "R_SPARC_TLS_DTPOFF32", "R_SPARC_TLS_DTPOFF64", 711169Srie "R_SPARC_TLS_TPOFF32", "R_SPARC_TLS_TPOFF64", 721169Srie "R_SPARC_GOTDATA_HIX22", "R_SPARC_GOTDATA_LOX10", 731169Srie "R_SPARC_GOTDATA_OP_HIX22", "R_SPARC_GOTDATA_OP_LOX10", 741169Srie "R_SPARC_GOTDATA_OP", "R_SPARC_H34" 751169Srie }; 760Sstevel@tonic-gate 771169Srie #if (R_SPARC_NUM != (R_SPARC_H34 + 1)) 781169Srie #error "R_SPARC_NUM has grown" 790Sstevel@tonic-gate #endif 800Sstevel@tonic-gate 810Sstevel@tonic-gate /* 821169Srie * This is a 'stub' of the orignal version defined in liblddbg.so. This stub 831169Srie * returns the 'int string' of the relocation in question instead of converting 841169Srie * the relocation to it's full syntax. 850Sstevel@tonic-gate */ 860Sstevel@tonic-gate const char * 87*1618Srie conv_reloc_SPARC_type(Word type) 880Sstevel@tonic-gate { 891169Srie static char strbuf[32]; 901169Srie int ndx = 31; 911169Srie 921169Srie if (type < R_SPARC_NUM) 931169Srie return (rels[type]); 941169Srie 951169Srie strbuf[ndx--] = '\0'; 961169Srie do { 971169Srie strbuf[ndx--] = '0' + (type % 10); 981169Srie type = type / 10; 991169Srie } while ((ndx >= (int)0) && (type > (Word)0)); 1001169Srie 1011169Srie return (&strbuf[ndx + 1]); 1020Sstevel@tonic-gate } 103