Lines Matching full:coff
1 //===-- COFFDumper.cpp - COFF-specific dumper -------------------*- C++ -*-===//
11 /// \brief This file implements the COFF-specific dumper for llvm-readobj.
37 #include "llvm/Object/COFF.h"
39 #include "llvm/Support/COFF.h"
287 static const EnumEntry<COFF::MachineTypes> ImageFileMachineType[] = {
288 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_UNKNOWN ),
289 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_AM33 ),
290 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_AMD64 ),
291 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_ARM ),
292 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_ARMNT ),
293 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_EBC ),
294 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_I386 ),
295 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_IA64 ),
296 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_M32R ),
297 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_MIPS16 ),
298 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_MIPSFPU ),
299 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_MIPSFPU16),
300 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_POWERPC ),
301 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_POWERPCFP),
302 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_R4000 ),
303 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_SH3 ),
304 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_SH3DSP ),
305 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_SH4 ),
306 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_SH5 ),
307 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_THUMB ),
308 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_MACHINE_WCEMIPSV2)
311 static const EnumEntry<COFF::Characteristics> ImageFileCharacteristics[] = {
312 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_RELOCS_STRIPPED ),
313 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_EXECUTABLE_IMAGE ),
314 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_LINE_NUMS_STRIPPED ),
315 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_LOCAL_SYMS_STRIPPED ),
316 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_AGGRESSIVE_WS_TRIM ),
317 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_LARGE_ADDRESS_AWARE ),
318 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_BYTES_REVERSED_LO ),
319 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_32BIT_MACHINE ),
320 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_DEBUG_STRIPPED ),
321 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP),
322 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_NET_RUN_FROM_SWAP ),
323 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_SYSTEM ),
324 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_DLL ),
325 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_UP_SYSTEM_ONLY ),
326 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_FILE_BYTES_REVERSED_HI )
329 static const EnumEntry<COFF::WindowsSubsystem> PEWindowsSubsystem[] = {
330 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_UNKNOWN ),
331 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_NATIVE ),
332 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_WINDOWS_GUI ),
333 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_WINDOWS_CUI ),
334 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_POSIX_CUI ),
335 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_WINDOWS_CE_GUI ),
336 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_EFI_APPLICATION ),
337 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER),
338 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER ),
339 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_EFI_ROM ),
340 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SUBSYSTEM_XBOX ),
343 static const EnumEntry<COFF::DLLCharacteristics> PEDLLCharacteristics[] = {
344 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA ),
345 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE ),
346 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY ),
347 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT ),
348 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION ),
349 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_NO_SEH ),
350 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_NO_BIND ),
351 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_APPCONTAINER ),
352 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER ),
353 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_GUARD_CF ),
354 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE),
357 static const EnumEntry<COFF::SectionCharacteristics>
359 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_TYPE_NOLOAD ),
360 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_TYPE_NO_PAD ),
361 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_CNT_CODE ),
362 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_CNT_INITIALIZED_DATA ),
363 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_CNT_UNINITIALIZED_DATA),
364 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_LNK_OTHER ),
365 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_LNK_INFO ),
366 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_LNK_REMOVE ),
367 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_LNK_COMDAT ),
368 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_GPREL ),
369 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_PURGEABLE ),
370 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_16BIT ),
371 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_LOCKED ),
372 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_PRELOAD ),
373 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_1BYTES ),
374 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_2BYTES ),
375 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_4BYTES ),
376 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_8BYTES ),
377 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_16BYTES ),
378 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_32BYTES ),
379 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_64BYTES ),
380 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_128BYTES ),
381 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_256BYTES ),
382 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_512BYTES ),
383 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_1024BYTES ),
384 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_2048BYTES ),
385 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_4096BYTES ),
386 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_8192BYTES ),
387 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_LNK_NRELOC_OVFL ),
388 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_DISCARDABLE ),
389 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_NOT_CACHED ),
390 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_NOT_PAGED ),
391 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_SHARED ),
392 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_EXECUTE ),
393 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_READ ),
394 LLVM_READOBJ_ENUM_ENT(COFF, IMAGE_SCN_MEM_WRITE )
397 static const EnumEntry<COFF::SymbolBaseType> ImageSymType[] = {
398 { "Null" , COFF::IMAGE_SYM_TYPE_NULL },
399 { "Void" , COFF::IMAGE_SYM_TYPE_VOID },
400 { "Char" , COFF::IMAGE_SYM_TYPE_CHAR },
401 { "Short" , COFF::IMAGE_SYM_TYPE_SHORT },
402 { "Int" , COFF::IMAGE_SYM_TYPE_INT },
403 { "Long" , COFF::IMAGE_SYM_TYPE_LONG },
404 { "Float" , COFF::IMAGE_SYM_TYPE_FLOAT },
405 { "Double", COFF::IMAGE_SYM_TYPE_DOUBLE },
406 { "Struct", COFF::IMAGE_SYM_TYPE_STRUCT },
407 { "Union" , COFF::IMAGE_SYM_TYPE_UNION },
408 { "Enum" , COFF::IMAGE_SYM_TYPE_ENUM },
409 { "MOE" , COFF::IMAGE_SYM_TYPE_MOE },
410 { "Byte" , COFF::IMAGE_SYM_TYPE_BYTE },
411 { "Word" , COFF::IMAGE_SYM_TYPE_WORD },
412 { "UInt" , COFF::IMAGE_SYM_TYPE_UINT },
413 { "DWord" , COFF::IMAGE_SYM_TYPE_DWORD }
416 static const EnumEntry<COFF::SymbolComplexType> ImageSymDType[] = {
417 { "Null" , COFF::IMAGE_SYM_DTYPE_NULL },
418 { "Pointer" , COFF::IMAGE_SYM_DTYPE_POINTER },
419 { "Function", COFF::IMAGE_SYM_DTYPE_FUNCTION },
420 { "Array" , COFF::IMAGE_SYM_DTYPE_ARRAY }
423 static const EnumEntry<COFF::SymbolStorageClass> ImageSymClass[] = {
424 { "EndOfFunction" , COFF::IMAGE_SYM_CLASS_END_OF_FUNCTION },
425 { "Null" , COFF::IMAGE_SYM_CLASS_NULL },
426 { "Automatic" , COFF::IMAGE_SYM_CLASS_AUTOMATIC },
427 { "External" , COFF::IMAGE_SYM_CLASS_EXTERNAL },
428 { "Static" , COFF::IMAGE_SYM_CLASS_STATIC },
429 { "Register" , COFF::IMAGE_SYM_CLASS_REGISTER },
430 { "ExternalDef" , COFF::IMAGE_SYM_CLASS_EXTERNAL_DEF },
431 { "Label" , COFF::IMAGE_SYM_CLASS_LABEL },
432 { "UndefinedLabel" , COFF::IMAGE_SYM_CLASS_UNDEFINED_LABEL },
433 { "MemberOfStruct" , COFF::IMAGE_SYM_CLASS_MEMBER_OF_STRUCT },
434 { "Argument" , COFF::IMAGE_SYM_CLASS_ARGUMENT },
435 { "StructTag" , COFF::IMAGE_SYM_CLASS_STRUCT_TAG },
436 { "MemberOfUnion" , COFF::IMAGE_SYM_CLASS_MEMBER_OF_UNION },
437 { "UnionTag" , COFF::IMAGE_SYM_CLASS_UNION_TAG },
438 { "TypeDefinition" , COFF::IMAGE_SYM_CLASS_TYPE_DEFINITION },
439 { "UndefinedStatic", COFF::IMAGE_SYM_CLASS_UNDEFINED_STATIC },
440 { "EnumTag" , COFF::IMAGE_SYM_CLASS_ENUM_TAG },
441 { "MemberOfEnum" , COFF::IMAGE_SYM_CLASS_MEMBER_OF_ENUM },
442 { "RegisterParam" , COFF::IMAGE_SYM_CLASS_REGISTER_PARAM },
443 { "BitField" , COFF::IMAGE_SYM_CLASS_BIT_FIELD },
444 { "Block" , COFF::IMAGE_SYM_CLASS_BLOCK },
445 { "Function" , COFF::IMAGE_SYM_CLASS_FUNCTION },
446 { "EndOfStruct" , COFF::IMAGE_SYM_CLASS_END_OF_STRUCT },
447 { "File" , COFF::IMAGE_SYM_CLASS_FILE },
448 { "Section" , COFF::IMAGE_SYM_CLASS_SECTION },
449 { "WeakExternal" , COFF::IMAGE_SYM_CLASS_WEAK_EXTERNAL },
450 { "CLRToken" , COFF::IMAGE_SYM_CLASS_CLR_TOKEN }
453 static const EnumEntry<COFF::COMDATType> ImageCOMDATSelect[] = {
454 { "NoDuplicates", COFF::IMAGE_COMDAT_SELECT_NODUPLICATES },
455 { "Any" , COFF::IMAGE_COMDAT_SELECT_ANY },
456 { "SameSize" , COFF::IMAGE_COMDAT_SELECT_SAME_SIZE },
457 { "ExactMatch" , COFF::IMAGE_COMDAT_SELECT_EXACT_MATCH },
458 { "Associative" , COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE },
459 { "Largest" , COFF::IMAGE_COMDAT_SELECT_LARGEST },
460 { "Newest" , COFF::IMAGE_COMDAT_SELECT_NEWEST }
463 static const EnumEntry<COFF::DebugType> ImageDebugType[] = {
464 { "Unknown" , COFF::IMAGE_DEBUG_TYPE_UNKNOWN },
465 { "COFF" , COFF::IMAGE_DEBUG_TYPE_COFF },
466 { "CodeView" , COFF::IMAGE_DEBUG_TYPE_CODEVIEW },
467 { "FPO" , COFF::IMAGE_DEBUG_TYPE_FPO },
468 { "Misc" , COFF::IMAGE_DEBUG_TYPE_MISC },
469 { "Exception" , COFF::IMAGE_DEBUG_TYPE_EXCEPTION },
470 { "Fixup" , COFF::IMAGE_DEBUG_TYPE_FIXUP },
471 { "OmapToSrc" , COFF::IMAGE_DEBUG_TYPE_OMAP_TO_SRC },
472 { "OmapFromSrc", COFF::IMAGE_DEBUG_TYPE_OMAP_FROM_SRC },
473 { "Borland" , COFF::IMAGE_DEBUG_TYPE_BORLAND },
474 { "Reserved10" , COFF::IMAGE_DEBUG_TYPE_RESERVED10 },
475 { "CLSID" , COFF::IMAGE_DEBUG_TYPE_CLSID },
476 { "VCFeature" , COFF::IMAGE_DEBUG_TYPE_VC_FEATURE },
477 { "POGO" , COFF::IMAGE_DEBUG_TYPE_POGO },
478 { "ILTCG" , COFF::IMAGE_DEBUG_TYPE_ILTCG },
479 { "MPX" , COFF::IMAGE_DEBUG_TYPE_MPX },
480 { "Repro" , COFF::IMAGE_DEBUG_TYPE_REPRO },
483 static const EnumEntry<COFF::WeakExternalCharacteristics>
485 { "NoLibrary", COFF::IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY },
486 { "Library" , COFF::IMAGE_WEAK_EXTERN_SEARCH_LIBRARY },
487 { "Alias" , COFF::IMAGE_WEAK_EXTERN_SEARCH_ALIAS }
671 if (D.Type == COFF::IMAGE_DEBUG_TYPE_CODEVIEW) { in printCOFFDebugDirectory()
756 if (Magic != COFF::DEBUG_SECTION_MAGIC) in printCodeViewSymbolSection()
1092 if (Magic != COFF::DEBUG_SECTION_MAGIC) in printCodeViewTypeSection()
1124 COFF::SectionCharacteristics(0x00F00000)); in printSections()
1143 !(Section->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA)) { in printSections()
1225 if (SectionNumber == llvm::COFF::IMAGE_SYM_DEBUG) in getSectionName()
1227 if (SectionNumber == llvm::COFF::IMAGE_SYM_ABSOLUTE) in getSectionName()
1229 if (SectionNumber == llvm::COFF::IMAGE_SYM_UNDEFINED) in getSectionName()
1317 if (Section && Section->Characteristics & COFF::IMAGE_SCN_LNK_COMDAT in printSymbol()
1318 && Aux->Selection == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE) { in printSymbol()
1361 case COFF::IMAGE_FILE_MACHINE_AMD64: { in printUnwindInfo()
1373 case COFF::IMAGE_FILE_MACHINE_ARMNT: { in printUnwindInfo()
1480 case COFF::IMAGE_REL_BASED_ABSOLUTE: return "ABSOLUTE"; in getBaseRelocTypeName()
1481 case COFF::IMAGE_REL_BASED_HIGH: return "HIGH"; in getBaseRelocTypeName()
1482 case COFF::IMAGE_REL_BASED_LOW: return "LOW"; in getBaseRelocTypeName()
1483 case COFF::IMAGE_REL_BASED_HIGHLOW: return "HIGHLOW"; in getBaseRelocTypeName()
1484 case COFF::IMAGE_REL_BASED_HIGHADJ: return "HIGHADJ"; in getBaseRelocTypeName()
1485 case COFF::IMAGE_REL_BASED_ARM_MOV32T: return "ARM_MOV32(T)"; in getBaseRelocTypeName()
1486 case COFF::IMAGE_REL_BASED_DIR64: return "DIR64"; in getBaseRelocTypeName()