00001 /* 00002 * See the dyninst/COPYRIGHT file for copyright information. 00003 * 00004 * We provide the Paradyn Tools (below described as "Paradyn") 00005 * on an AS IS basis, and do not warrant its validity or performance. 00006 * We reserve the right to update, modify, or discontinue this 00007 * software at any time. We shall have no obligation to supply such 00008 * updates or modifications or any other form of support to you. 00009 * 00010 * By your use of Paradyn, you understand and agree that we (or any 00011 * other person or entity with proprietary rights in Paradyn) are 00012 * under no obligation to provide either maintenance services, 00013 * update services, notices of latent defects, or correction of 00014 * defects for Paradyn. 00015 * 00016 * This library is free software; you can redistribute it and/or 00017 * modify it under the terms of the GNU Lesser General Public 00018 * License as published by the Free Software Foundation; either 00019 * version 2.1 of the License, or (at your option) any later version. 00020 * 00021 * This library is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00024 * Lesser General Public License for more details. 00025 * 00026 * You should have received a copy of the GNU Lesser General Public 00027 * License along with this library; if not, write to the Free Software 00028 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00029 */ 00030 00031 /* Functions of the relocationEntry class specific to x86 ELF */ 00032 #include "Symtab.h" 00033 #include "Serialization.h" 00034 #include "annotations.h" 00035 #include <elf.h> 00036 00037 #if defined(os_freebsd) 00038 #define R_X86_64_JUMP_SLOT R_X86_64_JMP_SLOT 00039 #endif 00040 00041 static const unsigned X86_64_WIDTH = 8; 00042 00043 const char* relocationEntry::relType2Str(unsigned long r, unsigned addressWidth) { 00044 if( X86_64_WIDTH == addressWidth ) { 00045 switch(r) { 00046 CASE_RETURN_STR(R_X86_64_NONE); 00047 CASE_RETURN_STR(R_X86_64_64); 00048 CASE_RETURN_STR(R_X86_64_PC32); 00049 CASE_RETURN_STR(R_X86_64_GOT32); 00050 CASE_RETURN_STR(R_X86_64_PLT32); 00051 CASE_RETURN_STR(R_X86_64_COPY); 00052 CASE_RETURN_STR(R_X86_64_GLOB_DAT); 00053 CASE_RETURN_STR(R_X86_64_RELATIVE); 00054 #if defined(R_X86_64_IRELATIVE) 00055 CASE_RETURN_STR(R_X86_64_IRELATIVE); 00056 #endif 00057 CASE_RETURN_STR(R_X86_64_GOTPCREL); 00058 CASE_RETURN_STR(R_X86_64_32); 00059 CASE_RETURN_STR(R_X86_64_32S); 00060 CASE_RETURN_STR(R_X86_64_16); 00061 CASE_RETURN_STR(R_X86_64_PC16); 00062 CASE_RETURN_STR(R_X86_64_8); 00063 CASE_RETURN_STR(R_X86_64_PC8); 00064 CASE_RETURN_STR(R_X86_64_DTPMOD64); 00065 CASE_RETURN_STR(R_X86_64_DTPOFF64); 00066 CASE_RETURN_STR(R_X86_64_TPOFF64); 00067 CASE_RETURN_STR(R_X86_64_TLSGD); 00068 CASE_RETURN_STR(R_X86_64_TLSLD); 00069 CASE_RETURN_STR(R_X86_64_DTPOFF32); 00070 CASE_RETURN_STR(R_X86_64_GOTTPOFF); 00071 CASE_RETURN_STR(R_X86_64_TPOFF32); 00072 CASE_RETURN_STR(R_X86_64_JUMP_SLOT); 00073 default: 00074 return "?"; 00075 } 00076 }else{ 00077 switch(r) { 00078 CASE_RETURN_STR(R_386_NONE); 00079 CASE_RETURN_STR(R_386_32); 00080 CASE_RETURN_STR(R_386_PC32); 00081 CASE_RETURN_STR(R_386_GOT32); 00082 CASE_RETURN_STR(R_386_PLT32); 00083 CASE_RETURN_STR(R_386_COPY); 00084 CASE_RETURN_STR(R_386_GLOB_DAT); 00085 CASE_RETURN_STR(R_386_JMP_SLOT); 00086 CASE_RETURN_STR(R_386_RELATIVE); 00087 CASE_RETURN_STR(R_386_GOTOFF); 00088 CASE_RETURN_STR(R_386_GOTPC); 00089 CASE_RETURN_STR(R_386_TLS_TPOFF); 00090 CASE_RETURN_STR(R_386_TLS_IE); 00091 CASE_RETURN_STR(R_386_TLS_GOTIE); 00092 CASE_RETURN_STR(R_386_TLS_LE); 00093 CASE_RETURN_STR(R_386_TLS_GD); 00094 CASE_RETURN_STR(R_386_TLS_LDM); 00095 CASE_RETURN_STR(R_386_TLS_GD_32); 00096 CASE_RETURN_STR(R_386_TLS_GD_PUSH); 00097 CASE_RETURN_STR(R_386_TLS_GD_CALL); 00098 CASE_RETURN_STR(R_386_TLS_GD_POP); 00099 CASE_RETURN_STR(R_386_TLS_LDM_32); 00100 CASE_RETURN_STR(R_386_TLS_LDM_PUSH); 00101 CASE_RETURN_STR(R_386_TLS_LDM_CALL); 00102 CASE_RETURN_STR(R_386_TLS_LDM_POP); 00103 CASE_RETURN_STR(R_386_TLS_LDO_32); 00104 CASE_RETURN_STR(R_386_TLS_IE_32); 00105 CASE_RETURN_STR(R_386_TLS_LE_32); 00106 CASE_RETURN_STR(R_386_TLS_DTPMOD32); 00107 CASE_RETURN_STR(R_386_TLS_DTPOFF32); 00108 CASE_RETURN_STR(R_386_TLS_TPOFF32); 00109 #if !defined(os_freebsd) 00110 CASE_RETURN_STR(R_386_16); 00111 CASE_RETURN_STR(R_386_PC16); 00112 CASE_RETURN_STR(R_386_8); 00113 CASE_RETURN_STR(R_386_PC8); 00114 CASE_RETURN_STR(R_386_32PLT); 00115 #endif 00116 default: 00117 return "?"; 00118 } 00119 } 00120 } 00121 00122 SYMTAB_EXPORT unsigned long relocationEntry::getGlobalRelType(unsigned addressWidth, Symbol *) { 00123 if( X86_64_WIDTH == addressWidth ) { 00124 return R_X86_64_GLOB_DAT; 00125 }else{ 00126 return R_386_GLOB_DAT; 00127 } 00128 } 00129
1.6.1