1 //===---------- ObjectFormats.cpp - Object format details for ORC ---------===// 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 // ORC-specific object format details. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #include "llvm/ExecutionEngine/Orc/Shared/ObjectFormats.h" 14 15 namespace llvm { 16 namespace orc { 17 18 StringRef ELFEHFrameSectionName = ".eh_frame"; 19 20 StringRef ELFInitArrayFuncSectionName = ".init_array"; 21 StringRef ELFInitFuncSectionName = ".init"; 22 StringRef ELFFiniArrayFuncSectionName = ".fini_array"; 23 StringRef ELFFiniFuncSectionName = ".fini"; 24 StringRef ELFCtorArrayFuncSectionName = ".ctors"; 25 StringRef ELFDtorArrayFuncSectionName = ".dtors"; 26 27 StringRef ELFInitSectionNames[3]{ 28 ELFInitArrayFuncSectionName, 29 ELFInitFuncSectionName, 30 ELFCtorArrayFuncSectionName, 31 }; 32 33 StringRef ELFThreadBSSSectionName = ".tbss"; 34 StringRef ELFThreadDataSectionName = ".tdata"; 35 36 bool isMachOInitializerSection(StringRef QualifiedName) { 37 for (auto &InitSection : MachOInitSectionNames) 38 if (InitSection == QualifiedName) 39 return true; 40 return false; 41 } 42 43 bool isELFInitializerSection(StringRef SecName) { 44 for (StringRef InitSection : ELFInitSectionNames) { 45 StringRef Name = SecName; 46 if (Name.consume_front(InitSection) && (Name.empty() || Name[0] == '.')) 47 return true; 48 } 49 return false; 50 } 51 52 bool isCOFFInitializerSection(StringRef SecName) { 53 return SecName.starts_with(".CRT"); 54 } 55 56 } // namespace orc 57 } // namespace llvm 58