1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #include "ecmascript/compiler/aot_file/module_section_des.h" 16 17 namespace panda::ecmascript { GetSecName(const ElfSecName idx)18std::string ModuleSectionDes::GetSecName(const ElfSecName idx) 19 { 20 switch (idx) { 21 case ElfSecName::RODATA: 22 return ".rodata"; 23 case ElfSecName::RODATA_CST4: 24 return ".rodata.cst4"; 25 case ElfSecName::RODATA_CST8: 26 return ".rodata.cst8"; 27 case ElfSecName::RODATA_CST16: 28 return ".rodata.cst16"; 29 case ElfSecName::RODATA_CST32: 30 return ".rodata.cst32"; 31 case ElfSecName::TEXT: 32 return ".text"; 33 case ElfSecName::DATA: 34 return ".data"; 35 case ElfSecName::GOT: 36 return ".got"; 37 case ElfSecName::RELATEXT: 38 return ".rela.text"; 39 case ElfSecName::STRTAB: 40 return ".strtab"; 41 case ElfSecName::SYMTAB: 42 return ".symtab"; 43 case ElfSecName::SHSTRTAB: 44 return ".shstrtab"; 45 case ElfSecName::LLVM_STACKMAP: 46 return ".llvm_stackmaps"; 47 case ElfSecName::ARK_STACKMAP: 48 return ".ark_stackmaps"; 49 case ElfSecName::ARK_FUNCENTRY: 50 return ".ark_funcentry"; 51 case ElfSecName::ARK_ASMSTUB: 52 return ".ark_asmstub"; 53 case ElfSecName::ARK_MODULEINFO: 54 return ".ark_moduleinfo"; 55 case ElfSecName::ARK_CHECKSUMINFO: 56 return ".ark_checksuminfo"; 57 default: { 58 LOG_ECMA(FATAL) << "this branch is unreachable"; 59 UNREACHABLE(); 60 } 61 } 62 } 63 } // namespace panda::ecmascript 64