• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <iomanip>
17 
18 namespace panda::ecmascript {
GetSecName(const ElfSecName idx)19 std::string ModuleSectionDes::GetSecName(const ElfSecName idx)
20 {
21     switch (idx) {
22         case ElfSecName::RODATA:
23             return ".rodata";
24         case ElfSecName::RODATA_CST4:
25             return ".rodata.cst4";
26         case ElfSecName::RODATA_CST8:
27             return ".rodata.cst8";
28         case ElfSecName::RODATA_CST16:
29             return ".rodata.cst16";
30         case ElfSecName::RODATA_CST32:
31             return ".rodata.cst32";
32         case ElfSecName::TEXT:
33             return ".text";
34         case ElfSecName::DATA:
35             return ".data";
36         case ElfSecName::GOT:
37             return ".got";
38         case ElfSecName::RELATEXT:
39             return ".rela.text";
40         case ElfSecName::STRTAB:
41             return ".strtab";
42         case ElfSecName::SYMTAB:
43             return ".symtab";
44         case ElfSecName::SHSTRTAB:
45             return ".shstrtab";
46         case ElfSecName::LLVM_STACKMAP:
47             return ".llvm_stackmaps";
48         case ElfSecName::ARK_STACKMAP:
49             return ".ark_stackmaps";
50         case ElfSecName::ARK_FUNCENTRY:
51             return ".ark_funcentry";
52         case ElfSecName::ARK_ASMSTUB:
53             return ".ark_asmstub";
54         case ElfSecName::ARK_MODULEINFO:
55             return ".ark_moduleinfo";
56         default: {
57             LOG_ECMA(FATAL) << "this branch is unreachable";
58             UNREACHABLE();
59         }
60     }
61 }
62 }  // namespace panda::ecmascript
63