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
51618Srie * Common Development and Distribution License (the "License").
61618Srie * 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 /*
231618Srie * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
240Sstevel@tonic-gate * 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_AMD64_NUM] = {
321169Srie "R_AMD64_NONE", "R_AMD64_64",
331169Srie "R_AMD64_PC32", "R_AMD64_GOT32",
341169Srie "R_AMD64_PLT32", "R_AMD64_COPY",
351169Srie "R_AMD64_GLOB_DATA", "R_AMD64_JUMP_SLOT",
361169Srie "R_AMD64_RELATIVE", "R_AMD64_GOTPCREL",
371169Srie "R_AMD64_32", "R_AMD64_32S",
381169Srie "R_AMD64_16", "R_AMD64_PC16",
391169Srie "R_AMD64_8", "R_AMD64_PC8",
401169Srie "R_AMD64_DPTMOD64", "R_AMD64_DTPOFF64",
411169Srie "R_AMD64_TPOFF64", "R_AMD64_TLSGD",
421169Srie "R_AMD64_TLSLD", "R_AMD64_DTPOFF32",
431169Srie "R_AMD64_GOTTPOFF", "R_AMD64_TPOFF32",
441169Srie "R_AMD64_PC64", "R_AMD64_GOTOFF64",
451169Srie "R_AMD64_GOTPC32", "R_AMD64_GOT64",
461169Srie "R_AMD64_GOTPCREL64", "R_AMD64_GOTPC64",
47*2850Srie "R_AMD64_GOTPLT64", "R_AMD64_PLTOFF64",
48*2850Srie "R_AMD64_SIZE32", "R_AMD64_SIZE64"
491169Srie };
500Sstevel@tonic-gate
51*2850Srie #if (R_AMD64_NUM != (R_AMD64_SIZE64 + 1))
521169Srie #error "R_AMD64_NUM has grown"
530Sstevel@tonic-gate #endif
540Sstevel@tonic-gate
550Sstevel@tonic-gate /*
561169Srie * This is a 'stub' of the orignal version defined in liblddbg.so. This stub
571169Srie * returns the 'int string' of the relocation in question instead of converting
581169Srie * the relocation to it's full syntax.
590Sstevel@tonic-gate */
600Sstevel@tonic-gate const char *
conv_reloc_amd64_type(Word type)611618Srie conv_reloc_amd64_type(Word type)
620Sstevel@tonic-gate {
631169Srie static char strbuf[32];
641169Srie int ndx = 31;
651169Srie
661169Srie if (type < R_AMD64_NUM)
671169Srie return (rels[type]);
681169Srie
691169Srie strbuf[ndx--] = '\0';
701169Srie do {
711169Srie strbuf[ndx--] = '0' + (type % 10);
721169Srie type = type / 10;
731169Srie } while ((ndx >= (int)0) && (type > (Word)0));
741169Srie
751169Srie return (&strbuf[ndx + 1]);
760Sstevel@tonic-gate }
77