Lines Matching full:coff
1 //===-- COFFDumper.cpp - COFF-specific dumper -------------------*- C++ -*-===//
11 /// \brief This file implements the COFF-specific dumper for llvm-readobj.
23 #include "llvm/Object/COFF.h"
25 #include "llvm/Support/COFF.h"
132 static const EnumEntry<COFF::MachineTypes> ImageFileMachineType[] = {
133 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_UNKNOWN ),
134 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_AM33 ),
135 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_AMD64 ),
136 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_ARM ),
137 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_ARMNT ),
138 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_EBC ),
139 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_I386 ),
140 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_IA64 ),
141 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_M32R ),
142 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_MIPS16 ),
143 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_MIPSFPU ),
144 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_MIPSFPU16),
145 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_POWERPC ),
146 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_POWERPCFP),
147 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_R4000 ),
148 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_SH3 ),
149 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_SH3DSP ),
150 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_SH4 ),
151 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_SH5 ),
152 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_THUMB ),
153 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_WCEMIPSV2)
156 static const EnumEntry<COFF::Characteristics> ImageFileCharacteristics[] = {
157 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_RELOCS_STRIPPED ),
158 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_EXECUTABLE_IMAGE ),
159 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_LINE_NUMS_STRIPPED ),
160 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_LOCAL_SYMS_STRIPPED ),
161 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_AGGRESSIVE_WS_TRIM ),
162 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_LARGE_ADDRESS_AWARE ),
163 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_BYTES_REVERSED_LO ),
164 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_32BIT_MACHINE ),
165 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_DEBUG_STRIPPED ),
166 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP),
167 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_NET_RUN_FROM_SWAP ),
168 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_SYSTEM ),
169 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_DLL ),
170 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_UP_SYSTEM_ONLY ),
171 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_BYTES_REVERSED_HI )
174 static const EnumEntry<COFF::WindowsSubsystem> PEWindowsSubsystem[] = {
175 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_UNKNOWN ),
176 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_NATIVE ),
177 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_WINDOWS_GUI ),
178 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_WINDOWS_CUI ),
179 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_POSIX_CUI ),
180 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_WINDOWS_CE_GUI ),
181 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_EFI_APPLICATION ),
182 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER),
183 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER ),
184 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_EFI_ROM ),
185 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_XBOX ),
188 static const EnumEntry<COFF::DLLCharacteristics> PEDLLCharacteristics[] = {
189 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA ),
190 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE ),
191 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY ),
192 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT ),
193 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION ),
194 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_NO_SEH ),
195 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_NO_BIND ),
196 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_APPCONTAINER ),
197 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER ),
198 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_GUARD_CF ),
199 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE),
202 static const EnumEntry<COFF::SectionCharacteristics>
204 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_TYPE_NO_PAD ),
205 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_CNT_CODE ),
206 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_CNT_INITIALIZED_DATA ),
207 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_CNT_UNINITIALIZED_DATA),
208 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_LNK_OTHER ),
209 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_LNK_INFO ),
210 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_LNK_REMOVE ),
211 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_LNK_COMDAT ),
212 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_GPREL ),
213 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_PURGEABLE ),
214 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_16BIT ),
215 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_LOCKED ),
216 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_PRELOAD ),
217 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_1BYTES ),
218 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_2BYTES ),
219 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_4BYTES ),
220 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_8BYTES ),
221 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_16BYTES ),
222 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_32BYTES ),
223 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_64BYTES ),
224 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_128BYTES ),
225 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_256BYTES ),
226 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_512BYTES ),
227 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_1024BYTES ),
228 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_2048BYTES ),
229 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_4096BYTES ),
230 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_8192BYTES ),
231 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_LNK_NRELOC_OVFL ),
232 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_DISCARDABLE ),
233 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_NOT_CACHED ),
234 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_NOT_PAGED ),
235 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_SHARED ),
236 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_EXECUTE ),
237 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_READ ),
238 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_WRITE )
241 static const EnumEntry<COFF::SymbolBaseType> ImageSymType[] = {
242 { "Null" , COFF::IMAGE_SYM_TYPE_NULL },
243 { "Void" , COFF::IMAGE_SYM_TYPE_VOID },
244 { "Char" , COFF::IMAGE_SYM_TYPE_CHAR },
245 { "Short" , COFF::IMAGE_SYM_TYPE_SHORT },
246 { "Int" , COFF::IMAGE_SYM_TYPE_INT },
247 { "Long" , COFF::IMAGE_SYM_TYPE_LONG },
248 { "Float" , COFF::IMAGE_SYM_TYPE_FLOAT },
249 { "Double", COFF::IMAGE_SYM_TYPE_DOUBLE },
250 { "Struct", COFF::IMAGE_SYM_TYPE_STRUCT },
251 { "Union" , COFF::IMAGE_SYM_TYPE_UNION },
252 { "Enum" , COFF::IMAGE_SYM_TYPE_ENUM },
253 { "MOE" , COFF::IMAGE_SYM_TYPE_MOE },
254 { "Byte" , COFF::IMAGE_SYM_TYPE_BYTE },
255 { "Word" , COFF::IMAGE_SYM_TYPE_WORD },
256 { "UInt" , COFF::IMAGE_SYM_TYPE_UINT },
257 { "DWord" , COFF::IMAGE_SYM_TYPE_DWORD }
260 static const EnumEntry<COFF::SymbolComplexType> ImageSymDType[] = {
261 { "Null" , COFF::IMAGE_SYM_DTYPE_NULL },
262 { "Pointer" , COFF::IMAGE_SYM_DTYPE_POINTER },
263 { "Function", COFF::IMAGE_SYM_DTYPE_FUNCTION },
264 { "Array" , COFF::IMAGE_SYM_DTYPE_ARRAY }
267 static const EnumEntry<COFF::SymbolStorageClass> ImageSymClass[] = {
268 { "EndOfFunction" , COFF::IMAGE_SYM_CLASS_END_OF_FUNCTION },
269 { "Null" , COFF::IMAGE_SYM_CLASS_NULL },
270 { "Automatic" , COFF::IMAGE_SYM_CLASS_AUTOMATIC },
271 { "External" , COFF::IMAGE_SYM_CLASS_EXTERNAL },
272 { "Static" , COFF::IMAGE_SYM_CLASS_STATIC },
273 { "Register" , COFF::IMAGE_SYM_CLASS_REGISTER },
274 { "ExternalDef" , COFF::IMAGE_SYM_CLASS_EXTERNAL_DEF },
275 { "Label" , COFF::IMAGE_SYM_CLASS_LABEL },
276 { "UndefinedLabel" , COFF::IMAGE_SYM_CLASS_UNDEFINED_LABEL },
277 { "MemberOfStruct" , COFF::IMAGE_SYM_CLASS_MEMBER_OF_STRUCT },
278 { "Argument" , COFF::IMAGE_SYM_CLASS_ARGUMENT },
279 { "StructTag" , COFF::IMAGE_SYM_CLASS_STRUCT_TAG },
280 { "MemberOfUnion" , COFF::IMAGE_SYM_CLASS_MEMBER_OF_UNION },
281 { "UnionTag" , COFF::IMAGE_SYM_CLASS_UNION_TAG },
282 { "TypeDefinition" , COFF::IMAGE_SYM_CLASS_TYPE_DEFINITION },
283 { "UndefinedStatic", COFF::IMAGE_SYM_CLASS_UNDEFINED_STATIC },
284 { "EnumTag" , COFF::IMAGE_SYM_CLASS_ENUM_TAG },
285 { "MemberOfEnum" , COFF::IMAGE_SYM_CLASS_MEMBER_OF_ENUM },
286 { "RegisterParam" , COFF::IMAGE_SYM_CLASS_REGISTER_PARAM },
287 { "BitField" , COFF::IMAGE_SYM_CLASS_BIT_FIELD },
288 { "Block" , COFF::IMAGE_SYM_CLASS_BLOCK },
289 { "Function" , COFF::IMAGE_SYM_CLASS_FUNCTION },
290 { "EndOfStruct" , COFF::IMAGE_SYM_CLASS_END_OF_STRUCT },
291 { "File" , COFF::IMAGE_SYM_CLASS_FILE },
292 { "Section" , COFF::IMAGE_SYM_CLASS_SECTION },
293 { "WeakExternal" , COFF::IMAGE_SYM_CLASS_WEAK_EXTERNAL },
294 { "CLRToken" , COFF::IMAGE_SYM_CLASS_CLR_TOKEN }
297 static const EnumEntry<COFF::COMDATType> ImageCOMDATSelect[] = {
298 { "NoDuplicates", COFF::IMAGE_COMDAT_SELECT_NODUPLICATES },
299 { "Any" , COFF::IMAGE_COMDAT_SELECT_ANY },
300 { "SameSize" , COFF::IMAGE_COMDAT_SELECT_SAME_SIZE },
301 { "ExactMatch" , COFF::IMAGE_COMDAT_SELECT_EXACT_MATCH },
302 { "Associative" , COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE },
303 { "Largest" , COFF::IMAGE_COMDAT_SELECT_LARGEST },
304 { "Newest" , COFF::IMAGE_COMDAT_SELECT_NEWEST }
307 static const EnumEntry<COFF::WeakExternalCharacteristics>
309 { "NoLibrary", COFF::IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY },
310 { "Library" , COFF::IMAGE_WEAK_EXTERN_SEARCH_LIBRARY },
311 { "Alias" , COFF::IMAGE_WEAK_EXTERN_SEARCH_ALIAS }
345 // Print COFF header
452 if (Magic != COFF::DEBUG_SECTION_MAGIC) {
477 case COFF::DEBUG_LINE_TABLE_SUBSECTION: {
504 case COFF::DEBUG_STRING_TABLE_SUBSECTION:
513 case COFF::DEBUG_INDEX_SUBSECTION:
620 COFF::SectionCharacteristics(0x00F00000));
792 Symbol->NumberOfAuxSymbols * COFF::SymbolSize);
809 if (Section && Section->Characteristics & COFF::IMAGE_SCN_LNK_COMDAT
810 && Aux->Selection == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE) {
855 case COFF::IMAGE_FILE_MACHINE_AMD64: {
867 case COFF::IMAGE_FILE_MACHINE_ARMNT: {