1 //===-- llvm/BinaryFormat/XCOFF.cpp - The XCOFF file format -----*- C++/-*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "llvm/BinaryFormat/XCOFF.h" 10 11 using namespace llvm; 12 13 StringRef XCOFF::getMappingClassString(XCOFF::StorageMappingClass SMC) { 14 switch (SMC) { 15 case XCOFF::XMC_DS: 16 return "DS"; 17 case XCOFF::XMC_RW: 18 return "RW"; 19 case XCOFF::XMC_PR: 20 return "PR"; 21 case XCOFF::XMC_TC0: 22 return "TC0"; 23 case XCOFF::XMC_BS: 24 return "BS"; 25 case XCOFF::XMC_RO: 26 return "RO"; 27 case XCOFF::XMC_UA: 28 return "UA"; 29 case XCOFF::XMC_TC: 30 return "TC"; 31 default: 32 report_fatal_error("Unhandled storage-mapping class."); 33 } 34 } 35 36 #define RELOC_CASE(A) \ 37 case XCOFF::A: \ 38 return #A; 39 StringRef XCOFF::getRelocationTypeString(XCOFF::RelocationType Type) { 40 switch (Type) { 41 RELOC_CASE(R_POS) 42 RELOC_CASE(R_RL) 43 RELOC_CASE(R_RLA) 44 RELOC_CASE(R_NEG) 45 RELOC_CASE(R_REL) 46 RELOC_CASE(R_TOC) 47 RELOC_CASE(R_TRL) 48 RELOC_CASE(R_TRLA) 49 RELOC_CASE(R_GL) 50 RELOC_CASE(R_TCL) 51 RELOC_CASE(R_REF) 52 RELOC_CASE(R_BA) 53 RELOC_CASE(R_BR) 54 RELOC_CASE(R_RBA) 55 RELOC_CASE(R_RBR) 56 RELOC_CASE(R_TLS) 57 RELOC_CASE(R_TLS_IE) 58 RELOC_CASE(R_TLS_LD) 59 RELOC_CASE(R_TLS_LE) 60 RELOC_CASE(R_TLSM) 61 RELOC_CASE(R_TLSML) 62 RELOC_CASE(R_TOCU) 63 RELOC_CASE(R_TOCL) 64 } 65 return "Unknown"; 66 } 67 #undef RELOC_CASE 68